Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#2074 closed defect (invalid)

decoded frame picture type does not match packet flags

Reported by: mrhines Owned by:
Priority: normal Component: avcodec
Version: git-master Keywords: mpeg2video
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:

I'm routine decoding an MPEG2 video, like this:

avcodec_decode_video2(codecCtx, frame, &got_frame, &packet)

.. and upon encountering a key frame, I perform a sanity check, like this:

if(got_frame && (packet.flags & AV_PKT_FLAG_KEY))

printf("picture type: '%c'\n", av_get_picture_type_char(frame->pict_type));

.. which prints out:

picture type 'P'

Perhaps my layman's understanding of video is wrong, but doesn't "key frame" == 'I' frame? Is this output valid?

Confirming with:

ffprobe -show_frames sample.mpg

Shows:

[FRAME]

... snip ...

key_frame=1

... snip ...

pict_type=I

... snip ...

FRAME

Am I missing something?

How to reproduce:

% run avcodec_decode_video2() for a while until you hit a keyframe packet and then perform the sanity check
ffmpeg version 1.0 (also confirmed on trunk with 'git checkout master'
built on Ubuntu Linux 12.04

Patches should be submitted to the ffmpeg-devel mailing list and not this bug tracker.

Attachments (1)

sample3.mpg (992.0 KB) - added by mrhines 7 years ago.
Small sample of the mpeg2 file I'm decoding

Download all attachments as: .zip

Change History (6)

Changed 7 years ago by mrhines

Small sample of the mpeg2 file I'm decoding

comment:1 Changed 7 years ago by mrhines

  • Version changed from 1.0.1 to git-master

comment:2 Changed 7 years ago by mrhines

  • Component changed from undetermined to avcodec

comment:3 Changed 7 years ago by reimar

You do not explain sufficiently what "upon encountering a key frame" means, but I suspect your are missing the codec delay.
The video frame you get out usually isn't based on the packet you just sent in at all. This is especially true with multithreaded decoding, but even without it's not generally possible due to how B-frames work.

comment:4 Changed 7 years ago by cehoyos

  • Keywords mpeg2video added; key frame decode mpeg2 removed
  • Resolution set to invalid
  • Status changed from new to closed

comment:5 Changed 7 years ago by mrhines

Thanks for the explanation. I wasn't aware there was a "delay" in the decoder.

Thanks.

Note: See TracTickets for help on using tickets.