[FFmpeg-user] How to seek to begin when need to decode second time for a file?
肖波
13760746839 at 163.com
Wed Dec 21 07:50:05 CET 2011
I have an application to capture random frame of video files.My step is as follows:
1.av_open_input_file()... to open the video file.
2.av_read_frame(),avcodec_decode_video2()...to decode and get frames.
3.av_close_input_file()...
At step 2, if first time I captrue frame 100, and next 80.I need decode again from beginning of the file and decode to frame 80.So before read_frame(),I called av_seek_frame(pFormatCtx, -1, 0, AVSEEK_FLAG_BACKWARD | AVSEEK_FLAG_ANY | AVSEEK_FLAG_BYTE).for most files,it can seek to beginning of the file.But for some files,like wmv,when use av_read_frame(pFormatCtx, &packet) to get the first frame, the dts and pts resulted to a quite large value.
Is there any way to reset pts and dts values?or reset the decoding kernel to beginning of the file(like fseek(file, 0, SEEK_SET))?
More information about the ffmpeg-user
mailing list