[Libav-user] Inaccurate position in ogg audio file
Matthieu Regnauld
mregnauld at gmail.com
Mon Oct 29 13:51:42 EET 2018
Hello,
When I extract samples from an audio file, or when I seek in an audio file,
I can see exactly where I am, thanks to the following code:
// position in microseconds:
1000000 * (packet.pts * ((float) stream->time_base.num /
stream->time_base.den))
It works great with mp3 files, but it's sometimes not accurate with ogg
files: sometimes, the position I get is approximately 10 ms in advance
(actually 448 samples in advance).
It appears that sometimes, for ogg files only, packet.pts (and packet.dts
too) is a bit in advance, and then, gets back to normal after a couple of
extractions.
Also, I don't know if it's related, but with ogg files, I also get a lot of
AVERROR(EAGAIN).
Here is my code:
https://gist.github.com/mregnauld/2538d98308ad57eb75cfcd36aab5099a
Do you know where it comes from and maybe, how to fix it?
Thanks for your help.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20181029/98ff4291/attachment.html>
More information about the Libav-user
mailing list