<div dir="ltr">And I have another question: If an AVPacket object has AV_PKT_FLAG_KEY bit set in flags, does that mean this packet when passed into avcodec_decode_video2 can always get a complete frame (I mean by calling avcodec_decode_video2(pCodecCtx, pFrame, &frameFinished, &packet) the 3rd argument set to true)?<br>
<div><br></div><div>Thanks</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/12/9 YIRAN LI <span dir="ltr"><<a href="mailto:mrfun.china@gmail.com" target="_blank">mrfun.china@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Thanks Don,<div><br></div><div>So in order to get a correct image, I must not use <span style="font-family:Arial">AVSEEK_FLAG_ANY so that av_seek_frame by default will seek to a key frame. And I should continue to read from that point and decode until I get a frame with the timestamp I want. </span></div>
<div><span style="font-family:Arial"><br></span></div><div><span style="font-family:Arial">Do you know if all demuxers can support av_seek_frame() correctly so that as long as there's a key frame before the position I pass to the function, they all can correctly seek to that key frame?</span></div>
<div><span style="font-family:Arial"><br></span></div><div><span style="font-family:Arial">Thanks</span></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/12/4 Don Moir <span dir="ltr"><<a href="mailto:donmoir@comcast.net" target="_blank">donmoir@comcast.net</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><u></u>
<div bgcolor="#ffffff"><div><div>
<div><font face="Arial">>----- Original Message ----- <br>>From:
YIRAN LI <br>>To: This list is about using libavcodec, libavformat,
libavutil,libavdevice and libavfilter. <br>>Sent: Sunday, December 08, 2013
9:44 PM<br>>Subject: [Libav-user] a question for av_seek_frame</font></div>
<div> </div>
<div><font face="Arial">>Hi friends</font></div>
<div> </div>
<div><font face="Arial">>Here I have a question about
av_seek_frame.</font></div>
<div> </div>
<div><font face="Arial">>For example if I have a video stream of time
stamps 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10. and only frame at 0 is a key
frame.</font></div>
<div> </div>
<div><font face="Arial">>if I call av_seek_frame(x,x,5,
AVSEEK_FLAG_BACKWARD | AVSEEK_FLAG_ANY) and then av_read_frame, the first frame
I get will be frame 6, is this correct?</font></div>
<div> </div>
<div><font face="Arial">>then if I call av_seek_frame(x, x, 5,
AVSEEK_FLAG_BACKWARD) and then av_read_frame, then the first frame I get will be
frame 1, is this correct?</font></div>
<div> </div>
<div><font face="Arial">>and if both can seek to a frame and first one
can get a frame quicker, in what circumstance should I use the second
one?</font></div>
<div> </div>
<div><font face="Arial">>Thanks</font></div>
<div><font face="Arial"></font> </div>
</div></div><div><font face="Arial">Non key frames require the previous key frame in
order to be decoded correctly. So if you skip past the key frame to frame 6,
then the decoded image will most likely be incorrect.</font></div>
<div><font face="Arial"></font> </div>
<div><font face="Arial">While your first example may be quicker,
it will not be correct. Best to stay away from AVSEEK_FLAG_ANY for normal
display purposes. Proper seeking to frame 6 would require a seek to
frame 1 and then read and decode to frame 6. </font> <font face="Arial">AVSEEK_FLAG_ANY can be useful in some cases but generally not
for normal display.</font></div></div>
<br></div></div>_______________________________________________<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" target="_blank">http://ffmpeg.org/mailman/listinfo/libav-user</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div>