flac icon indicating copy to clipboard operation
flac copied to clipboard

Filename limits? FLAC__STREAM_ENCODER_IO_ERROR

Open m1gr opened this issue 6 months ago • 3 comments

test flac file is okay:

user@linux:~/musik$ flac -t MC\ Rene\ -\ X-Kalibur\ \(Megaremix\)\ ft.\ Galv\,\ Classic\ Der\ Dicke\,\ David\ Pe\,\ Alyssa\,\ Der\ Benman\,\ Der\ Buttler\,\ Skor82\,\ Terra\ Pete\,\ Azisa\,\ Toni-L\,\ Alphonzo\,\ Ari\ Chicago\,\ Heliocopta\,\ Lupara\ Versato\,\ Liquid\,\ Maniac\,\ Taiga\ Trece\,\ NOEL\ IS\ \&\ Figub\ Brazlevic.flac 

flac 1.5.0
Copyright (C) 2000-2009  Josh Coalson, 2011-2025  Xiph.Org Foundation
flac comes with ABSOLUTELY NO WARRANTY.  This is free software, and you are
welcome to redistribute it under certain conditions.  Type `flac' for details.

MC Rene - X-Kalibur (Megaremix) ft. Galv, Classic Der Dicke, David Pe, Alyssa, Der Benman, Der Buttler, Skor82, Terra Pete, Azisa, Toni-L, Alphonzo, Ari Chicago, Heliocopta, Lupara Versato, Liquid, Maniac, Taiga Trece, NOEL IS & Figub Brazlevic.flac: ok    

but re-encode not:

user@linux:~/musik$ flac -8f MC\ Rene\ -\ X-Kalibur\ \(Megaremix\)\ ft.\ Galv\,\ Classic\ Der\ Dicke\,\ David\ Pe\,\ Alyssa\,\ Der\ Benman\,\ Der\ Buttler\,\ Skor82\,\ Terra\ Pete\,\ Azisa\,\ Toni-L\,\ Alphonzo\,\ Ari\ Chicago\,\ Heliocopta\,\ Lupara\ Versato\,\ Liquid\,\ Maniac\,\ Taiga\ Trece\,\ NOEL\ IS\ \&\ Figub\ Brazlevic.flac 

flac 1.5.0
Copyright (C) 2000-2009  Josh Coalson, 2011-2025  Xiph.Org Foundation
flac comes with ABSOLUTELY NO WARRANTY.  This is free software, and you are
welcome to redistribute it under certain conditions.  Type `flac' for details.


MC Rene - X-Kalibur (Megaremix) ft. Galv, Classic Der Dicke, David Pe, Alyssa, Der Benman, Der Buttler, Skor82, Terra Pete, Azisa, Toni-L, Alphonzo, Ari Chicago, Heliocopta, Lupara Versato, Liquid, Maniac, Taiga Trece, NOEL IS & Figub Brazlevic.flac: ERROR initializing encoder
                                                                                                                                                                                                                                                           init_status = FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR
                                                                                                                                                                                                                                                           state = FLAC__STREAM_ENCODER_IO_ERROR

An error occurred opening the output file; it is likely that the output
directory does not exist or is not writable, the output file already exists and
is not writable, or the disk is full.

I test other files in same directory just fine. The disk isn't full and i have write access. The file obvious already exist and i'm using "-f".

flac issue? bash issue? (same filename completion used ) filesystem issue? (using btrfs)

m1gr avatar Jun 05 '25 18:06 m1gr

What happens when you try to decode the file?

ktmf01 avatar Jun 05 '25 19:06 ktmf01

user@linux:~/musik/$ flac -d MC\ Rene\ -\ X-Kalibur\ \(Megaremix\)\ ft.\ Galv\,\ Classic\ Der\ Dicke\,\ David\ Pe\,\ Alyssa\,\ Der\ Benman\,\ Der\ Buttler\,\ Skor82\,\ Terra\ Pete\,\ Azisa\,\ Toni-L\,\ Alphonzo\,\ Ari\ Chicago\,\ Heliocopta\,\ Lupara\ Versato\,\ Liquid\,\ Maniac\,\ Taiga\ Trece\,\ NOEL\ IS\ \&\ Figub\ Brazlevic.flac 

flac 1.5.0
Copyright (C) 2000-2009  Josh Coalson, 2011-2025  Xiph.Org Foundation
flac comes with ABSOLUTELY NO WARRANTY.  This is free software, and you are
welcome to redistribute it under certain conditions.  Type `flac' for details.

MC Rene - X-Kalibur (Megaremix) ft. Galv, Classic Der Dicke, David Pe, Alyssa, Der Benman, Der Buttler, Skor82, Terra Pete, Azisa, Toni-L, Alphonzo, Ari Chicago, Heliocopta, Lupara Versato, Liquid, Maniac, Taiga Trece, NOEL IS & Figub Brazlevic.flac: done
user@linux:~/musik$ flac -f8 MC\ Rene\ -\ X-Kalibur\ \(Megaremix\)\ ft.\ Galv\,\ Classic\ Der\ Dicke\,\ David\ Pe\,\ Alyssa\,\ Der\ Benman\,\ Der\ Buttler\,\ Skor82\,\ Terra\ Pete\,\ Azisa\,\ Toni-L\,\ Alphonzo\,\ Ari\ Chicago\,\ Heliocopta\,\ Lupara\ Versato\,\ Liquid\,\ Maniac\,\ Taiga\ Trece\,\ NOEL\ IS\ \&\ Figub\ Brazlevic.wav 

flac 1.5.0
Copyright (C) 2000-2009  Josh Coalson, 2011-2025  Xiph.Org Foundation
flac comes with ABSOLUTELY NO WARRANTY.  This is free software, and you are
welcome to redistribute it under certain conditions.  Type `flac' for details.

MC Rene - X-Kalibur (Megaremix) ft. Galv, Classic Der Dicke, David Pe, Alyssa, Der Benman, Der Buttler, Skor82, Terra Pete, Azisa, Toni-L, Alphonzo, Ari Chicago, Heliocopta, Lupara Versato, Liquid, Maniac, Taiga Trece, NOEL IS & Figub Brazlevic.wav: wrote 172631487 bytes, ratio=0,739

decode to wav and encode the wav to flac works. but again if i run flac -8f on flac file it don't work.

user@linux:~/musik$ flac -8f MC\ Rene\ -\ X-Kalibur\ \(Megaremix\)\ ft.\ Galv\,\ Classic\ Der\ Dicke\,\ David\ Pe\,\ Alyssa\,\ Der\ Benman\,\ Der\ Buttler\,\ Skor82\,\ Terra\ Pete\,\ Azisa\,\ Toni-L\,\ Alphonzo\,\ Ari\ Chicago\,\ Heliocopta\,\ Lupara\ Versato\,\ Liquid\,\ Maniac\,\ Taiga\ Trece\,\ NOEL\ IS\ \&\ Figub\ Brazlevic.flac 

flac 1.5.0
Copyright (C) 2000-2009  Josh Coalson, 2011-2025  Xiph.Org Foundation
flac comes with ABSOLUTELY NO WARRANTY.  This is free software, and you are
welcome to redistribute it under certain conditions.  Type `flac' for details.


MC Rene - X-Kalibur (Megaremix) ft. Galv, Classic Der Dicke, David Pe, Alyssa, Der Benman, Der Buttler, Skor82, Terra Pete, Azisa, Toni-L, Alphonzo, Ari Chicago, Heliocopta, Lupara Versato, Liquid, Maniac, Taiga Trece, NOEL IS & Figub Brazlevic.flac: ERROR initializing encoder
                                                                                                                                                                                                                                                           init_status = FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR
                                                                                                                                                                                                                                                           state = FLAC__STREAM_ENCODER_IO_ERROR

An error occurred opening the output file; it is likely that the output
directory does not exist or is not writable, the output file already exists and
is not writable, or the disk is full.

m1gr avatar Jun 06 '25 07:06 m1gr

Filenames in btrfs cannot be longer than 255 bytes. This filename has a length of 250 bytes. When FLAC re-encodes, it writes to a temporary file, of which the filename is the same but appended with a few characters. This makes the filename longer than 250 bytes.

Specifically: here's the appended stuff:

https://github.com/xiph/flac/blob/8d648456a2d7444d54a579e365bab4c815ac6873/src/flac/main.c#L1718

It looks a little strange, the idea is to make it incredibly unlikely the tempfile already exists in some form.

As a workaround, you could rename the file, re-encode it (to preserve metadata) and then restore the original name.

ktmf01 avatar Jun 06 '25 14:06 ktmf01