[libav-api] av_seek_frame() on 44.1 kHz stereo MP3 seeks to 32 kHz mono frame

Luca Barbato lu_zero at gentoo.org
Wed Jul 8 23:29:15 CEST 2015

On 08/07/15 16:30, Jan Schlüter wrote:
>> PPS: "avconv -ss 48 -t 30" works fine, and it uses av_seek_frame() with
>> the stream index set to "-1". Should I do that instead? Is this expected
>> to be more robust?
> Seems I did something wrong in my first attempt of using "avconv".
> Setting the stream index to "-1" doesn't help, and avconv actually sees
> the same spurious frames when seeking (full debug output attached):


> Without seeking (when removing the "-ss" argument or moving it past the
> "-i" argument), it happily decodes the full file. For my application, I
> chose to circumvent this problem by skipping all frames that do not
> match the initially detected number of channels and sample_rate.

Probably it is the best approach.

> Shall I file a bug report or is this to be treated as a known limitation
> of the MP3 seeking algorithm?

Adding a bug report is always good even more if you already have a
testcase and the full backstory.

Figuring out how to avoid the problem is, on the other hand, annoying
since the seek step assumes something that is actually wrong for that file.

More information about the libav-api mailing list