[Libav-user] How to precisely seek in an audio file
shekh.anton at gmail.com
Fri Oct 26 18:04:12 EEST 2018
> I try to understand how I can seek in an audio file, at a very precise
> For example, I want to set the current position in my file to the frame
> #1234567 (in a file encoded at 44100 Hz), which is equivalent to seek at
> 27994.717 milliseconds.
> To achieve that, I tried this:
> av_seek_frame(formatContext, audio_stream_index, 1234567,
> But for some reason, the positioning is not totally accurate in an OGG
> file (there is a delay of about 1/4 second), and not accurate at all in an
> MP3 file (I stay close to the beginning of the file...).
> Here is my code:
> Do I use the function the right way, or even the right function?
> Thanks for your help.
> Libav-user mailing list
> Libav-user at ffmpeg.org
Did you read description of av_seek_frame? The parameter is in time_base
Audio frame is codec internal property and generally meaningless, I think
you take it wrong.
If you want very precise relative to video stream frame, this is quite
complex. You need to consider relative stream offsets. Also there may be
audio decoder delay.
Hope this helps.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Libav-user