View Single Post
Old 7th June 2010, 15:25   #10096  |  Link
SomeJoe
Registered User
 
Join Date: Jan 2003
Posts: 315
Quote:
Originally Posted by Laurent View Post
Thank you for the explanation.
Can you tell me what coefficient should I apply to each timestamp to get the correct value ?

If pulldown removal is not concerned, I don't really understand what you call drop frames ?

Pulldown flags are indicators within a 23.976 fps video stream that tell the playback device to repeat certain fields in a 3:2 pattern. This causes the playback to be 29.97 fps. Telling eac3to.exe -keepPulldown will cause the video stream to be extracted with the pulldown flags intact. Normally, eac3to removes them. But this doesn't have anything to do with your problem.

Drop-frame (DF) and Non-drop-frame (NDF) timecodes are labels that are attached to each frame of a 29.97 fps video stream. I emphasize that -- they are labels that uniquely identify each frame. Despite the name, no frames are dropped from the video stream, either in the storage media or during playback.

A DF label is of the form hh;mm;ss;ff (Note semicolons).

A NDF label is of the form hh:mm:ss:ff (Note colons).

There is a one-to-one-to-one correspondence between a DF timecode label, an NDF timecode label, and a frame number.

To convert from an NDF timecode label to a DF timecode label (or vice versa), you convert the NDF timecode label to a frame number, and then convert the frame number to a DF timecode label.

The difference between an NDF label and a DF label is as follows:

NDF labels use a very simple counting mechanism. They count 0-29 on frames, 0-59 on seconds, 0-59 on minutes, and 0-any number for hours. There is no compensation for the fact that this counting mechanism assumes that there are exactly 30 frames per second, but there are not. NTSC frame rates do not play back at 30.000, they play back at 29.97. Thus, NDF timecode labels will slowly depart from real wall-clock time.

DF timecode labels use a modified counting mechanism that compensates for the fact that the playback rate is not 30.000, but is instead 29.97. In DF timecodes, frames count 0-29, seconds count 0-59, minutes count 0-59, and hours count 0-any number just like NDF, BUT:

- Frame numbers ;00 and ;01 are skipped on every 1-minute boundary, except for 10-minute boundaries.

Thus, the following:

Code:
DF Timecode    NDF Timecode   Frame #
00;00;59;28    00:00:59:28    1798
00;00;59;29    00:00:59:29    1799
00;01;00;02    00:01:00:00    1800
00;01;00;03    00:01:00:01    1801
00;01;00;04    00:01:00:02    1802
At the 1 hour (wall-clock time) point in the video, the DF timecode will be 1;00;00;00, whereas the NDF timecode will be 00:59:56:13.

The chapter points on the disc are NDF. But the OGG chapter format specifies chapter points in terms of wall-clock time, not timecode. To convert the NDF timecodes on the disc to wall-clock time:

Frame number = (((hh * 60) + mm) * 60 + ss) * 30 + ff

Wall-clock time (seconds) = Frame number / (30000/1001)

Example:

NDF timecode = 01:35:23:17

Since this is about an hour and half into the film, and the offset is approximately 3.5 seconds per hour, we would expect this to convert to a wall-clock time that's about 5.5 seconds later than this timecode, somewhere in the 1:35:29.xxx area.

Frame number = (((1 * 60) + 35) * 60 + 23) * 30 + 17 = 171707.

Wall-clock time = 171707 / (30000/1001) = 5729.290 seconds.

5729.290 Mod 60 = 29.29
5700 Mod 3600 / 60 = 35
3600 / 3600 = 1

Wall-clock time = 01:35:29.290


Note that DF timecodes and wall-clock time are not exactly the same. DF timecodes use frame numbers, wall-clock time uses fractional seconds.

Ideally, eac3to should produce an OGG chapter format file with this conversion already done, since the OGG chapter format file is supposed to use wall-clock time, not an NDF timecode expressed in fractional seconds.

Note that NDF and DF timecodes are only valid for 29.97 fps streams. There is no such thing as a DF or NDF timecode for a 23.976 stream, and I think there is where the problem is coming in. The timecodes on the disc for HD-DVD and BD shouldn't be NDF in the first place, as that isn't valid for a 23.976 stream.
__________________
- SomeJoe
SomeJoe is offline