<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hey there,<div class=""><br class=""></div><div class="">got another question regarding seeking in QuickTime and MXF containers.</div><div class="">For my own video player, I need frame-accurate access to all video frames in the file stream.</div><div class=""><br class=""></div><div class="">So far I’m using this code:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">int64_t</span> seekPos = ((theFrameIndex/<span style="font-variant-ligatures: no-common-ligatures; color: #d62a9c" class="">self</span>.<span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">frameRate</span>) * <span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">1000000</span>);</div><p style="margin: 0px; font-family: Menlo; min-height: 14px;" class=""><span style="color: rgb(61, 29, 129);" class="">av_seek_frame</span>(<span style="color: rgb(214, 42, 156);" class="">self</span>.<span style="color: rgb(79, 129, 135);" class="">formatContext</span>, -<span style="color: rgb(39, 42, 216);" class="">1</span>, seekPos, <span style="color: rgb(120, 73, 42);" class="">AVSEEK_FLAG_BACKWARD</span>);</p><div class=""><br class=""></div></div><div class="">It works pretty well for all intra-frame only codecs I’ve tried so far.</div><div class="">However, when using inter frame codecs like H.264, it doesn’t work properly.</div><div class=""><br class=""></div><div class="">Whenever I’m one frame after a keyframe and want to move backwards by one frame, </div><div class="">seeking using the above code does not yield the previous I-frame but rather the next keyframe.</div><div class=""><br class=""></div><div class="">I could solve the issue by simply modifying the seek position to be one frame earlier than the actual desired frame index.</div><div class=""><span style="font-family: Menlo;" class=""><br class=""></span></div><div class=""><span style="font-family: Menlo; color: rgb(112, 61, 170);" class="">int64_t</span><span style="font-family: Menlo;" class=""> </span><span style="font-family: Menlo;" class="">oneFrame = (</span><span style="font-family: Menlo; color: rgb(39, 42, 216);" class="">1.0</span><span style="font-family: Menlo;" class="">/</span><span style="font-family: Menlo; color: rgb(214, 42, 156);" class="">self</span><span style="font-family: Menlo;" class="">.</span><span style="font-family: Menlo; color: rgb(79, 129, 135);" class="">frameRate</span><span style="font-family: Menlo;" class="">) *</span><span style="font-family: Menlo;" class=""> </span><span style="font-family: Menlo; color: rgb(39, 42, 216);" class="">1000000</span><span style="font-family: Menlo;" class="">;</span></div><div class=""><div style="margin: 0px; font-family: Menlo;" class="">seekPos -= oneFrame;</div></div><div style="margin: 0px; font-family: Menlo;" class=""><br class=""></div><div style="margin: 0px;" class="">However, with some MXF files this also didn’t help.</div><div style="margin: 0px;" class=""><br class=""></div><div style="margin: 0px;" class="">Thus, I’d like to ask what the correct way of seeking really is at the time being.</div><div style="margin: 0px;" class="">I’m assuming that I’m not the only one that wants to seek to defined frame indices.</div><div style="margin: 0px;" class=""><br class=""></div><div style="margin: 0px;" class="">I read in the source files that there’s a new seeking API  (avformat_seek_file).</div><div style="margin: 0px;" class="">Are there any information as to when this will be available and if this addresses the issue (in case it’s not just my problem)?</div><div style="margin: 0px;" class=""><br class=""></div><div style="margin: 0px;" class="">Thanks,</div><div style="margin: 0px;" class="">best,</div><div style="margin: 0px;" class=""><br class=""></div><div style="margin: 0px;" class="">Flo</div></body></html>