Log in

View Full Version : optimize this/parallel deint


jmac698
23rd February 2006, 05:07
This is probably an unusal script, but it does work and is in big need of optimization.

wide.avs:
MPEG2Source("C:\MyVideos\capture-wide.d2v")
AssumeTFF()
trim(390,0)
Telecide(guide=1,post=2,vthresh=25)
BilinearResize(720,480,0,58,0,360)

full.avs:
MPEG2Source("C:\MyVideos\capture-full.d2v")
AssumeTFF()
trim(441,0)
Telecide(guide=1,post=2,vthresh=25)
BilinearResize(532,480,5,0,707,480)

anamorphic.avs:
clip1=avisource("C:\MyVideos\wide.avs")
clip2=avisource("C:\MyVideos\full.avs")
video=overlay(clip1,clip2,x=94,y=2,opacity=1.0,mode="blend").decimate()
audio=MPASource("c:\MyVideos\capture-full T01 DELAY 0ms.mpa")
audiodub(video,audio)
trim...

I have to explain something, these are the same videos, only one is bigger. Thus, they have the same deinterlacing decisions. What would rock is a way to apply the same weave/bob choices to two clips at the same time. I'm sure it's possible, though I may have to learn about conditional scripting.
Also, is there an overlay including resize, or an overlay including a 1-pixel feather?

foxyshadis
23rd February 2006, 07:21
That's a rather convoluted way of doing something. If you can possibly force film it, that would be much easier. If not, crop and resize both to be as close to exactly the same as humanly possible, always do that before comparing two clips. (Pan and scan will hurt if present, but there's nothing you can do about that anyway.) Then you might run something like Soothe on the two clips to minimize distortion from pans, while still letting some benefit leak through. I'd say run IVTC after the merge, but I worry that different patterns could mess things up... but they'll mess it up wherever you place it, just differently.

mt_average is a better idea for 50/50 averages, average for other averages, and mt_merge for masked merges. Not sure why you'd need a feather without a mask, but for 1-pixel you can use blur(1) or removegrain(mode=12); for higher values you can use bilinearresize(width/(x*2),height/(x*2)).bilinearresize(width,height) where x is the # pixels to feather.

Still, I'd wager it would be simpler to clean one up than to sync the two, temporally and spacially. It would take a pretty killer filter to do that in anything but the trivial case.

jmac698
23rd February 2006, 17:51
If you can possibly force film it, that would be much easier.
These are captures, no nice flags telling me the cadence :(

run IVTC after the merge
My thinking was that resizing before deint is bad, the worst reason is you couldn't bob cleanly anymore. But I have to test this theory.
There is no pan and scan. Without that complication, it's actually quite simple. They stayed in perfect sync as is and I can notice a small difference in quality. I'm putting an opaque copy of one over the other, and while they are perfectly fitted spatially, there is a small subpixel error due to resizing, analog capping, etc. I want to blend 50/50 only two vertical, 1 pixel lines to remove this small blemish. I used overlay to avoid having to create a mask image, but I suppose that's not too hard.
Blur()? I don't want to blur a whole image. I just need sample merged edges.
I like your mask idea, thanks. I'm still looking for a way to co-deint two files.

foxyshadis
23rd February 2006, 23:25
If you resize horizontally only, it won't hurt the interlacing at all, so you can still bob/ivtc just fine. That's assuming their vertical resolution is the same, if not if might get a little messier. You might want to resize them to match, addborders to the smaller, then create a mask in a paint program that's all white in the center, with 1px grey edges, and black beyond that, then open that with imagesource() and use it as a mask. 's what I do when I have well-defined areas like that. White is first clip, black is second. (Adding grey will have the same effect as blurring a mask that's a flat black/white block.)

If they're not the same vertical resolution then you will have to telecide first, but I really don't know if there's a way to force the same decisions or not.

jmac698
24th February 2006, 00:12
create a mask in a paint program that's all white in the center
Ok, good tip.. will have to try that out :)

not the same vertical resolution then you will have to telecide first
Well, I haven't explained very well... clip1 is vertically smaller. Clip2 is horizontally smaller. If I resize clip1 vertically first, there will be the equivalent of blending on both fields, this would make it harder to both detect and bob. That's why I feel it's safer to deint first. As for horizontally sized, I agree with you, it shouldn't affect deint. I think there is a way to do it but you have to be pretty knowledgeable. It would mean using IsCombed() in a script where you put the weave/bob operations yourself.
As long as it works, I can leave it at that. Thanks for you help! :)

ps my method is giving me almost hi-def quality from two clips.. the equivalent of 960x480 true original resolution.
I just realized I don't need to make an anamorphic DVD and lose quality - I could just make a hidef clip instead.