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: Diff after decode FLAC file (Read 6078 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Diff after decode FLAC file

Hi.

I had a FLAC file which I decoded using the reference decoder. As expected, the WAV file was larger than the FLAC one: it had 51.304.506 bytes. Then, I coded this WAV file and got a FLAC file.

However, while the first one had 31.240.944 bytes, the second one had 29.144.603 bytes. After that, I decoded this final FLAC file and the resultant WAV file had 51.304.220 bytes.

So, where is the lossless compression? Curiously, when I compared these files with 'diff' command, it shows they're equal. How is this possible, if they have different sizes?

Thanks!

Diff after decode FLAC file

Reply #1
Flag files have tags so the file sizes won't be equal.

Diff after decode FLAC file

Reply #2
Different encoder settings give different compressed file sizes.

Diff after decode FLAC file

Reply #3
Flag files have tags so the file sizes won't be equal.
That explains the  size difference between the flac files, but what about the wav files difference ? Could you elaborate ?
I've always found it strange that the wav-flac-wav process can result in non-identical wav files. The audio conversion is lossless, that's not the issue. I've found the --keep-foreign-metadata option to be the solution, especially since I mostly use BWF (broadcast wave) files with metadata that shouldn't get lost or modified. Unfortunately the decoder doesn't automatically recognize this option, so it's not completely idiot proof.
evoj2, would you be able to repeat your test with this option ? I'm curious if it solves your "problem".

Diff after decode FLAC file

Reply #4
Indeed, it seems that --keep-foreign-metadata was used the first time when encoding the first FLAC file. I find that surprising though: the command-line encoder/decoder doesn't use it by default (WavPack does).

Diff after decode FLAC file

Reply #5
Flag files have tags so the file sizes won't be equal.
That explains the  size difference between the flac files, but what about the wav files difference ? Could you elaborate ?



While tagging WAV files with album/song info is uncommon, they still have headers that contain information about the file (including in some cases actual album info).  Theres various ways you can put together a wav file, and they're not necessarily the same size.

Theres some information here if you're interested:  http://www-mmsp.ece.mcgill.ca/Documents/Au.../WAVE/WAVE.html

As you can see, even for plain 16 bit, stereo PCM there are various different ways the header can be constructed even without considering metadata.