How can I fix incorrect mp3 duration?

I have a number of songs in my Music library that display incorrect duration values, and so play only partially in Clementine. In Banshee and some other players they show different duration values and sometimes play the full song.

Is there a way to fix this without having to "re-encode" the song?


MP3 Diags can fix incorrect durations (and other errors). It is open source and in the repositories. It is a GUI Tool.

Installation

sudo apt-get install mp3diags mp3diags-doc

Another option is MP3val, which can be used either via commandline or via GUI:

Installation

sudo apt-get install mp3val

Usage example

mp3val damaged.mp3 -f -t

-f: fix errors, -t: keep original timestamp


If you don't want to install anything new, try with ffmpeg:

ffmpeg -i file_orig.mp3 -acodec copy file_fixed.mp3

Aside from the VBR headers not matching the actual audio (which you would use mp3val to correct, as mentioned in the other answer), another reason this can be caused is by an MP3 file having ID3 tag that has an incorrect value for the TLEN tag. You can fix this using the mid3v2 tool from the mutagen package to remove the tag (apparently its optional):

$ mid3v2 --delete-frames=TLEN filename.mp3

The music player Quodlibet also has a convenient "Fix MP3 Duration" plugin you can use to do this.

(Taken from the Quodlibet FAQ: http://quodlibet.readthedocs.org/en/latest/guide/faq.html)