I’d say av_seek_frame (or avformat_seek_file) is what you’re after.

av_seek_frame(pFormatContext, -1, 0, AVSEEK_FLAG_BACKWARD);

Best,

Flo

On 18 Jun 2014, at 14:54, Slash <[email protected]> wrote:

> Hello,
> 
> 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.
> 
> I followed the tutorial here (tutorial01.c): 
> https://github.com/chelyaev/ffmpeg-tutorial
> 
> so the decoding code in question looks like this:
> 
>       while (av_read_frame(pFormatCtx, &packet) >= 0) {
>               // Is this a packet from the video stream?
>               if (packet.stream_index == videoStream) {
>                       // Decode video frame
>                       avcodec_decode_video2(pCodecCtx, pFrame, 
> &frameFinished, &packet);
>                       }
>               }
>               // Free the packet that was allocated by av_read_frame
>               av_free_packet(&packet);
>       }
> 
> 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?
> 
> 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.
> 
> Thanks for help.
> _______________________________________________
> Libav-user mailing list
> [email protected]
> http://ffmpeg.org/mailman/listinfo/libav-user

_______________________________________________
Libav-user mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/libav-user

Reply via email to