Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#2074 closed defect (invalid)

decoded frame picture type does not match packet flags

Reported by: Michael R. Hines 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 Michael R. Hines 11 years ago.
Small sample of the mpeg2 file I'm decoding

Download all attachments as: .zip

Change History (6)

by Michael R. Hines, 11 years ago

Attachment: sample3.mpg added

Small sample of the mpeg2 file I'm decoding

comment:1 by Michael R. Hines, 11 years ago

Version: 1.0.1git-master

comment:2 by Michael R. Hines, 11 years ago

Component: undeterminedavcodec

comment:3 by reimar, 11 years ago

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 by Carl Eugen Hoyos, 11 years ago

Keywords: mpeg2video added; key frame decode mpeg2 removed
Resolution: invalid
Status: newclosed

comment:5 by Michael R. Hines, 11 years ago

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

Thanks.

Note: See TracTickets for help on using tickets.