<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Hello,</div><div><br></div><div>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:</div><div><br></div><div>   <font face="SFMono-Regular, Consolas, Liberation Mono, Menlo, Courier, monospace" color="#38761d"><span style="font-size:12px;white-space:pre-wrap">// position in microseconds:</span></font><br class="gmail-Apple-interchange-newline"><div>   <font face="SFMono-Regular, Consolas, Liberation Mono, Menlo, Courier, monospace"><span style="font-size:12px;white-space:pre-wrap"><font color="#0000ff">1000000</font><font color="#24292e"> * (packet.pts * ((</font><font color="#b45f06">float</font><font color="#24292e">) stream->time_base.num / stream->time_base.den))</font></span></font></div><br class="gmail-Apple-interchange-newline"></div><div>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).</div><div>It appears that sometimes, for ogg files only, <font face="monospace, monospace">packet.pts</font> (and <font face="monospace, monospace">packet.dts</font> too) is a bit in advance, and then, gets back to normal after a couple of extractions.</div><div>Also, I don't know if it's related, but with ogg files, I also get a lot of <font face="monospace, monospace" color="#7f6000">AVERROR(EAGAIN)</font><font color="#000000">.</font></div><div><br></div><div>Here is my code: <a href="https://gist.github.com/mregnauld/2538d98308ad57eb75cfcd36aab5099a" target="_blank">https://gist.github.com/mregnauld/2538d98308ad57eb75cfcd36aab5099a</a></div><div><br></div><div>Do you know where it comes from and maybe, how to fix it?</div><div><br></div><div>Thanks for your help.</div><div><br></div></div></div></div></div></div></div></div></div>