Log in

View Full Version : Manual Field Matching


525/60
2nd April 2007, 18:04
My goal is to remove every duplicate field in a Silent Film regardless of framerate. But first I have to explain the problem in a little tutorial before I can ask the question.

Silent Films were shot somewhere between 18fps and 22fps, but never at 24fps. Like modern films, they where never interlaced. Like modern films, they must be interlaced for NTSC TV by adding fields. The number of fields added increases as the fps of the original footage decreases.Film is generally shot and projected at 24 frames per second (fps), so when film frames are converted to NTSC video, the rate must be modified to play at 29.97 fps. During the telecine process, twelve (12) fields are added to each 24 frames of film (12 fields = 6 frames) so the same images that made up 24 frames of film then comprise 30 frames of video.Video plays at a speed of 29.97 fps so the film actually runs at 23.976 fps when transferred to video.The process of converting 24 frame/s material to 29.97 frame/s is known as 3:2 pulldownYes, but does that mean that the process of convertig 22 frames/s to 29.97 frames/s is called 3 3 3 2 3 3 3 2 3 3 2? Quickly googling the terms telecine and pulldown gives me the answer, which is that the terms do apply to film of any framerate.

So let's get on with it, my point briefly stated is that while it is possible to restore telecined silent film material to any framerate when creating an avi file, there are no standard tools for doing so, hence it can only be done manually. To the extent that this thread contains a question rather than a tutorial, I need help on how to adapt the tools to this purpose. At 23.976 frame/s, there are 4 frames of film for every 5 frames of NTSC video:

\frac{23.976}{29.97} = \frac{4}{5} Oddly enough, if I were to state that in my own words, I would say almost the exact same thing. However, there is a different ratio involved for non-talkie framerates. When converting 22fps to 30fps (the first step is actually to slow down 22fps to 22000/1001=21.978fps, but the ratio of that to 30000/1001=29.97 is the same as the ratio between 22 and 30, so it is best to ignore the pulldown since the point of the pulldown is to make the ratios match up the same as if we were dealing with NTSC being 30fps.) Anyway what we end up with is that for every 11 frames of film, we need 15 frames of video. Of course we break it down to fields, not frames, so for regular 24fps to 30fps we need 5 fields of video for every 2 frames of film. This is represented by 2:3; the number of numbers represents how many frames we started with, the total of the numbers represents the number of fields we end with. If for every 11 frames you needed 30 fields, you end up with the long pulldown pattern previously refered to: 3 3 3 2 3 3 3 2 3 3 2.

But in practice, I discovered an even longer pulldown pattern of 137 fields for every 50 frames. Rather than writing a 50 frame pattern down, the pattern must be described. It is made up mainly of the 3 3 3 2 pattern repeating, alternately being interupted by the shorted 3 3 2 pattern once after 5 or 6 repeats of the main 3 3 3 2 pattern. The main pattern is 11 fields long and the shorter pattern is 8 fields long, so the main pattern starts again after interuption every 11*5+8=63 or 11*6+8=74 fields. 63+74=137 is the number of fields that go by before the whole pattern repeats again. Basically, this seems to be the pattern for all the TCM silents. Weird isn't it?

In order to keep the field order correct, I use a SelectEvery lasting over 274 fields after a SeparateFields. Attached is an AviSynth script using that SelectEvery while keeping a running total of the number of frames created in order to keep it in sync with the main pattern.

The pattern for 20fps to 30fps is much simpler. For every frame of film you need 3 fields of video. This can be represented by the number 3 by itself, or 3:3 to make it clear that it is a repeating pattern. Attatched is another AviSynth script that uses TDecimate(cycleR=1,cycle=3) for this pattern.

In the first case the challenge is to find the pattern manually, in the second case the challenge is to find a way to verify that TDecimate really removed all repeating fields.

Here we come across an AviSynth limitation. What I really want is to remove all duplicate fields regardless of the resulting framerate or number of frames. In contrast, AviSynth needs to know the framerate and number of frames before any field decimation can start. The best alternative would be a two-pass system where duplicates are counted on the first pass and removed on the second pass. So what I really need is a FieldMatching filter that can create a log of matching fields instead of a log of combed frames. Alternatively, if it could output a log of duplicate frames that it creates as it deinterlaces, a decimation filter could remove all of them on a second pass. It has to be a second pass, because before the decimation filter can start if has to know how many frames it is going to remove.

So my question is, in the above paragraph, is there any plugin for avisynth that can already do that?

My quotes were from: 2-3 Pulldown (http://www.zerocut.com/tech/pulldown.html) and Common pulldown patterns (http://en.wikipedia.org/wiki/Telecine#Common_pulldown_patterns)

Stephen7030

ChiDragon
2nd April 2007, 18:32
MultiDecimate by Donald Graft (http://neuron2.net/multidecimate/multidecimate.html) seems to be exactly what you describe, but it can create audio and video desync when trying to remove every duplicate. Manually figuring it out would almost definitely produce better results if you can stomach it.

525/60
2nd April 2007, 19:34
Thanks, I am checking it out now.

Manually figuring it out would almost definitely produce better results if you can stomach it.That would be a lot easier than what I alread did. That's the easy part. The hard part is trying to find the cadances and when they break manually.

Stephen

manono
3rd April 2007, 07:31
Silent Films were shot somewhere between 18fps and 22fps, but never at 24fps.

Not true. I've seen them on DVD at anywhere between 15fps and about 26fps, and everything in between, including 24fps. Some of the earliest Edison ones were meant to be seen at framerates as high as 48fps:

http://www.cinemaweb.com/silentfilm/bookshelf/18_kb_2.htm

While MultiDecimate can be useful, I've found the best way is to put on a field matcher and start counting. Yes, sometimes the pattern won't begin to repeat for several hundred frames. And then you have to do a lot more counting to confirm. Or you've counted hundreds of frames and you come to an intertitle and have to start over. But once you've figured out the cycle and how many duplicate frames (or unique frames) are in that cycle, in principle the rest is easy.

And you think that's hard? Work with a few PAL2NTSC blended silents, and try and both unblend them and figure the correct framerate. And I've seen a few where the framerate changes in the middle of the movie.

525/60
8th April 2007, 14:22
What if we decomate one in three frames, bringing the framerate down to to 20fps, then then conditionally decimate one in 40 depending on whether there are any duplicates in the 40 without regard to framerate?

In other words, let it go out of sync by the latter smaller amount. Since silent films have no dialog, very small desync might not be noticeable. This is based on a case where 1 in 3 decimation resulted in long stretches of no duplicates and long stretches of 1 in 40 remaining duplicates.

Most filters don't allow this. Are there any that can drop only duplicates, regardless?

Stephen

Leak
8th April 2007, 16:21
Are there any that can drop only duplicates, regardless?
Well, it's rather hard to not drop one in n frames, as the exact length of the clip must be known before even looking at the first frame...

np: Radiohead - Morning Bell/Amnesiac (Amnesiac)

foxyshadis
9th April 2007, 00:31
TDecimate(cycle=3).TDecimate(cycle=200,cycleR=3,sdlim=30) ?

The cycle/cycleR values in the second would be based on your best guess of how many 40-length cycles have dupes, and how often those might repeat. sdlim is the minimum distance between dupes, 30 is just a guess since I don't know the pattern.

Such long cycles will probably cause heavy seeking, so it might not be a great idea to use with directshowsource (or avisource on an xvid without packed bitstream).