<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">I’d say av_seek_frame (or avformat_seek_file) is what you’re after.<div><br></div><div><div style="margin: 0px; font-family: Menlo;"><span style="color: #3d1d81">av_seek_frame</span>(<span style="color: #4f8187">pFormatContext</span>, -<span style="color: #272ad8">1</span>, 0, <span style="color: #78492a">AVSEEK_FLAG_BACKWARD</span>);</div><div style="margin: 0px; font-family: Menlo;"><br></div><div style="margin: 0px; font-family: Menlo;"><span style="font-family: Helvetica;">Best,</span></div><div style="margin: 0px; font-family: Menlo;"><span style="font-family: Helvetica;"><br></span></div><div style="margin: 0px; font-family: Menlo;"><span style="font-family: Helvetica;">Flo</span></div><div style="margin: 0px; font-family: Menlo;"><span style="font-family: Helvetica;"><br></span></div><div><div>On 18 Jun 2014, at 14:54, Slash <<a href="mailto:slashpm@gmail.com">slashpm@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr">Hello,<div><br></div><div>I'm developing a crypto-related application using h264 streams (only video). I'd like to decode the frames multiple times after changing some info in them (dct, mv, whatever), so the decoded result is always different a little bit but I always want to deal with same input file.</div>
<div><br></div><div>I followed the tutorial here (tutorial01.c): <a href="https://github.com/chelyaev/ffmpeg-tutorial">https://github.com/chelyaev/ffmpeg-tutorial</a></div><div><br></div><div>so the decoding code in question looks like this:</div>
<div><br></div><div><div><span class="" style="white-space:pre">        </span>while (av_read_frame(pFormatCtx, &packet) >= 0) {<br></div><div><span class="" style="white-space:pre">         </span>// Is this a packet from the video stream?</div>
<div><span class="" style="white-space:pre">            </span>if (packet.stream_index == videoStream) {</div><div><span class="" style="white-space:pre">                  </span>// Decode video frame</div><div><span class="" style="white-space:pre">                      </span>avcodec_decode_video2(pCodecCtx, pFrame, &frameFinished, &packet);</div>
<div><span class="" style="white-space:pre">                    </span>}<br></div><div><span class="" style="white-space:pre">                </span>}</div><div><span class="" style="white-space:pre">          </span>// Free the packet that was allocated by av_read_frame</div>
<div><span class="" style="white-space:pre">            </span>av_free_packet(&packet);</div><div><span class="" style="white-space:pre">       </span>}</div></div><div><br></div><div>After this while loop, all the frames are decoded. What I want is to change something and then redo the previous while loop to decode the frames again. How can I start it all over again?</div>
<div><br></div><div>I have tried using av_seek_frame(pFormatCtx, videoStream, 0, AVSEEK_FLAG_ANY) to jump back to the beginning but apparently I didn't get any new decoded data so it is not doing what I need.</div><div>
<br></div><div>Thanks for help.</div></div>
_______________________________________________<br>Libav-user mailing list<br><a href="mailto:Libav-user@ffmpeg.org">Libav-user@ffmpeg.org</a><br>http://ffmpeg.org/mailman/listinfo/libav-user<br></blockquote></div><br></div></body></html>