[FFmpeg-trac] #5184(undetermined:new): Incorrect pts at start of avi file

FFmpeg trac at avcodec.org
Sun Jan 24 22:00:52 CET 2016

#5184: Incorrect pts at start of avi file
             Reporter:  Misaki       |                     Type:  defect
               Status:  new          |                 Priority:  normal
            Component:               |                  Version:
  undetermined                       |  unspecified
             Keywords:               |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
 The included file is .avi, and therefore has to presentation timestamps,
 only decoding timestamps. Maybe the video codec is part of the reason.
 ffprobe shows a pts only for the first frame, no others have one.




 (the rest continue)




 (the rest continue)

 The bug might be that the decoder is giving the first frame a dts of 1
 instead of 0, while still keeping the pts at 0, and so later frames are
 also one timestamp late. Since they don't have a pts, they are assigned
 the same value as the dts.

 ffmpeg -i (video) -vf showinfo -t 0.2 -an -f null -hide_banner - :

 [Parsed_showinfo_0 @ 0x2601240] n:   0 pts:      0 pts_time:0       pos:
 165604 fmt:yuv420p sar:1/1 s:1800x1004 i:P iskey:1 type:I
 checksum:4B4CD06C plane_checksum:[911ACB2B CFADC078 44C544BA] mean:[96 123
 141] stdev:[17.9 5.3 7.3]
 [Parsed_showinfo_0 @ 0x2601240]   side data - pan/scan
 [null @ 0x2608420] Encoder did not produce proper pts, making some up.
 [Parsed_showinfo_0 @ 0x2601240] n:   1 pts:      2 pts_time:0.0666667 pos:
 314468 fmt:yuv420p sar:1/1 s:1800x1004 i:P iskey:0 type:P
 checksum:572F13E7 plane_checksum:[AB01FD9B E4B0AFBF 64BC666F] mean:[96 123
 141] stdev:[17.8 5.3 7.3]
 [Parsed_showinfo_0 @ 0x2601240]   side data - pan/scan
 [Parsed_showinfo_0 @ 0x2601240] n:   2 pts:      3 pts_time:0.1     pos:
 351150 fmt:yuv420p sar:1/1 s:1800x1004 i:P iskey:0 type:P
 checksum:2EB120B0 plane_checksum:[39B5068A 516DB19C F3B3687B] mean:[96 123
 141] stdev:[17.8 5.3 7.3]
 [Parsed_showinfo_0 @ 0x2601240]   side data - pan/scan
 [Parsed_showinfo_0 @ 0x2601240] n:   3 pts:      4 pts_time:0.133333 pos:
 356674 fmt:yuv420p sar:1/1 s:1800x1004 i:P iskey:0 type:P
 checksum:13EDC4DB plane_checksum:[A5F2511C 3A8F893F 8C8BEA71] mean:[96 123
 141] stdev:[17.4 5.2 7.2]

 It's a little bit confusing because showinfo says they have a pts, but
 null output says they don't. I'm guessing showinfo is wrong. (In another,
 unsubmitted bug, the value of 'pos' shown by showinfo differs from that
 used by the select filter in some cases..~)

 I don't know if this bug affects all avi files, but it affects all files
 in a sample of 9 similar avi files from the same source.

 As it seems that -show_frames is correct, the simple solution is to use a
 setpts=N filter, but this isn't an obvious bug. A group of 6 avi files, a
 subset of the 9, all had a duplicate frame at the start (the example file
 doesn't). lavf/lavc isn't mentioned in the file metadata, but it suggests
 another program could be producing duplicate frames in a similar way.

 Some lines from the avi demuxer using -v trace:

 [avi @ 0x1d0ae60] overriding invalid dshow_block_align of 1
 [avi @ 0x1d0ae60] movi_end=0x11d99bc
 [avi @ 0x1d0ae60] Before avformat_find_stream_info() pos: 165012 bytes
 read:65536 seeks:3
 [avi @ 0x1d0ae60] dts:0 offset:0 1000/24000000 smpl_siz:1 base:1000000
 st:1 size:576
 [avi @ 0x1d0ae60] dts:0 offset:0 10000/300000 smpl_siz:0 base:1000000 st:0
 [avi @ 0x1d0ae60] All info found
 [avi @ 0x1d0ae60] 0: start_time: 0.000 duration: 0.000
 [avi @ 0x1d0ae60] 1: start_time: 0.000 duration: -9223372036854.775
 [avi @ 0x1d0ae60] stream: start_time: 0.000 duration: 2.567 bitrate=6383
     encoder         : BandiAviMuxer 1.0
   Duration: 00:00:02.57, start: 0.000000, bitrate: 6383 kb/s
     Stream #0:0, 1, 1/30: Video: mpeg1video, 1 reference frame (MPEG /
 0x4745504D), yu[...]
 [avi @ 0x1d0ae60] dts:1 offset:1 10000/300000 smpl_siz:0 base:1000000 st:0
 [null @ 0x1d11400] Encoder did not produce proper pts, making some up.
 [avi @ 0x1d0ae60] dts:2 offset:2 10000/300000 smpl_siz:0 base:1000000 st:0
 [avi @ 0x1d0ae60] dts:3 offset:3 10000/300000 smpl_siz:0 base:1000000 st:0
 [avi @ 0x1d0ae60] dts:4 offset:4 10000/300000 smpl_siz:0 base:1000000 st:0
 [avi @ 0x1d0ae60] dts:5 offset:5 10000/300000 smpl_siz:0 base:1000000 st:0
 [avi @ 0x1d0ae60] dts:6 offset:6 10000/300000 smpl_siz:0 base:1000000 st:0

Ticket URL: <https://trac.ffmpeg.org/ticket/5184>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker

More information about the FFmpeg-trac mailing list