Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Error when creating 24/96 or 24/192 FLAC files (Read 1469 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Error when creating 24/96 or 24/192 FLAC files

foobar2000's FLAC encoder creates invalid files when compressing the "warbles-*.wav" files from Monty's article, while the official encoder makes apparently OK files that pass the integrity test but are actually 4 samples longer than the uncompressed sources.

I've read this old thread but if I understood it correctly back then the problem was the outdated decoder at the time of the 1.2 release. Using the -keep-foreign-metadata switch with the official encoder will output an error about an invalid wave file and not compress anything. So it seems the problem lies in the source files but I don't know how likely it is for users to encounter a similar situation with their music and at the moment foobar2000 reports the conversion as successful despite producing unusable files.

Error when creating 24/96 or 24/192 FLAC files

Reply #1
The length fields for the files' main "RIFF" chunks is 12 bytes less than the actual sizes of the files. A proper RIFF parser which takes that size into account would thus truncate any data past that point. Of course, it could just decide to reject the files altogether since the specified length of the data chunk is too long for the data accepted. 12 bytes comes out to 4 24-bit samples.

Possible explanation is that whatever wrote those files did not take the size of the "fact" chunks into account when writing the size to the header, since that's the only chunk which comes to to exactly 12 bytes including its id and length fields.

You can fix it for foobar2000, and for any other proper RIFF parser, by opening the files in a hex editor and incrementing the little-endian 32-bit length field, at offset 4, by 12.

 

Error when creating 24/96 or 24/192 FLAC files

Reply #2
1) foobar2000 doesn't have its own FLAC encoder; it uses flac.exe.

2) "official" flac.exe doesn't work properly with 24-bit mono files. Updated encoder is available here: http://www.foobar2000.org/encoderpack