- What is Telecining?
- Inversing the Telecine Process
- Variable Frame Rate Detelecine
What is Telecining?
Telecining takes content filmed cinematically at one framerate and formats it for broadcast/distribution in a television standard based around a different framerate.
For example, NTSC Film runs at a speed of 24fps. That means in every second, 24 different frames of video are displayed on screen. These frames are each progressive. What that means are that all the lines match up into a single picture.
NTSC Video runs at a speed of 30fps. That means in every second, 30 different frames of video are displayed on screen. These frames are usually interlaced. What that means is that all the lines in the picture do not match up. Half are from one moment in time, half are from the next. And these lines alternate. The result goes by a bunch of different names: combing, mouseteeth, venetian blinds. It's interlacing. Instead of 30 frames per second, video can be thought of as 60 fields per second. Each field is made up of half a frame's lines, alternating like venetian blinds. Thanks to persistence of vision, the eye sees both fields at once.
Now, what happens if you want to show film on video? You've got to make 30 frames out of every 24 --adding 6 frames to every second. That's 15 frames out of every 12, or 5 frames out of every 4. This is called telecining: transferring cinema to television.
So for every 4 frames, you've got to make an extra frame. Where is that frame going to come from?
Hard telecining literally adds extra frames. For every 4, 1 is added.
Now, if you just copied a frame, the video would obviously look jerky. It would rest on one point way too long. Instead, the extra (interpolated) frame is made of different fields.
Say the film looks like this:
Frame 1: A1A2 Framw 2: B1B2 Frame 3: C1C2 Frame 4: D1D2
Telecined for NTSC video, it will be
Frame 1: A1A2 Frame 2: A1B2 (interlaced with top from Frame 1, bottom from source Frame 2) Frame 3: B1C2 (interlaced with top from source Frame 2, bottom from source Frame 3) Frame 4: C1C2 Frame 5: D1D2
Note that this means the first frame and the final two frames are still made of matched, progressive fields. But the fields in second and third frames are mismatched. This means interlacing will be obvious. When you watch hard telecined video, you can see interlacing on 2 frames out of every 5. This pattern of 3 progressive frames and 2 interlaced frames is echoed in another name for this process: 3:2 pulldown.
If you see this pattern looking at the source, or if you see this pattern after encoding your source with HandBrake while using a frame speed of 29.97fps without deinterlacing, you have hard telecined material. It's a prime candidate for inverse telecine and variable frame rate encoding.
Now, a lot of DVDs don't use hard telecining. This is a good thing. Instead, they use soft telecining. This preserves the 24fps content for the DVD. It just uses something called "repeat flags" to tell the DVD player "show this field extra long," instead of actually storing the duplicated frame on disc. It saves space, while still technically being 30fps because of the repeat flags.
Soft telecining looks like this:
Frame 1: A1A2 (Top, Bottom, Repeat Top) Frame 2: B2B1 (Bottom, Top) Frame 3: C2C1 (Bottom, Top, Repeat Bottom) Frame 4: D1D2 (Top, Bottom)
...meaning it can be presented at 30fps exactly like the hard-telecined example above. It also makes things easy for computers and progressive scan DVD players, which can just ignore the repeat flags and frame order to decode the video at film speed, with no visible interlacing.
Inversing the Telecine Process
Hard telecined content, in contrast, has to go through a decimation or inverse telecine (IVTC) process to pullup to film speed. Inverse telecine undoes the hard telecine process. It reverts those 5 frames to the original 4, getting rid of the interlacing artifacts on 2 of every 5 frames. This pulls it up to film speed.
Look again at the telecine pattern:
Frame 1: A1A2 Frame 2: A1B2 Frame 3: B1C2 Frame 4: C1C2 Frame 5: D1D2
Frame 2 starts with the A1 field, but that was already used in Frame 1. Frame 3 ends with C2, but that's used properly in Frame 4. So if you drop A1 from Frame 2 and C2 from Frame 3, you're left with two fields:
Frame 2: B2 Frame 3: B1
Reverse the order so it's B1 and B2, slap them together, and call it Frame 2:
Frame 2: B1B2
Now you're back to the original film source:
Frame 1: A1A2 Framw 2: B1B2 Frame 3: C1C2 Frame 4: D1D2
Thankfully, you don't have to do this process by hand.
Using HandBrake's Detelecine Filter
HandBrake uses a detelecine filter called pullup (because it's the opposite of pulldown). It's a very advanced inverse telecine filter from the MPlayer project.
To enable detelecine, mark the detelecine checkbox in the Picture Settings.
Pullup is stateless. What this means is that it looks at every frame of the source video. It visually analyzes the video and looks for fields that can be woven together in ways that form progressive frames. For example, with NTSC hard telecined material, pullup sees that pattern of progressive-progressive-interlaced-interlaced-progressive and that the interlaced frames' fields can be swapped to create frames that show less combing. Each time it encounters that situation, it deinterlaces the frames that need it and makes a guess as to where the "breaks" in the pattern are. This lets it know which frames are the duplicates that should be dropped from a source.
When it does this, you're left with a pattern like this:
Frame 1: A1A2 Frame 2: B1B2 Frame 3: B1B2 (candidate for dropping) Frame 4: C1C2 Frame 5: D1D2
Now, this will play fine. However, notice that Frames 2 and 3 are exactly the same. This means you're wasting bitrate and time encoding frames that don't matter, and in the end the video still has around 30 frames per second.
If you've specified that HandBrake should use a framerate of 29.97fps, this is exactly what HandBrake will encode for the output. But it is wasteful, because of the duplicate frames.
If you've specified that HandBrake should use a framerate of 23.976fps, it will drop those duplicate frames. However, if there are so many duplicate frames that the framerate drops lower than that, HandBrake will have to leave them in place to keep the framerate steady. Similarly, if there are so few duplicates that the framerate stays above the specified 23.976, it will be forced to drop some frames at random, with no guidance from the detelecining filter.
If you just leave the framerate as "Same as source," though, HandBrake will drop those duplicate frames and only those duplicate frames, with no extra dropping or copying of frames. We call this process Variable Frame Rate detelecine.
Variable Frame Rate Detelecine
Simply leave the framerate set to "Same as source," and HandBrake will do variable framerate detelecine, dropping duplicate frames from the hard telecining process.
Variable frame rate is when one movie runs at different speeds in different parts.
This will happen when you mix progressive and interlaced content, or when film is converted to video (telecining).
For example, if an NTSC Video source is entirely hard telecined from beginning to end, you can convert it from 30fps to 24fps, recreating the original film speed and frame order.
The difficult part is, most sources aren't entirely telecined. Parts will be supposed to run at 30fps. Other parts can be safely brought down to 24fps. For example, title cards might have been done on a computer at 30fps, while live-action material was shot with a film camera at 24fps and then telecined. Other times, part might be progressive 24fps (soft telecined). Even if a source is entirely hard telecined, HandBrake's detelecining filter is stateless, and will produce variable output: if part of a scene has no movement, it won't detect any telecining since there will never be any combing, even in duplicate frames.
If you bring the entire source up to 24 frames per second, the part that is supposed to run at 30fps will be displayed too slowly. If you bring the entire source down to 30 frames per second, the part that is supposed to run at 24fps will appear jerky.
The solution is to leave everything at the speed it was meant to play at. 30fps for 30fps stuff, 24fps for 24fps stuff. Leave the soft telecined parts progressive, detelecine the hard telecined parts to be progressive. When this is done within one movie file, it's called variable frame rate. The frames per second vary between 24 and 30. A place for everything, and everything in its place.