[Libav-user] Samples of silence after a av_seek_frame

Steve Myers musicspeedchanger at gmail.com
Sun Sep 11 19:44:25 EEST 2016


I'm using ffmpeg audio decoding to create a gapless audio loop. I call
av_seek_frame (with AVSEEK_FLAG_BACKWARD) to seek to my desired time, and
call avcode_flush_buffers after. It seems the first decoded frame in the
audio stream after the seek contains a few samples of silence or near
silence, thus making the loop not gapless.

If I skip an arbitrary amount of samples, the gap disappears. I've tried
bypassing any swr_convert resampling with same results and also using the
deprecated avcodec_decode_audio4 instead of the
avcodec_send_packet/av_read_frame scheme.

Is there a way to know how many samples I need to skip so I exactly hit the
actual audio data, or prevent ffmpeg from having these filler samples in
AVFrame->data after the seek?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20160911/272bee58/attachment.html>


More information about the Libav-user mailing list