Log in

View Full Version : Cellframes conversion


2COOL
12th September 2005, 21:17
I have a celltimes.txt with cellframes

2700
19155
39261
41957

How do I convert these into a time format. I'm using 30FPS (NTSC) but would like to also know about 25FPS (PAL). Oh, and while I'm also at this, what's the formula to convert the time to cellframes?

jeanl
12th September 2005, 22:27
2COOL, what's a cellframe? Is it a frame? If so, wouldn't you just divide the frame number by the FPS to get your result?
jeanl

mpucoder
12th September 2005, 22:28
For NTSC that depends on the program that will interpret the time whether it is drop-frame or non-drop. Most of those without a choice use non-drop (the recommended time code for editing purposes).
For non-drop the process is straightforward.
ff = frames modulo 30
ss = (frames/30) modulo 60
mm = (frames/1800) modulo 60
hh = frames / 108000

jeanl
12th September 2005, 22:32
for PAL, replace 1800 with 1500 (25*60) and 108000 with 90000 (25*60*60).
To go the other way around, the frame number is
ff + (ss+mm*60+hh*3600)*frame_per_seconds.
jeanl

jsoto
12th September 2005, 22:46
Well, I'm a PAL man and I've never understood the "complicated" NTSC world..

Inside the VOBs there is a 90000 Hz master clock, and all of us use 3003 as the factor to get the frame rate, so we get 29,97 fps. This is easier in PAL, of course, using 3600 we get 25 fps.

The question is:
Is NTSC 29,97 fps or 30 fps?

jsoto

r0lZ
12th September 2005, 22:50
I may write a little plugin for PgcEdit to convert a celltimes.txt file from frame numbers to timecodes, or vice versa.

Question: for a DVD, the number of frames per second used for NTSC is always 30. Do you think it's useful to be able to use also the 29.97 rate?

[EDIT:] Jsoto, you posted your message while I was typing. Very good question, indeed.

mpucoder
12th September 2005, 23:59
The true framerate is 90000/3003, but ALL times in NTSC DVDs are in non-drop form.

2COOL
13th September 2005, 01:11
Amazing how the right questions attracts the right crowd. Thanks guys! I'll work with these when I get home.

r0lZ
13th September 2005, 02:12
I've made a PgcEdit plugin to convert a celltimes.txt file to time codes, and vice-versa. You may download it here (http://www.videohelp.com/~r0lZ/pgcedit/beta/celltimes_plugin.tcl). (It will be available officialy on my homepage later...)
To use it, copy the tcl file in the "plugins" subdirectory within the PgcEdit's installation folder.
Hope it helps!

2COOL
13th September 2005, 08:05
ff = frames modulo 30
ss = (frames/30) modulo 60
mm = (frames/1800) modulo 60
hh = frames / 108000I managed to get my correct timecode with using ""\" (integer division) instead of "/" (Modulus). I didn't want to work with the remainders.

If I used your formulas with 2700 frames @ 30 fps, I got 00:02:30.00.
My formulas calculated to 00:01:30.00, which is the correct timecode that PgcEdit's new plug-in gave me.

mpucoder
13th September 2005, 14:58
This is the actual C code used by MuxMan:
if (wSTDduration == 3003) { //30fps
lTemp = lTime / 30; //seconds
ff = (WORD)(lTime - (30 * lTemp));
}else{
lTemp = lTime / 25; //seconds
ff = (WORD)(lTime - (25 * lTemp));
}
hh = (WORD)(lTemp / 3600); //hours
lTemp -= (ULONG)(3600 * hh);
mm = (WORD)(lTemp / 60); //minutes
ss = lTemp - (ULONG)(60 * mm); //seconds

lTime is the number of frames