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: FLAC Discrepancy (Read 4922 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

FLAC Discrepancy

Hello,

I was just about to pretty much stop using wav in favor of FLAC, and I decided to run one final test just to convince myself that FLAC is a perfect format.

I extracted a wav file and converted it to FLAC three different ways:

1) direct rip to FLAC using PlexTools
2) rip to wav, then converted using FLAC Frontend
3) wav (same file as above), converted using dbPowerAMP


This was all done using Level 6. All extraneous info (ID tags, etc.) were stripped and the file sizes compared. To my surprise, they weren't exactly the same. Just a few hundred bytes variance, but if this really is a perfect format shouldn't the end results all be the same (assuming all other variables remain constant)? For example, I can rip a wav file with different programs (even using a different drive), and the file sizes are always EXACTLY the same.

All three FLAC conversions were made from the exact same wav file. I've even experimented a bit further, but I won't bore you with the details. All I know is that different programs seem to be producing slightly different resulsts. Am I missing something here? Can anyone please explain this? Thanks in advance.

FLAC Discrepancy

Reply #1
The three different applications might not use an identical flac encoder/version.
Which might lead to different file sizes for the encoded flac files. This is fine as long as the decoded PCM stream is bit identical to the original!

FLAC Discrepancy

Reply #2
As far as I know, FLAC isn't ZIP, but a lossless format. So data is moved around with every single conversion. That means you can't have the same bit output after all the conversion steps you have taken, but though bits are slightly different the audio has remained the same.

If you'd like to run tests, you probably should use tools with peak graphical info and compare diferent and equal samples to check for differences. Ultimately, an ABX test isn't a bad idea either.

edit: beaten by krmathis :|
Join //spreadopenmedia.com to promote Opus, Vorbis, FLAC, etc

FLAC Discrepancy

Reply #3
But yes, ABX test is a useless, bad idea, as FLAC is lossless. You know, like in no loss. Like in all FLACs made of the same WAV would be the same (have the same encoded PCM stream).
You could use foobar2000 with its binary compare plugin to compare the encoded PCM data of these files. Or use any other tool capable of a similar binary compare on the decoded PCM streams (not the original FLACs, of course).

edit: Well of course if the binary comparison fails, ABXing might make some sense... But FLAC is mathematically lossless, so this won't happen
Life is Real...
(But not in audio :) )

FLAC Discrepancy

Reply #4
If you want to compare two files with audio-data you should be sure you compare the audio-data and the audio-data only. If you just look at two files from 'the outside' and notice size differences it could be caused by different fileheaders. The audio part would be exactly the same but file sizes would still be different.

I think in comparing wav files it's usually the RIFF headers which could differ.
Every night with my star friends / We eat caviar and drink champagne
Sniffing in the VIP area / We talk about Frank Sinatra
Do you know Frank Sinatra? / He's dead

FLAC Discrepancy

Reply #5
Quote
I think in comparing wav files it's usually the RIFF headers which could differ.


Yes I think this is right. Look here

FLAC Discrepancy

Reply #6
FLACs contain an internal MD5 checksum of the raw audio data.

It can be checked by command line with "metaflac --show-md5sum",
or the "fingerprint" option with the frontend tool.


FLAC Discrepancy

Reply #8
>As far as I know, FLAC isn't ZIP, but a lossless format. So data is moved around with every single conversion

Nope, it is a Zip type compression, where what goes in exactly equals what comes out.

With lossless formats you can only compare the data when converted back to wave, not byte compare on the lossless file itself.

Wave files can have different wave headers, hold the mouse over all the wave files and dbpoweramp will show which type of header there is, each header (waveformat, waveformatex, waveformatextensible) has a few bytes difference in length.

FLAC Discrepancy

Reply #9
regarding the RIFF data replies: this doesn't have to do with his WAVE file, he's asking why the same WAVE file converted to FLAC with three different programs don't yield identical FLAC files.

the answer is that there are many insignificant reasons they could be different, but they don't need to be exactly the same to be lossless. there's nothing to worry about.

Josh

edit:clarifications

FLAC Discrepancy

Reply #10
regarding the RIFF data replies: this doesn't have to do with his WAVE file, he's asking why the same WAVE file converted to FLAC with three different programs don't yield identical FLAC files.
Ah, if that's the case, he can verify correctness by decoding the FLACs and comparing the resulting WAVs, right? Or will in this case FLAC generate different RIFF headers?

FLAC Discrepancy

Reply #11
if all those three use flac.exe then they should decode to the exact same wave file.  if not, then it's depends on how each tool writes the WAVE file.

the easiest/fastest way to know is 'metaflac --show-md5sum file1.flac file2.flac file3.flac'; they should all be the same.

Josh

 

FLAC Discrepancy

Reply #12
This also assumes that the drive rips exactly the same sequence of bytes each time (not exactly guaranteed if it's not EAC). If any of the encoding methods used any additional options to change the size, or added tags, then the CRC should still be identical, at least.