Hello,
I hope this is the correct place to ask, as I'm not sure if it's a bug
in libav or a problem with how I'm using it.
I'm trying to decode excerpts of audio files starting at a particular
position, and I use av_seek_frame() for seeking (to avoid decoding the
file from the beginning and throwing away most of it). For very few MP3
files, seeking seems to land on something that looks like an MP3 frame,
but is not part of the original stream. In some cases, these frames are
single-channel, breaking my decoder when it expected planar stereo samples.
I've uploaded a small program, Makefile and MP3 file reproducing that
behavior:
https://jobim.ofai.at/downloads/libav_seek_bug.tgz
If you just want to have a look at the code, it's available at:
https://jobim.ofai.at/downloads/libav_seek_bug.cpp
Note that the problem only occurs when seeking; decoding from the
beginning to end works fine. I already encountered a file where adding
AVSEEK_FLAG_BACKWARD fixed the problem, but here it doesn't. Please let
me know if there's anything I'm doing wrong, or could do differently to
circumvent the problem!
Thanks a lot in advance and
Best regards, Jan
PS: The output I get is:
[mp3 @ 0x1f7d040] Invalid size in frame com, skipping the rest of tag.
[mp3 @ 0x1f7d040] max_analyze_duration reached
Successfully opened file 'bug.mp3'.
AVCodecContext has:
Channels: 2
Sample rate: 44100
Called av_read_frame().
AVCodecContext has:
Channels: 2
Sample rate: 44100
Called av_seek_frame().
AVCodecContext has:
Channels: 2
Sample rate: 44100
Called av_read_frame().
AVCodecContext has:
Channels: 1
Sample rate: 32000
Instead, I would still have expected "Channels: 2" and "Sample rate:
44100" after seeking.
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?
_______________________________________________
libav-api mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-api