[Ffmpeg-devel] [Fwd: Is AVFrame->pts really set by libavcodec when decoding?]

Luca Abeni lucabe72
Wed Apr 18 11:14:03 CEST 2007

Hi all,

according to the documentation in avcodec.h, the pts field in AVFrame
(defined in FF_COMMON_FRAME) is set by libavcodec when decoding.

But a simple test [*] showed that such field is not touched by
libavcodec, or is set to 0 (depending on the codec), at least when
decoding mpeg1/2 and raw video.

Is this a bug in libavcodec, a bug in the documentation, or something else?


[*] To see it yourself, try adding a
     fprintf(stderr, "PTS: %Ld\n", picture.pts);
before and after avcodec_decode_video() in ffmpeg.c:output_packet().
Then, run "./output_example test.mpg; ./ffmpeg -i test.mpg out.avi"
The mpeg decoder seems to set pts to 0. The raw decoder (use test.y4m
instead of test.mpg) does not touch the pts field.

More information about the ffmpeg-devel mailing list