[FFmpeg-user] Matroska (.mkv) time resolution [was: Re: How can I force a 360kHz time base? ]

Mark Filipak (ffmpeg) markfilipak at bog.us
Sat Feb 27 08:08:19 EET 2021


On 2021-02-27 00:55, Jim DeLaHunt wrote:
> On 2021-02-26 18:36, Mark Filipak (ffmpeg) wrote:
>> On 2021-02-26 20:42, Jim DeLaHunt wrote:
>>> On 2021-02-26 17:24, Mark Filipak (ffmpeg) wrote:
>>>
>>>> 'ffmpeg -i input.mkv -vf "showinfo" -codec:a copy -codec:s copy -dn output.mkv'
>>>>
>>>> [Parsed_showinfo_0 @ 0000013c877124c0] n:   1 pts:     33 pts_time:0.033   pos:    10052 
>>>> fmt:yuv420p sar:32/27 s:240x236 i:P iskey:0 type:B checksum:3CF10BFE plane_checksum:[64208370 
>>>> 00B13226 C5775659] mean:[25 126 131 ] stdev:[12.8 6.1 1.6 ]
>>>> [Parsed_showinfo_0 @ 0000013c877124c0] n:   2 pts:     67 pts_time:0.067   pos:     9213 
>>>> fmt:yuv420p sar:32/27 s:240x236 i:P iskey:0 type:B checksum:23A8A65F plane_checksum:[90DC2AA6 
>>>> 37E908C8 779972F1] mean:[27 125 132 ] stdev:[14.8 7.1 1.9 ]
>>>> [Parsed_showinfo_0 @ 0000013c877124c0] n:   3 pts:    100 pts_time:0.1     pos:    11086 
>>>> fmt:yuv420p sar:32/27 s:240x236 i:P iskey:0 type:B checksum:1CDF7A80 plane_checksum:[089DE80E 
>>>> C537F4C0 8C4E9D94] mean:[29 125 132 ] stdev:[15.2 6.6 2.3 ]
>>>> …[elided for brevity]…
>>>> [Parsed_showinfo_0 @ 0000013c877124c0] n:  28 pts:    934 pts_time:0.934   pos:    45167 
>>>> fmt:yuv420p sar:32/27 s:240x236 i:P iskey:0 type:B checksum:8D724A43 plane_checksum:[CD1CE198 
>>>> DC377EA5 3D51E9E8] mean:[70 113 148 ] stdev:[46.3 11.6 11.5 ]
>>>> [Parsed_showinfo_0 @ 0000013c877124c0] n:  29 pts:    968 pts_time:0.968   pos:    40163 
>>>> fmt:yuv420p sar:32/27 s:240x236 i:P iskey:0 type:P checksum:8F6C0D42 plane_checksum:[385DA9F1 
>>>> 7EA37D5A AD78E5D9] mean:[70 113 148 ] stdev:[46.6 11.6 11.5 ]
>>>> [Parsed_showinfo_0 @ 0000013c877124c0] n:  30 pts:   1001 pts_time:1.001   pos:    50467 
>>>> fmt:yuv420p sar:32/27 s:240x236 i:P iskey:0 type:B checksum:B511B7BA plane_checksum:[9C9A49A0 
>>>> B1D583BA FA0EEA51] mean:[70 113 148 ] stdev:[46.5 11.4 11.6 ]
>>>
>>>
>>> This output shows a stream which has a varying frame rate. The change in pts_time is not constant 
>>> from frame to frame.
>>
>> That's exactly the point. It is not constant because ffmpeg calculates frame times in integer 
>> milliseconds, and thereby truncates or rounds.…
> 
> 
> Mark, what makes you so sure that it is FFmpeg which is truncating or rounding?

The issue, Jim, is not with the MKV above. The issue is with the next video in the work flow: An MKV 
that was made from the MKV above but with '-vf settb=expr=1/360000,showinfo'. That 'showinfo' should 
have shown a 360000Hz time base. It does, but the PTSs are wrong.

I can understand your confusion. It's a complex case. Would you like me to rerun all the steps while 
posting the step-wise results here? I don't mind.


More information about the ffmpeg-user mailing list