2

As I have recently learned, flac files created by piping encoded flac data to STDOUT are missing certain pieces of metadata, in particular information about the length of the recording.

Is it possible to retroactively add this data without decoding to wav and re-encoding the data (the data is too large for a wav file, and flac will gladly decode to wav, but then throw an error and refuse to re-encode to flac afterwards)? I know the exact length of the recording, if this is helpful.


For the curious: This is what happens when I decode and re-encode a 7 day audio recording from flac to wav and back.

flac --decode test.flac 

flac 1.3.1, Copyright (C) 2000-2009  Josh Coalson, 2011-2014  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.

test.flac: WARNING, cannot check MD5 signature since it was unset in the STREAMINFO
done         
test.flac: ERROR: stream is too big to fit in a single WAVE file

Now I have a wav file that plays fine in VLC and contains proper length information. Trying to re-encode:

flac test.wav --best --output-name="test2.flac"

flac 1.3.1, Copyright (C) 2000-2009  Josh Coalson, 2011-2014  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.

test.wav: ERROR: 'data' chunk has size of 0
malexmave
  • 133

1 Answers1

1

The only solution I have found is to re-encode the whole thing using sox:

sox test.flac test_full.flac --show-progress

This will take the full recording, decode it, and re-encode it back to flac. Highly inefficient, but gets the job done. If there is a nicer solution that avoide the 10 minute encoding process, feel free to add another answer and I will accept that one instead.

malexmave
  • 133