HydrogenAudio

Lossless Audio Compression => FLAC => Topic started by: evoj2 on 2013-11-22 16:36:48

Title: Diff after decode FLAC file
Post by: evoj2 on 2013-11-22 16:36:48
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!
Title: Diff after decode FLAC file
Post by: saratoga on 2013-11-22 16:55:08
Flag files have tags so the file sizes won't be equal.
Title: Diff after decode FLAC file
Post by: pdq on 2013-11-22 18:13:48
Different encoder settings give different compressed file sizes.
Title: Diff after decode FLAC file
Post by: Kees de Visser on 2013-11-22 18:39:25
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".
Title: Diff after decode FLAC file
Post by: skamp on 2013-11-22 18:48:21
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).
Title: Diff after decode FLAC file
Post by: saratoga on 2013-11-22 19:28:05
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 (http://www-mmsp.ece.mcgill.ca/Documents/AudioFormats/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.