<div dir="ltr">How about creating a queue and keep the packet in it, you can get whenever you want from queue, and decode it ?. <br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jun 19, 2014 at 1:15 AM, Camera Man <span dir="ltr"><<a href="mailto:i.like.privacy.too@gmail.com" target="_blank">i.like.privacy.too@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">On 06/18/2014 03:54 PM, Slash wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I have tried using av_seek_frame(pFormatCtx, videoStream, 0,<br>
AVSEEK_FLAG_ANY) to jump back to the beginning but apparently I<br>
didn't get any new decoded data so it is not doing what I need.<br>
</blockquote>
<br></div>
You need to flush the decoder context by calling avcodec_flush_buffers(your_<u></u>codeccontext) after calling av_seek. Also, make sure that your stream starts with an SPS+PPS pair followed by an I-frame. Until you've decoded those, you can't decode any picture. If you seek to the beginning of a properly encoded file, they would be there; however, if the file is not properly encoded, you seek to the middle, or you are using a recorded RTSP stream, they might come later or not at all (in RTSP they may arrive in a side channel)<br>
<br>
(It is AVCodecContext that references B and P frames, not AVPacket as someone suggested).<div class="HOEnZb"><div class="h5"><br>
<br>
______________________________<u></u>_________________<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/<u></u>listinfo/libav-user</a><br>
</div></div></blockquote></div><br></div>