<div dir="ltr"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div>Hello,</div><div><br></div><div>I try to understand how I can seek in an audio file, at a very precise position.</div><div><br></div><div>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.</div><div><br></div><div>To achieve that, I tried this:</div><div><br></div><div>   <span class="gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,92,197);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;white-space:pre">av_seek_frame</span><span style="color:rgb(36,41,46);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;white-space:pre">(formatContext, audio_stream_index, 1234567, AVSEEK_FLAG_FRAME);</span></div><div><br></div><div>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...).</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 I use the function the right way, or even the right function?</div><div><br></div><div>Thanks for your help.</div></div><div><br></div></div></div></div></div>