PDA

View Full Version : Silent Movie de-interlacing


525/60
15th March 2007, 16:34
I am working on a movie that is interlaced for NTSC from 22fps up to 30fps. The basic pattern is three fields from a frame three times then followed by two frame from a field:

BFF3 TFF3 BFF3 TFF2 TFF3 BFF3 TFF3 BFF2

Pattern repeats every 22 fields.

To put the duplicate fields side by side for comparison (or use Layer to verify that they are identical) I used this script:

SeparateFields()
trim(541,4085)
SelectEvery(11, 0,2,3,5,6,8)
#Layer(SelectEven.ConvertToYUY2,SelectOdd.ConvertToYUY2,"subtract",127)

With Layer(subtract) I will have all grey frames as long as the fields are identical, for those who don't know Layer just ignore it: I am selecting successive pairs of interlaced frames in order to confirm the interlacing pattern.

But the pattern gets interrupted periodically every 63 or 74 fields. Instead of three fields three times followed by two fields, three fields only occur twice once followed by two fields. At first the pattern seams to repeat every 74 fields:

SelectEvery(74, 0,2,3,5,6,8, 11,13,14,16,17,19, 22,24,25,27,28,30, 33,35,36,38,39,41, 44,46,47,49,50,52, 55,57,58,60,61,63, 66,68,69,71)

But then the pattern repeats after the next 63 fields:

SelectEvery(63, 0,2,3,5,6,8, 11,13,14,16,17,19, 22,24,25,27,28,30, 33,35,36,38,39,41, 44,46,47,49,50,52, 55,57,58,60)

Then it is clear the pattern alternates between the two, making it a 74+63=137 field pattern:

SelectEvery(137, 0,2,3,5,6,8, 11,13,14,16,17,19, 22,24,25,27,28,30, 33,35,36,38,39,41, 44,46,47,49,50,52, 55,57,58,60,61,63, 66,68,69,71, 74,76,77,79,80,82, 85,87,88,90,91,93, 96,98,99,101,102,104, 107,109,110,112,113,115, 118,120,121,123,124,126, 129,131,132,134)

But the fields don't start out 3 3 3 2 at the beginning of the movie. I starts out 3 2 3 3 2 3 3 3 2 with a break in the 3 3 3 2 pattern after 63 fields followed by 74. So the proper script for matching the identical fields from the beginning if the movie is:

SeparateFields()
trim(541,4085)
SelectEvery(137, 0,2, 5,7,8,10, 13,15,16,18,19,21, 24,26,27,29,30,32, 35,37,38,40,41,43, 46,48,49,51,52,54, 57,59,60,62,63,65, 68,70,71,73, 76,78,79,81,82,84, 87,89,90,92,93,95, 98,100,101,103,104,106, 109,111,112,114,115,117, 120,122,123,125,126,128, 131,133,134,136)
#Layer(SelectEven.ConvertToYUY2,SelectOdd.ConvertToYUY2,"subtract",127)

At which point the pattern breaks down. Because the pattern breaks down frequently, it might be nice if I could automate this process. Does anyone know of an easier way to verify where the duplicate frames are?

Stephen

P.S., Since for deinterlacing I must keep track of which are the bottom fields and which are the top, the pattern doubles from 137 to 274 for the actual deinterlacing using SelectEvery.

foxyshadis
15th March 2007, 17:06
TIVTC can actually handle these more bizarre pulldown situations quite well. Set up TFM however you like, then set TDecimate with correct cycle and cycleR values. Start with cycle=11, then if that presents problems, move to cycle=137 that you found (since you can't specify a half a frame, you need 2 real cycles). At that point, any bad decimations should be fairly hard to find.

manono
16th March 2007, 14:46
You'll have better luck figuring out the pattern by field matching first, rather than separating the fields. Just put on TFM or Telecide by themselves, and then start counting. For decimating, after you've figured out the pattern, follow foxyshadis' advice, or use SmartDecimate, which is ideal for this sort of thing.

It's not unusual for the pattern to change like that. You have to keep counting and writing things down until the pattern begins to repeat. In my experience (and I've done this hundreds of times), it eventually does.