[FFmpeg-devel] BUG in mpeg video decoding? ...

Luca Abeni lucabe72
Sun Jun 7 12:13:38 CEST 2009

... Or am I misunderstanding something?

After calling avcodec_decode_video2() (or avcodec_decode_video()) on
MPEG 1 or 2 video, I see that the "pts" field in AVFrame is 0.
The documentation in avcodec.h says:
     * presentation timestamp in time_base units (time when frame should be shown to user)\
     * If AV_NOPTS_VALUE then frame_rate = 1/time_base will be assumed.\
     * - encoding: MUST be set by user.\
     * - decoding: Set by libavcodec.\
    int64_t pts;\
so I would expect that avcodec_decode_video2() either leaves this value
to AV_NOPTS_VALUE (as it is before calling the decoding function) or
sets it to a meaningful value (always 0 does not look correct to me).

How to reproduce: just generate a "test.mpg" file with output_example,
add something like "fprintf(stderr, "Got PTS %Ld\n", picture.pts);"
after avcodec_decode_video2() in ffmpeg.c, and run "ffmpeg -i test.mpg

Is this a bug? Or did I misunderstand something? If it is a bug, I am
willing to investigate it... Just point me to the code I should look at
(I checked libavcodec/mpeg12.c and libavcodec/mpegvideo.c, and I did not
find any reference to "pts"...).


More information about the ffmpeg-devel mailing list