mpeg2 only decodes every other frame?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

mpeg2 only decodes every other frame?

Jordan Dressman
I can only decode every other frame using mpeg2. I have tried setting
the max_b_frames to 0 and -1 on the encoder but has_b_frames is set to
1 in both cases.

Here is my decode algo:

//I call this function for every incoming encoded data frame.
void video_decode(uint8_t* data)
  uint8_t *inbuf_ptr = data;

  while (size > 0)  {
     len = avcodec_decode_video(c, frame, &got_picture, inbuf_ptr, size);

     if (len < 0)     {                          exit(1);

     if (got_picture)
     {           ///Display
     size -= len;
     inbuf_ptr += len;
//mpeg, transmit the I and P frame with a latency of one frame. You
must do the
//following to have a change to get the last frame of the video
//len = avcodec_decode_video(c, frame, &got_picture, NULL, 0);
//I am ignoring the last frame.

This message was sent using IMP, the Internet Messaging Program.

libav-user mailing list
[hidden email]