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: A few questions about FLACs internal MD5 (Read 9006 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

A few questions about FLACs internal MD5

Hey..

1. Does AudioTester test a flac files md5 (If not what is the easiest way?)

2. Does the internal MD5 change when you change the tags?

Thanks

A few questions about FLACs internal MD5

Reply #1
1. Which audiotester are you referring to, specifically?

2. No. The MD5 is for the audio only
Music: sounds arranged such that they construct feelings.

A few questions about FLACs internal MD5

Reply #2
The MD5 stored in the FLAC is for the PCM audio samples that were originally encoded.

I assume you're talking about the tool from vuplayer.com. A quick look at the source reveals that it decodes the file, thus detects the same errors as any other decoder/player: losing sync, bad header, frame CRC mismatch, unparseable stream. It also will catch an MD5 mismatch and wrong number of samples. So the answer to your question is yes.

If the answer were no, the easiest way to test would be to decode or test the flac with the official command-line flac tool (flac.exe on Windows) from https://www.xiph.org/flac/download.html (docs: https://www.xiph.org/flac/documentation_tools_flac.html )

A few questions about FLACs internal MD5

Reply #3
1. Which audiotester are you referring to, specifically?

2. No. The MD5 is for the audio only

The audio tester that is called audiotester lol. http://www.vuplayer.com/other.php


The MD5 stored in the FLAC is for the PCM audio samples that were originally encoded.

I assume you're talking about the tool from vuplayer.com. A quick look at the source reveals that it decodes the file, thus detects the same errors as any other decoder/player: losing sync, bad header, frame CRC mismatch, unparseable stream. It also will catch an MD5 mismatch and wrong number of samples. So the answer to your question is yes.

If the answer were no, the easiest way to test would be to decode or test the flac with the official command-line flac tool (flac.exe on Windows) from https://www.xiph.org/flac/download.html (docs: https://www.xiph.org/flac/documentation_tools_flac.html )

Perfect! I use it all the time to quickly check FLACs before i transcode them. Mostly on FLACs that have been sitting on my HDD forever.  I always assumed it was doing that until today when i realized i had no proof lol

Now that i think about it though.. If the file was corrupt.. would it even be able to be transcoded? Since it would have an error decoding?


Thanks to both of you. 

A few questions about FLACs internal MD5

Reply #4
Now that i think about it though.. If the file was corrupt.. would it even be able to be transcoded? Since it would have an error decoding?


I just tested a file with foobar2000. First I corrupted the checksum only, and then I corrupted the audio, both by overwriting a couple of bytes.

fb2k transcodes but warns. I only tried transcoding to lossless, in order to bit-compare the corrupted file with the converted (which is technically a completely valid file), and fb2k does not warn.

A few questions about FLACs internal MD5

Reply #5
fb2k transcodes but warns. I only tried transcoding to lossless, in order to bit-compare the corrupted file with the converted (which is technically a completely valid file), and fb2k does not warn.

Am I interpreting this correctly, that if the audio data are corrupt then fb2k warns of the corruption, but if the MD5 does not match then there is no warning?

A few questions about FLACs internal MD5

Reply #6
fb2k transcodes but warns. I only tried transcoding to lossless, in order to bit-compare the corrupted file with the converted (which is technically a completely valid file), and fb2k does not warn.

Am I interpreting this correctly, that if the audio data are corrupt then fb2k warns of the corruption, but if the MD5 does not match then there is no warning?


Yes.

To be more precise, the following happens whether or not foo_verifier is installed.

* Altered a byte in the checksum only: No warning. "No problems occurred." and "Track converted successfully."
* Altered then a byte in the audio: "1 out of 1 tracks converted with major problems." and  "  Corrupted FLAC stream
  Track converted with major problems."

I tried converting to WAV and to FLAC; inspecting the output FLAC file, the number of samples remains the same, and it gets its "correct" checksum, which of course differs from the old one.

So if you enjoy transcoding, then maybe you should write the checksum to a tag (or write a parser that retrieves it from your rip log).

A few questions about FLACs internal MD5

Reply #7
To be more precise, the following happens whether or not foo_verifier is installed.

* Altered a byte in the checksum only: No warning. "No problems occurred." and "Track converted successfully."

Apparently fb2k turns off MD5 checking then, or ignores the return value of FLAC__stream_decoder_finish.

I could imagine the decoding modules for simply playing a file and converting one are shared, and they turned off MD5 checking for playing because it doesn't really serve any purpose [during playing].
Music: sounds arranged such that they construct feelings.

A few questions about FLACs internal MD5

Reply #8
* Altered a byte in the checksum only: No warning. "No problems occurred." and "Track converted successfully."
* Altered then a byte in the audio: "1 out of 1 tracks converted with major problems." and  "  Corrupted FLAC stream
  Track converted with major problems."


This may be obvious to someone else, but ...

How in the world does it know the difference? How would it know that the checksum is invalid, but the audio unchanged, rather than the audio being invalid for a good checksum?

A few questions about FLACs internal MD5

Reply #9
* Altered a byte in the checksum only: No warning. "No problems occurred." and "Track converted successfully."
* Altered then a byte in the audio: "1 out of 1 tracks converted with major problems." and  "  Corrupted FLAC stream
  Track converted with major problems."


This may be obvious to someone else, but ...

How in the world does it know the difference? How would it know that the checksum is invalid, but the audio unchanged, rather than the audio being invalid for a good checksum?

Know the difference?  Why would it care?  If the checksum doesn't match the audio then something is corrupt and it doesn't much matter what.  In the real world it would likely be a lot more than one byte.

A few questions about FLACs internal MD5

Reply #10
How in the world does it know the difference?

FLAC has more levels of error checking. The MD5 is for the whole file, but every frame has two checksums, for the header and for the whole frame.

fb2k detects an error in the audio through the CRC checksums, but it does not check the MD5 (and therefore doesn't know it is wrong)
Music: sounds arranged such that they construct feelings.

A few questions about FLACs internal MD5

Reply #11
Sounds then like the MD5 checksum is meant mostly for use by external programs to check the validity of the decoded data, rather than by the flac library decoder.

What does 'flac -t' say when you test the file with the corrupted MD5 checksum?

A few questions about FLACs internal MD5

Reply #12
fb2k detects an error in the audio through the CRC checksums, but it does not check the MD5 (and therefore doesn't know it is wrong)

fb2k does check md5 for FLAC files

A few questions about FLACs internal MD5

Reply #13
fb2k detects an error in the audio through the CRC checksums, but it does not check the MD5 (and therefore doesn't know it is wrong)

fb2k does check md5 for FLAC files

Yes, please read the thread. The verifier does, but apparently the decoding stage during transcoding does not.
Music: sounds arranged such that they construct feelings.

 

A few questions about FLACs internal MD5

Reply #14
Know the difference?  Why would it care?  If the checksum doesn't match the audio then something is corrupt and it doesn't much matter what.  In the real world it would likely be a lot more than one byte.


IIRC the frame CRCs take in sync data as well as audio, so if an encoder does not get those things right, the (reference) decoder will yell. If audio matches the MD5 and frame CRCs are wrong, then at least you know that you can save all the audio in the files you encoded with tool x ten years ago.

Also, FLAC is supposed to be streamable, justifying checksums which do not require the entire stream.  (And ... I wonder whether all applications have actually written the (complete stream) md5?)