[Libav-user] Using libavformat/libavcodec with sample accurate seeking
shekh.anton at gmail.com
Sun Aug 28 13:58:19 EEST 2016
2016-08-28 8:16 GMT+03:00 Christopher Snowhill <kode54 at gmail.com>:
> I've noticed that when using these libraries in my own projects, at
> least in VGMStream, and with the WMA Pro codec, it is necessary to
> perform my own pre-roll when seeking for looping, or else the codec
> ramps the audio in from silence on every loop as it catches back up to a
> valid state. I currently use either two seconds, or the beginning of the
> file if it's less than two seconds prior to the intended seek point,
> then discard sample data that is returned by the decoder.
> Is this always necessary by design? Or am I misusing the seeking API?
> I currently use:
> int64_t ts = target_sample * formatCtx->duration / total_samples;
> avformat_seek_file(formatCtx, -1, ts - 1000, ts, ts, AVSEEK_FLAG_ANY);
> Libav-user mailing list
> Libav-user at ffmpeg.org
I noticed similar behavior with AAC decoder, work around by dropping 1024
decoded samples. (1024 is arbitrary number that worked for me)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Libav-user