Free tools like mp3val and FFmpeg find corrupted MP3 files in a music collection. Scan the library, identify the damaged tracks, and repair only those. Batch checking saves time and keeps the collection clean.
Why Check for MP3 Errors
MP3 files become corrupted during download, transfer, or storage. A broken frame or bad header causes skipping, static, or a player that refuses to play the file. Instead of guessing which files are damaged, run command-line tools to find them automatically. Repair efforts then focus only on the files that need it.
Using Mp3val to Find Corrupted MP3 Files
mp3val is a free, open-source tool that checks MP3 files for broken frames and bad headers. It runs from the command line and handles batch checking of an entire folder.
Installing Mp3val
Download mp3val from its official source and place the executable in a convenient directory. No installation is required. Run it from the command line.
Running a Basic Scan
Open a terminal or command prompt and navigate to the folder containing the MP3 files. Run:
mp3val -f *.mp3
This scans all MP3 files in the current folder. The -f flag tells mp3val to show only files that have errors. A clean file is not listed. Any file that appears in the output has a problem and should be repaired.
Batch Checking Subfolders
To scan a whole music library recursively, use:
mp3val -f -r *.mp3
The -r flag enables recursive scanning of subdirectories. You get a complete list of all damaged files in the collection.
Using FFmpeg to Check Audio File Integrity
FFmpeg is a powerful multimedia framework. It checks MP3 files for errors by decoding the file and reporting any decoding problems.
Checking a Single File
Run this command in the terminal:
ffmpeg -v error -i song.mp3 -f null -
The command decodes the file and prints only errors. No output means no decoding errors were found. If problems exist, FFmpeg prints error messages describing them.
Batch Checking a Folder
To batch check MP3 files, use a loop. On Windows Command Prompt:
for %i in (*.mp3) do ffmpeg -v error -i "%i" -f null - 2>> errors.txt
On Linux or macOS bash:
for i in *.mp3; do ffmpeg -v error -i "$i" -f null - 2>> errors.txt; done
All error messages land in errors.txt. Review that file to see which tracks had problems.
Checking Duration and Tags
An MP3 file sometimes plays fine but shows a wrong displayed duration. This indicates a missing or incorrect VBR header, Xing or VBRI, rather than damaged audio. The file is playable, but the metadata is broken.
Tag editors such as Mp3tag reveal files with broken or duplicate tags. Open the library in Mp3tag and look for files with unusual tag counts or blank fields. These metadata issues may not affect playback but cause problems in players and library software.
What to Do with the Results
Repair only the files that report errors. Do not waste time fixing files that passed the checks. For files flagged by mp3val or FFmpeg, choose one of these options:
- Re-download the file from the original source.
- Re-rip the file from the original CD or media.
- Use a dedicated MP3 repair tool to fix the corruption.
For files with only tag issues, use Mp3tag to clean up or remove broken tags. For files with a wrong displayed duration but no playback issues, leave them as is or rebuild the VBR header using a tool that supports that.
Automating the Scan
To verify the MP3 library regularly, script the scanning process. Create a batch file or shell script that runs mp3val or FFmpeg on the music folder and logs the results. Schedule the script to run weekly or monthly. New corruptions surface early, and the collection stays healthy.
A simple script could run:
mp3val -f -r /path/to/music > damaged_files.txt
Email the list to yourself or save it for later review.
Choosing the Right Tool
mp3val and FFmpeg are both free and effective. mp3val is faster for a quick scan of frame and header errors. FFmpeg is more thorough because it decodes the audio stream. For best results, use both. Start with mp3val to find structural problems, then run FFmpeg on any files that passed mp3val but still seem problematic. This two-step approach gives a complete picture of the library's health.
For a graphical interface, upload files to a service like mp3.repair to check and fix them online.