#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 ...
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)
Change History (6)
by , 10 years ago
Attachment: | sample3.mpg added |
---|
comment:1 by , 10 years ago
Version: | 1.0.1 → git-master |
---|
comment:2 by , 10 years ago
Component: | undetermined → avcodec |
---|
comment:3 by , 10 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 , 10 years ago
Keywords: | mpeg2video added; key frame decode mpeg2 removed |
---|---|
Resolution: | → invalid |
Status: | new → closed |
comment:5 by , 10 years ago
Thanks for the explanation. I wasn't aware there was a "delay" in the decoder.
Thanks.
Small sample of the mpeg2 file I'm decoding