<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">2016-05-13 16:58 GMT+03:00 Gonzalo Garramuño <span dir="ltr"><<a href="mailto:ggarra13@gmail.com" target="_blank">ggarra13@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="">On 11/05/2016 11:46 a.m., Anton Shekhovtsov wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Hello,<br>
<br>
I used the following code: av_seek_frame(ctx, id, pos, AVSEEK_FLAG_BACKWARD);<br>
</blockquote></span>
In principle that should work for all files.  How are you calculating pos and selecting id?<br>
_______________________________________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org" target="_blank">Libav-user@ffmpeg.org</a><br>
<a href="http://ffmpeg.org/mailman/listinfo/libav-user" rel="noreferrer" target="_blank">http://ffmpeg.org/mailman/listinfo/libav-user</a><br>
</blockquote></div><br></div><div class="gmail_extra">Thanks for reply. <br>I decided I can loop through index_entries and if there is no 'keyframes' apply AVSEEK_FLAG_ANY.<br></div><div class="gmail_extra">When it comes to seeking I do not select id, I just have it. The code deals with single stream (audio), other streams are AVDISCARD_ALL.<br></div><div class="gmail_extra">For pos something like this, but why do you ask?<br>int64_t pos = (destination_sample-discard_samples) * time_base.den / time_base.num;<br></div><div class="gmail_extra">where discard_samples is magic 1024 (experimentally derived corrupt samples)<br></div><div class="gmail_extra">and time_base is product of stream time_base and sample_rate<br></div></div>