<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><br><div>Début du message réexpédié :</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; font-size:medium; color:rgba(0, 0, 0, 1.0);"><b>De : </b></span><span style="font-family:'Helvetica'; font-size:medium;">Lucas Soltic <<a href="mailto:soltic.lucas@gmail.com">soltic.lucas@gmail.com</a>><br></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; font-size:medium; color:rgba(0, 0, 0, 1.0);"><b>Objet : </b></span><span style="font-family:'Helvetica'; font-size:medium;"><b>Rép : [Libav-user] Why is av_seek_frame() inaccurate in some cases ?</b><br></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; font-size:medium; color:rgba(0, 0, 0, 1.0);"><b>Date : </b></span><span style="font-family:'Helvetica'; font-size:medium;">14 avril 2012 19:24:01 HAEC<br></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;"><span style="font-family:'Helvetica'; font-size:medium; color:rgba(0, 0, 0, 1.0);"><b>À : </b></span><span style="font-family:'Helvetica'; font-size:medium;">"This list is about using libavcodec, libavformat, libavutil, libavdevice and libavfilter." <<a href="mailto:libav-user@ffmpeg.org">libav-user@ffmpeg.org</a>><br></span></div><br><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>Le 14 avr. 2012 à 18:49, Michael Bradshaw a écrit :</div><br class="Apple-interchange-newline"><blockquote type="cite"><div class="gmail_quote">On Sat, Apr 14, 2012 at 10:40 AM, Lucas Soltic <span dir="ltr"><<a href="mailto:soltic.lucas@gmail.com">soltic.lucas@gmail.com</a>></span> wrote:<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word"><div>So I don't think I did anything fancy, but I still can't find out why the video seeking is inaccurate. I would be really grateful if someone had ideas about this issue.</div>
</div></blockquote><div> </div><div>There's two reasons I can see why you would be getting this result: 1) It could be seeking to the closest keyframe in the video, and 2) some demuxers seek by DTS and not PTS.</div><div>
<br></div><div>You say it works fine for H.264 videos though, so I'm not entirely sure what could be causing it.</div></div></blockquote><br></div><div>Hello!</div><div><br></div><div>I tried to use AVSEEK_FLAG_ANY for the av_seek_frame() parameter, so that it does not only seek to keyframes, but it still gives important gaps.</div><div>As for the DTS, in the movie I read, they are equal to the PTS (for any of the ~10 seeking I did). These results concern the MPEG4v2 video.</div><div>I'm going to investigate further with other codecs but I wanted to tell these points.</div><div><br></div><div>Lucas SOLTIC</div></div></blockquote></div><div><br></div><div>Actually I noticed than when seeking (even with AVSEEK_FLAG_ANY), the real sought position is 0 to 10s before the position I wanted. Then, if the video PTS is 9.90s before the position I wanted, and I seek a little bit further (say 0.1s), the video PTS becomes the exact position I wanted. So it looks like it's just seeking to keyframes, whatever seek flag I use.</div><div><br></div><div>Considering this, are there more accurate ways to directly reach the expected position or should I just do avcodec_decode_video2() until the PTS becomes the one I wanted ? Decoding 10s of video could take some time on high resolution movies...</div><div><br></div><div>Regards,</div><div>Lucas SOLTIC</div></body></html>