<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
refer to this if u wanna understand what really keyframe is <br>
<a class="moz-txt-link-freetext" href="http://en.wikipedia.org/wiki/Video_compression_picture_types">http://en.wikipedia.org/wiki/Video_compression_picture_types</a><br>
<br>
<br>
<br>
also do remember it was also quiet confusing for me av_seek_frame
seek stream by DTS (Decode Time Stamp) and not by PTS (Presentation
Time Stamp) so when you seek you are'nt going get to the accurate
position of the stream <br>
<br>
<div class="moz-cite-prefix">On 12/09/2013 09:29 AM, YIRAN LI wrote:<br>
</div>
<blockquote
cite="mid:CAN16yyORgt0vep1Jf=JcyZZvazdCktmZ-k5yuM+DtfZ1_7z1xA@mail.gmail.com"
type="cite">
<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
moz-do-not-send="true" 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 moz-do-not-send="true"
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">
<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> </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> </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 moz-do-not-send="true"
href="mailto:Libav-user@ffmpeg.org" target="_blank">Libav-user@ffmpeg.org</a><br>
<a moz-do-not-send="true"
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>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Libav-user mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Libav-user@ffmpeg.org">Libav-user@ffmpeg.org</a>
<a class="moz-txt-link-freetext" href="http://ffmpeg.org/mailman/listinfo/libav-user">http://ffmpeg.org/mailman/listinfo/libav-user</a>
</pre>
</blockquote>
<br>
</body>
</html>