w3c / ttml2

Timed Text Markup Language 2 (TTML2)
https://w3c.github.io/ttml2/
Other
40 stars 16 forks source link

SMPTE Time Base: NTSC and PAL magic numbers for droppedFrames #1265

Closed alexandercerutti closed 12 months ago

alexandercerutti commented 12 months ago

Hello there, I was studying ttml2 standard to create a personal implementation (for a subtitle system available on my Github profile).

I was reading about ttp:dropMode and droppedFrames in relation to SMPTE standard (I.3) timings. I was able to find the explanation on the standard document and on external sites, but I wasn't able to find what are the magic numbers for NTSC and PAL used in droppedFrames calculation:

NTSC:

(hours * 54 + minutes – floor(minutes / 10)) * 2;

PAL:

(hours * 27 + floor(minutes / 2) – floor(minutes / 20 )) * 4;

Do you know where can I find the reason for which those numbers are used?

Thank you!

skynavga commented 12 months ago

Look for "108" in the following. And note that in the above formulas you have hours 54 2 = hours 108 for NTSC and hours 27 4 = hours 108 for PAL.

https://blog.frame.io/2017/07/17/timecode-and-frame-rates/

alexandercerutti commented 11 months ago

Hey @skynavga, thank you for your reply. Sorry for the late reply but I took a few days to understand a little bit more everything. I had to dig further down and look for more mathematical articles to understand the reason behind every single piece of that formula (which, the article you provided me didn't provide).

I was able to find an old technical article made from Adobe for Premieré (https://studylib.net/doc/18881551/an-explanantion-of-drop-frame-vs.-non-drop) that explains perfectly, so I understood NTSC Drop mode.

What it is not yet clear to me is how drop mode applies to PAL, as it never had a frames reduction like NTSC (30->29.97 - PAL also works at 25fps).

So, is dropPAL mode perhaps made for the case in which an higher fps is provided, e.g. 30fps? That's the only possible explanation I can see right now.

Thank you very much.

skynavga commented 11 months ago

See the following comment in TTML2 §7.2.4:

Screenshot 2023-07-31 at 11 03 41 PM
alexandercerutti commented 11 months ago

Okay, thank you @skynavga. I was looking for more deep explanations about the M/PAL drop-frame, but I could find none.

Based on what is written in TTML2, I was able to understand the formula and put almost all the pieces together (or, at least, I found a direction, but I don't know if that's correct) but there are still some details and reasons for which we are using certain numbers that I cannot catch.

That is, why was it decided to skip the drop-frame every 20 mins, instead of 10 mins just like NTSC (M/PAL uses the same fps as NTSC)?

I don't know if you are the right person to give me those answers or perhaps you know something more, but if know something more, I'd be very grateful for any explanation.

skynavga commented 11 months ago

AFAIK, the formulas in the TTML2 spec are correct. If you depart from those formulas, your implementation would technically be non-compliant w.r.t. TTML2 semantics. On the other hand, if you find evidence that one or both formulas are incorrect, then please file a new issue. If you so so, be certain to provide adequate evidence showing your position, as well as sample TTML2 files (and related media) that demonstrate the problem.

alexandercerutti commented 11 months ago

Maybe there was just a misunderstandment: I'm not saying that formulas are wrong and I don't want to depart from them: I just wanted to know the technical reasons behind those numbers to understand them completely :)