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

Jim DeLaHunt list+ffmpeg-user at jdlh.com
Sat Feb 27 08:37:25 EET 2021


On 2021-02-26 22:08, Mark Filipak (ffmpeg) wrote:
> On 2021-02-27 00:55, Jim DeLaHunt wrote:
>> On 2021-02-26 18:36, Mark Filipak (ffmpeg) wrote:
>>> 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.


Well, you are spinning up multiple issues, Mark.

Issue 1. Your contention that "ffmpeg calculates frame times in integer 
milliseconds". This branch of the thread is about that claim of yours.
Answer: No, FFmpeg calculates frame times exactly. You authored the 
input file to millisecond time resolution because that's what the format 
you chose encourages.

Issue 2. Given an input file `input1.mkv`, which has varying frame times 
in millisecond resolution which add up to 1001 ms per 30 frames, when 
you apply the FFmpeg `settb` filter, why are the output Presentation 
Timestamp (PTS) values 11880, 24120, 36000, … instead of 12012, 24024, 
36036, …?
Answer: Because the input frame presentation times are 11,880/360,000 = 
0.03300, 24,120/360,000 = 0.06700, 36,000/360,000 = 0.10000, … which 
exactly matches the frame times of the input video, with a 360kHz time base.

Issue 3. What integer size does FFmpeg use to store PTS values? You 
initiated this thread with that question, remember?

On 2021-02-26 12:35, Mark Filipak (ffmpeg) wrote:
> …With a 90kHz time base:
> 16777215 = largest 24-bit integer.
> 00:03:06.4135 = longest running time for 24-bit integer with 90kHz 
> time base.
> Conclusion: FFmpeg cannot be using 24-bit integers.… 

Hint: I gave you that answer a few days ago. FFmpeg stores PTS values in 
64-bit integers.

So, I suggest you stick to one issue at a time. The answers are in the 
various branches in this thread. People are giving you good information. 
It's up to you to take it in.

It looks like you are proving in this thread that FFmpeg already works 
as you claim you want it to work, and that your reference test file is 
leading you astray.

Best regards,

       —Jim DeLaHunt




More information about the ffmpeg-user mailing list