View Full Version : Deinterlacing/Pulldown with AviSynth
k0r0n4
22nd August 2004, 07:34
I'm trying to deinterlace some video, but not having any luck. Here's the script:
AviSource("video.avi") # You guessed it, 29.97fps interlaced video
AssumeFrameBased
SeparateFields # Split the interlaced frames
SelectEvery(10, 0,1, 4,3, 6,7, 8,9) # Select what should be the right fields
Weave # Put the video back together
However, I still see interlaced frames. At first I thought I might need an offset to correct the problem [I used Trim() to offset the video by 1, 2, 3, and 4 frames], but that only caused me to get more interlaced frames.
To figure out which fields I needed for the selectevery I made a chart:
Interlaced:
0 1 2 3 4
A1 A1 B1 C1 D1
A2 B2 C2 C2 D2
-OR-
0 1 2 3 4 5 6 7 8 9
A1 A2 A1 B2 B1 C2 C1 C2 D1 D2
Deinterlaced:
0 1 2 3
A1 B1 C1 D1
A2 B2 C2 D2
-OR-
0 1 2 3 4 5 6 7
A1 A2 B1 B2 C1 C2 D1 D2
This is how I got the SelectEvery with the offsets of 0,1, 4,3, 6,7, 8,9, which should be A1,A2, B1,B2, C1,C2, D1,D2.
If you have any idea of what I'm doing wrong and you know how to fix it, please post it here because I'm lost. Thanks in advance!
scharfis_brain
22nd August 2004, 07:47
1) put an assumetff or assumebff between selectevery and weave.
this is cause playing with the field will mess up every field-dominace information carried with the fields.
2) better use
doubleweave()
selectevery(...)
it is more intuitive
3) or even better use telecide or smartdecimate to do that job of fieldmatching automatically
k0r0n4
22nd August 2004, 08:12
Ok, it turs out the bottom field was first, but that still didn't solve the problem
I used doubleweave then selectevery but it appeared that I was only getting 3/10 deinterlaced frames instead of 4/10 which is what I should of gotten.
I finally tried the Telecide filter for VDub/VDubMod/NanDub, and it seems to work rather well. The only disadvantage (as it says at its homepage) is that it might let a few frames through that are interlaced, but I guess I'll have to live with that possibility. Thanks for all the help!
P.S. - Great avatar ;-)
k0r0n4
22nd August 2004, 08:39
I figured out why the DoubleWeave wasn't picking up the 4th frame...
The actual field order is something like:
0 1 2 3 4 5 6 7 8 9
A1 A2 B1 A2 C1 B2 C1 C2 D1 D2
and NOT as I thought it was:
0 1 2 3 4 5 6 7 8 9
A1 A2 A1 B2 B1 C2 C1 C2 D1 D2
Thus even with doubleweave you never get a B1 B2 frame or a B2 B1 frame. I hope this can help others with the same problem!
Edit: Added code flags for text alignment
scharfis_brain
22nd August 2004, 08:49
provide a sample VOB or non-processed AVI-sample, so I can see what can be done.
k0r0n4
22nd August 2004, 09:02
Originally posted by scharfis_brain
provide a sample VOB or non-processed AVI-sample, so I can see what can be done.
Don't worry about it, I figured it out.
Trim(AviSource("video.avi"), 4, 2000) # an offset of 4 frames
AssumeFrameBased
SeparateFields
SelectEvery(10, 0,1, 2,5, 6,7, 8,9) # this time I got the right field order
AssumeBFF
Weave
NOTE: for the final pulldown you would want to get rid of the trim and just
change the values in the selectevery, so that you wouldn't loose any frames
You can't do this using doubleweave without messing with the field order first, and if you're going to do that you might as well just grab the fields in the right order and completely avoid using doubleweave at all. Thanks for all the help!
The attached file is a template for anyone needing the script. It should be located here: http://forum.doom9.org/attachment.php?s=&postid=535247
QQ
30th August 2004, 21:56
im having a bit of problems with deinterlacing aswell, though they came from the fact that im not really sure about what kind of interlacing do i have, and what is the field order.
i tried following the guide, but in both cases it looks the same to me.. any suggestions?
QQ
30th August 2004, 22:10
here's a 20 frame sample.. (picvideo mjpeg)
sample (http://dreamy.ws/files/sample_interlaced.avi)
QQ
11th September 2004, 20:07
anyone?:/
QQ
12th September 2004, 12:09
So far I found two ways, which seem to give good result:
a)
bob()
BlendBob()
and
b)
TomsMoComp(-1,5,1)
is there any logic to that? KernelDeint(order=1) as suggested by analog2digital guide doesnt seem to give such good result..
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.