Fix incorrect mp3 duration with mp3val

I’ve found a few files for which:

  • Video LAN for Windows was playing them without any problems (after a 1 second glitch),
  • Winamp for Windows was playing them also without problems, but showing 00:00 as each file’s duration
  • mobile player for Android failed to play them showing Cannot play content error.

A quick look-around the Internet showed that a tiny mp3val program can validate any .mp3 file and fix most errors, it finds.

I have downloaded “full version” (130 kilobytes!) meaning — with Windows GUI. Which turned out to be totally not needed as the command line approach did all the job just great.

Step-by-step instruction:

  1. Unpack mp3val-0.1.8_with_frontend-0.1.1-bin-win32.zip to any folder
  2. Copy your not working .mp3 file to the same folder
  3. Right-click Start button and pick Command Prompt (admin) item
  4. Call cd \, cd .. and cd [folder name] to navigate to your folder
  5. Execute mp3val with correct set of switches.

For example:

mp3val on.mp3 -lout.log -f -t -nb

Where:

  • on.mp3 is your file to by analysed and fixed
  • -lout.log denotes that you want to see log of operation in out.log file (notice no space before file name!)
  • -f tells mp3val to automatically fix any error it finds and can fix
  • -t instructs it to give the resulting (fixed) file the same date and time as the original (broken) one
  • -nb stands for “no backup” and does what it says.

Since we copied corrupted file from its original location (and renamed it to on.mp3 for easier command-line invocation) we can simply ignore all the backup files.

And… that was all. Two seconds ago my one hour long .mp3 file was fixed. Looking into out.log told me that:

WARNING: "C:\m3v\on.mp3" (offset 0x30801): MPEG stream error, resynchronized successfully
INFO: "C:\m3v\on.mp3": 146295 MPEG frames (MPEG 1 Layer III), +ID3v1+ID3v2, Xing header
FIXED: "C:\m3v\on.mp3": File was rebuilt

As a result, I had a slightly smaller file had correct file length in Winamp and was played by my mobile Android player without any problems.

Leave a Reply