[Libav-user] rewind file

Slash slashpm at gmail.com
Wed Jun 18 14:54:20 CEST 2014


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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20140618/7e27a962/attachment.html>


More information about the Libav-user mailing list