[FFmpeg-devel] is there any problem in the function av_seek_frame()?
Cheng TaoTRS
cheng.tao
Fri Jan 11 02:42:03 CET 2008
hi,
i found a problem when decoding a video file with the format of
(*.mpg), and this is my code:
AVPacket packet;
int frameFinished = 0;
int index = 0;
int succeed = 0;
while(av_read_frame(pFormatCtx,&packet)>=0)
{
if(packet.stream_index == videoStream)
{
if(++index>300) break;
avcodec_decode_video(pCodecCtx, pFrame, &frameFinished,packet.data,
packet.size);
if(frameFinished)
{
succeed++;
}
}
}
printf("\n%d\t%d\n",index,succeed);
the result is : 301 ,299
however, when adding a av_seek_frame(),like this:
av_seek_frame(pFormatCtx,-1,AV_TIME_BASE *
10,AVSEEK_FLAG_BACKWARD);
AVPacket packet;
int frameFinished = 0;
int index = 0;
int succeed = 0;
while(av_read_frame(pFormatCtx,&packet)>=0)
{
if(packet.stream_index == videoStream)
{
if(++index>300) break;
avcodec_decode_video(pCodecCtx, pFrame, &frameFinished,packet.data,
packet.size);
if(frameFinished)
{
succeed++;
}
}
}
printf("\n%d\t%d\n",index,succeed);
the result turn to : 301 0
anybody tell me why? is there any problem in the function
av_seek_frame()?
--
More information about the ffmpeg-devel
mailing list