I am attempting to create a variable rate mp3 from a flac using the following command:

avconv -i t.flac -id3v2_version 3 -vn -acodec libmp3lame -aq 0 t.mp3

avconv and mediainfo both list the duration of the final mp3 correctly as 2m40s, but every mp3 player (clementine, juk and amarok) I've tried says that the song is 21m15s long. Using clementine and amarok to view details about the file turns up that they think the bitrate is 32kbps while avconv and mediainfo (correctly) list the overall bitrate as 255kbps. (255/32)*2.66 = 21.20, so I'm sure that it's the perceived bitrate that's the problem, but I don't know what to do to fix it.

Just for fun, I also tried creating a constant bitrate file with the following command:

avconv -i t.flac -id3v2_version 3 -vn -acodec libmp3lame -ab 320k u.mp3

This has the same problem. Oddly enough, even though the bitrate is specified, mediainfo still reports that the bitrate is variable and mp3 players have the same general problems with the duration.

How can I fix this?

3 Answers 3


For the constant bitrate, a fix is described in how using libmp3lame get CBR : Pipe the avconv output to a file:

avconv -i test_orig.mp3 -b:a 128k -f mp3 - >test_ffmpeg_cbr.mp3

This make avconv use the good mp3 headers for CBR.

An alternative: operating on the resulting mp3 (very useful for when the source material not unavailable anymore):

avconv -i faulty_mp3 -vn -c:a copy -ss 0:0:0 repaired_mp3
  • 1
    This appears to be a fix for the problem where mp3 files encoded by avconv don't seek.
    – automaciej
    Commented Apr 16, 2014 at 8:49

The same thing happens when you use lame directly, regardless which variable bitrate mechanism you choose (lame offers --abr, --vbr-old and --vbr-new).

So this seems to be a limitation, either of the MP3 format, or of the lame encoder. Player such as mplayer seem to simply guess the total length by the average bitrates they encountered so far.

With the file I tried it starts out displaying 30 minutes, after 10 seconds it's down to 8:15 which is close to the 8:08 it really has...

Since it still plays correctly I don't think there is anything for you to fix. If you have a hardware player that can't handle it, you'd have to go for constant bitrate, or use something else entirely if your player supports other formats that in turn support variable bitrates (OGG/Vorbis?).

  • That's disheartening. Commented Oct 25, 2013 at 0:34
  • A workaround would be to craft the first packet of the stream (or whatever your hardware player uses to determine the initial length) to have exactly the bitrate it needs to show the correct length. But I don't know of any program that does that. Commented Oct 25, 2013 at 13:33

I can confirm that avconv has this problem but not lame! in my Linux Mint 14 Nadia

for avconv pathway a quick fix is to use vbrfix over final mp3 file like this: vbrfix -always -makevbr -lameinfo imput.mp3 output.mp3

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .