<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">Le 9 déc. 2014 à 08:12, YIRAN LI <<a href="mailto:mrfun.china@gmail.com" class="">mrfun.china@gmail.com</a>> a écrit :</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="gmail_default" style="font-family:georgia,serif">Hi, </div><div class="gmail_default" style="font-family:georgia,serif"><br class=""></div><div class="gmail_default" style="font-family:georgia,serif">I have a question about read frame,</div><div class="gmail_default" style="font-family:georgia,serif"><br class=""></div><div class="gmail_default" style="font-family:georgia,serif">Suppose I've just opened a file, so the readpointer is at the beginning of the file.</div><div class="gmail_default" style="font-family:georgia,serif"><br class=""></div><div class="gmail_default" style="font-family:georgia,serif">Compare these two methods:</div><div class="gmail_default" style="font-family:georgia,serif"><br class=""></div><div class="gmail_default" style="font-family:georgia,serif">1. call av_read_frame + avcode_decode_video2 to decode 100 video packets( suppose each packet can decode into a frame)</div><div class="gmail_default" style="font-family:georgia,serif">2. call av_read_frame, but only decode the 100th packet (all previous 99 packets are just discarded)</div><div class="gmail_default" style="font-family:georgia,serif"><br class=""></div><div class="gmail_default" style="font-family:georgia,serif">Will the 100th frame from method 1 and the frame from method 2 have same content, timestamp, etc?</div><div class="gmail_default" style="font-family:georgia,serif"><br class=""></div><div class="gmail_default" style="font-family:georgia,serif">Thanks</div></div></div></blockquote><br class=""></div><div>Hi,</div><div><br class=""></div><div>Decoding the 100th packet alone can be equivalent in both situations only if this packet is a keyframe. If not, FFmpeg will need all the packets up to the first preceding key frame in order to be able to give you a frame with correct content. I'm unsure whether other metadata like timestamp depend on the method (although I don't think so).</div><div><br class=""></div><div>Lucas</div></body></html>