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

Michael Niedermayer michaelni
Mon Jun 8 01:28:51 CEST 2009

On Sun, Jun 07, 2009 at 12:13:38PM +0200, Luca Abeni wrote:
> ... 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).

i would expect that too ...

> 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
> t1.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"...).

maybe a missing call to avcodec_get_frame_defaults() / avcidec_alloc_frame()
its simply a matter o looking at te get_buffer call and where the frame
is then finally output, somewhere there or between pts is likely lost

Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The misfortune of the wise is better than the prosperity of the fool.
-- Epicurus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090608/8a8fd5d6/attachment.pgp>

More information about the ffmpeg-devel mailing list