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.
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.