21

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?

21

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

  • This worked for me. I use cat to combine audiobook parts into one file (cat 1.mp3 2.mp3 > out.mp3) and that works great for playback but almost every player gets wacky with the timestamps and even mediainfo shows the duration from the first file rather than the combined. – blockloop Nov 2 '13 at 19:48
  • cat is less than ideal for tasks like combining mp3s. A better way: http://superuser.com/questions/314239/how-to-join-merge-many-mp3-files – phoibos Nov 2 '13 at 20:48
  • Why do you think that? MP3 files aren't much more than raw streams and they're almost the perfect candidate for cat aside from trivial side effects solved with a simple reassessment of Xing header data. Even without the mp3val the files still play in every player I've sent them through. cat is extremely efficient and MUCH faster than re-encoding with ffmpeg. Even with the added mp3val command. – blockloop Nov 3 '13 at 5:03
  • ffmpeg with concat and -acodec copy does not re-encode - it just copies the streams (so it's fast), but creates a proper file in the first place (without useless header & tag data appearing multiple times in the resulting files). – phoibos Nov 3 '13 at 9:55
7

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

ffmpeg -i file_orig.mp3 -acodec copy file_fixed.mp3
  • Perfect solution, works also if the wrong mp3 file has been created by ffmpeg itself! – Pierpaolo Cira Feb 24 '18 at 18:28
  • This actually worked for me, when the mp3val and mp3check solutions didn't. (Just to be sure, it doesn't re-encode, right?) – Noldorin Feb 28 '18 at 1:35
  • With -acodec copy, it doesn't reencode. If you want to verify, try with and without it and check how fast it goes. – Alcaro Feb 28 '18 at 10:47
1

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)

1

mp3check worked perfect for me also with wildcards.

sudo apt-get install mp3check

mp3check {filename or wildcard} --cut-junk-start --cut-junk-end --fix-headers
  • helped when Windows media player showed wrong mp3 file duration – Mantas D Nov 7 '17 at 11:53

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.