[FFmpeg-user] Subtitle Timing: Clock Timestamps vs. Frame Timestamps

Mark Filipak markfilipak.trash at gmail.com
Fri Apr 4 23:48:53 EEST 2025


On 04/04/2025 15.36, jeremie bergeron wrote:
> I'm not trying to edit the subtitle, so no, it doesn't really help me.
> 
> I want to know if the player must use the Clock Timestamps or Frame
> Timestamps to know when to display the subtitle.

I never gave it a thought before. Thanks for this opportunity.

If you connect to the TV via component cables or HDMI, then the TV gets television, CEA-861 (NTSC or 
PAL), and CC (closed captioning), and that's all. Since the video _must_ be in television frames, 
I'd say that the subtitles must already be rendered and superimposed over frame images -- except for 
CC, television displays content solely in frames.

So I'd say that subtitles must have elapsed-time timestamps that fit them into their intended 
frames. Subtitle Edit's Beautify time stamps does that.

> Le ven. 4 avr. 2025 à 14:10, Mark Filipak <markfilipak.trash at gmail.com> a
> écrit :
> 
>> On 04/04/2025 10.16, jeremie bergeron wrote:
>>> Hi,
>>>
>>> This is not strictly an FFmpeg question but rather a general video
>>> processing question regarding when subtitles should be rendered.
>>>
>>> In this discussion, we are debating whether subtitles should be displayed
>>> based on *clock timestamps* or *frame timestamps (PTS)*.
>>> Let's say I have a video with those timestamps:
>>>
>>>      -
>>>
>>>      Frame 0: 0 ms
>>>      -
>>>
>>>      Frame 1: 42 ms
>>>      -
>>>
>>>      Frame 2: 83 ms
>>
>> ... continues
>>
>>>      Frame 9: 375 ms
>>
>> ... continues
>>
>>>      Frame 20: 834 ms
>>
>>> Now, let's consider a subtitle that starts at *400 ms* and ends at *860
>> ms*.
>>
>> Subtitle Edit (https://www.nikse.dk/subtitleedit) has a tool called
>> "Beautify time codes". The tool
>> snaps subtitle times to the elapsed-time equivalents of frame PTSes. So
>> your 0:0.400..0:0.860
>> subtitle would snap to 0:0.375..0:0.834.
>>
>> Hope this helps.



More information about the ffmpeg-user mailing list