[Ffmpeg-devel] losing frame after a seek (not aproblem because thisframe isn't a key frame)

Munier Nicolas Nicolas.Munier
Mon Apr 24 15:04:18 CEST 2006


As I corrected my problem I post my solution if it can be helpful.

In the Martin B?hme tutorial he advises to put a flag for truncated bitstream. It seems necessary for file as Mpeg (errors otherwise) but with mpeg4 like encoded avi it didn't work.
My solution was to set this flag except for avi file. It works this way.

But I don't know why it causes lose of frames to indicate that we can handle truncated bitstreams in a case where there the bitstream isn't truncated...

Regards,

Nicolas

// Inform the codec that we can handle truncated bitstreams -- i.e.,
// bitstreams where frame boundaries can fall in the middle of packets
if(pCodec->capabilities & CODEC_CAP_TRUNCATED)
    pCodecCtx->flags|=CODEC_FLAG_TRUNCATED;

-----Message d'origine-----
De?: ffmpeg-devel-bounces at mplayerhq.hu [mailto:ffmpeg-devel-bounces at mplayerhq.hu] De la part de Munier Nicolas
Envoy??: vendredi 21 avril 2006 09:58
??: ffmpeg-devel at mplayerhq.hu
Objet?: [Ffmpeg-devel] losing frame after a seek (not aproblem because thisframe isn't a key frame)

Hi everybody,

 

I first pose this question in ffmpeg-user list and they tell me it will be best suited here.

 

I am a newbie using ffmpeg libraries. I am trying to build an application which will retrieve each frame of a video independently of its encoding.

I use a method similar to what Martin B?hme (thanks to him for his tutorial) describes in its example.

 

My first problem was that in order to identify the video stream and the codec, it uses some video stream packet and then the first frame retrieved is not the first frame of the video (at least not for mpeg4 like encoding). As the first frame is a key frame and was not decoded I was carrying errors in my frames until the next intra-only key frame.

 

To solve this problem I perform a seek to come back at the beginning of the video stream using av_seek_frame.

It seems to work for most of my video except those who are divX or Xvid. For those I retrieve the first frame without problem but I lose randomly some of the next frames. (At least ten in the next 50 frames). It comes back in order after a certain number of frames but I carry some errors (due to false predictions) for a long stretch due to the loss of a key frame (that's what first warns me).

 

Does anyone know what can cause this (bug?) and what can I do to solve this problem.

 

Thanks in advance,

 

Nicolas

 

PS: I'd be happy to give some more precisions if you need.

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel at mplayerhq.hu
http://mplayerhq.hu/mailman/listinfo/ffmpeg-devel





More information about the ffmpeg-devel mailing list