[FFmpeg-devel] [PATCH 5/5] avformat/mp3dec: alwas prefer xing toc for seeking if present

wm4 nfxjfg at googlemail.com
Wed Apr 15 11:53:55 CEST 2015


On Wed, 15 Apr 2015 09:36:09 +0000 (UTC)
Carl Eugen Hoyos <cehoyos at ag.or.at> wrote:

> wm4 <nfxjfg <at> googlemail.com> writes:
> 
> > > > > this breaks seeking in CBR files with a xing toc
> > > > > 
> > > > > see: https://trac.ffmpeg.org/ticket/2590 for testcase/example
> 
> > From what I can tell, this can't be used to reproduce the problem.
> 
> I tested the following:
> $ ffmpeg -ss 50 -i Underworld_sample_cut.mp3 -t 10 out.wav
> ffmpeg version 1.0 Copyright (c) 2000-2012 the FFmpeg developers
>   built on Feb 10 2013 11:28:07 with gcc 4.7 (SUSE Linux)
>   configuration: --enable-gpl
>   libavutil      51. 73.101 / 51. 73.101
>   libavcodec     54. 59.100 / 54. 59.100
>   libavformat    54. 29.104 / 54. 29.104
>   libavdevice    54.  2.101 / 54.  2.101
>   libavfilter     3. 17.100 /  3. 17.100
>   libswscale      2.  1.101 /  2.  1.101
>   libswresample   0. 15.100 /  0. 15.100
>   libpostproc    52.  0.100 / 52.  0.100
> [mp3 @ 0x2b72280] max_analyze_duration 5000000 reached at 5015510
> Input #0, mp3, from 'Underworld_sample_cut.mp3':
>   Metadata:
>     artist          : Lilith
>     album           : Underworld
>     genre           : Gothic Metal
>     date            : 2007
>   Duration: 00:42:36.63, start: 0.000000, bitrate: 4 kb/s
>     Stream #0:0: Audio: mp3, 44100 Hz, stereo, s16, 192 kb/s
> Output #0, wav, to 'out.wav':
>   Metadata:
>     artist          : Lilith
>     album           : Underworld
>     genre           : Gothic Metal
>     date            : 2007
>     encoder         : Lavf54.29.104
>     Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo,
> s16, 1411 kb/s
> Stream mapping:
>   Stream #0:0 -> #0:0 (mp3 -> pcm_s16le)
> Press [q] to stop, [?] for help
> size=    5936kB time=00:00:10.02 bitrate=4851.8kbits/s
> video:0kB audio:5936kB subtitle:0 global headers:0kB muxing overhead 0.000757%
> 
> The output file does not start at 0:50 and is too long.

Alright, I can confirm that CBR seeking has better precision. The
original file was 60MB, and the xing toc has only 100 entries, so it's
not surprising seeking is a bit imprecise.

However, if this file used VBR mode, seeking would be wrong anyway, so
this is at best a special case to make CBR seeks work better. If you
insist you can drop the 5th patch.

But the problem remains: libavformat fundamentally can not seek
correctly in mp3s. (And a lot of other audio formats.)


More information about the ffmpeg-devel mailing list