Is there a program to analyze flac, wav and MP3 music files for corruption

Are there any programs that will analyze the structure of the specific music format WAV, FLAC and MP3 and make an educated guess on whether the file structure is corrupt.

I encountered corruption in a FLAC file that was used to create a MP3. Both FLAC and MP3 had the music breaking up in the same spots. I recreated the FLAC/MP3 from the original WAV file which was OK. I think this was disk corruption from back in 2022 and want to make sure the the other FLAC’s are fine before finally removing the original WAV files.

1 Like

Someone can correct me if I am wrong, but FLAC store a checksum of the audio data in the metadata. And using the official FLAC tool with the -t option will test them. So you could make a script to use that to test all your FLAC files. Don’t know about the other formats.

5 Likes

They exist. I had some borked MP3 from a automated podcast download. They stood out initially due to missing TAGs. I used this GUI tool to sift them out. Simple and fast. https://mp3val.sourceforge.net I didn’t use the repair mode as I could just return to the source and download again.

FLAC has an embedded MD5 checksum. And a simple a commandline test option with the above tools @DontMindMe points at. For people like me who like GUIs there is Flactfrontend that bolts on top of it. Example of use: Test FLACs for corruption - bliss

2 Likes

Google results

1 Like

From: https://community.mp3tag.de/t/how-to-check-files-for-errors/44633

Symptoms of erroneous files are often

  • missing or wrong bitrate or length
  • audible blips or skips
  • tags seem to be sticky and cannot be removed

There are some really good tools to check the files for errors, namely

MP3 Diags — identifies many different issues in MP3 files

Website: http://mp3diags.sourceforge.net
Download: MP3 Diags - Getting MP3 Diags

If the font size in MP3 Diags is too small to read, try the Tutorial on how to set a larger font size in MP3 Diags .

MP3val — validate and fix MPEG audio files

http://mp3val.sourceforge.net

foobar2000 — multiple supported formats

https://foobar2000.org

After installing foobar2000 see Utilities → Verify integrity from the right-click context menu to check the file for errors. In case of an erroneous MP3 header, Fix VBR MP3 header might even repair the file

Note: In many cases the troublesome file may play correctly in some or all media players or may be editable in other metadata editors. However, this is not an indicator of whether the file structure is valid or not. In contrast to just playing a file, Mp3tag re-writes the metadata part of files and takes a cautionary approach when performing changes that might affect the audio part to prevent data loss or more damage.

3 Likes

I saw that last night using mediainfo, the checksum of the newly created file and the original are different so I may need to rethinking disc corruption. I am just in the beginning of checking this out. Two years ago I started generating md5sums of all my music and cover-art files, but that was after the creation of the files in question.

That will make sense you get two different checksums from the new file and original file as you’re using different level of compression, and maybe even an updated FLAC tool to compress.

It is more about if the MD5 of the original matches what a newly generated MD5 of that original now creates.

Beware with MD5, as it scans the whole file, including metadata (tags).
Any small tag change (rating, play count, replay gain, etc.) will change the MD5 checksum.

3 Likes

This tip is probably only for MP3 owners.

Load your entire collection into VLC.

There are at least three possible versions of the message, according to this screenshot.

From: https://community.mp3tag.de/t/how-to-fix-error-mp3-header-parse-error/58511

You can only deal with the errors.

So does that mean if Picard updates the tags in a file, it updates the MD5 in the FLAC too?

Which means that once a file has been re-tagged the MD5 is going to match even if the audio is bad?

I think the internal md5sum is on the unencoded audio data, but not sure.
From mediainfo --Details=1 ‘The Seldom Scene - Dream Scene.flac’

“000001A MD5 signature of the unencoded audio data: 121429967774423986666630540977544873020 (0x5B5A8FA4CAB671A86FAD801ECC4BC43C)”

Oh sorry, I didn’t know there was an internal MD5 checksum in FLAC files.
If there is such a thing, it should not change when any tags change.

That would make sense to me. If Tags can be changed without upsetting that MD5 that is good design.

1 Like

Just a followup on what I think happened and my plans. I am pretty convinced this was a issue with my system disk going bad and reading bad data when creating the flac image but reading it correctly when I archived the wav file to the archive disk. I am not sure yet if I have this issue on any other files. There is no way I know of (or found) to check for corruption in the wav file.

I looked and could not find a program to read the raw PCM data from the wav file and create a MD5sum to compare to the embedded MD5sum in the flac file. I am going to set up a batch script to use “flac” to encode the archived wav image into flac then extracting the MD5sum and compare it to the present flac image files, at least I will know that the archived flac files came from the archived wave files.

I will also run the wav/cue file images through cuetools verifier to verify that they match my EAC rips. A lot of work, but once done I will know what I may have to re-rip.

ffmpeg -loglevel warning -hide_banner -i file.flac -map 0:a -f hash -hash md5 - gives you the md5sum of the decoded audio stream of file.flac. Works for flac and wav and any other (lossless) file format ffmpeg knows.

1 Like

Thank you, I was looking at ffmpeg today but my 64 bit cygwin install “appears” to have some kind of 32 bit “something” causing ffmpeg to fail on execution. I have some custom builds I did a few years back and am not sure how well I documented them. I really hate reinstalling cygwin since I always miss “something” I need. I thought about the windows ffmpeg executable but I do not enjoy scripting in “windz”.