PDA

View Full Version : Resize and Crop?


Celsitude
28th April 2002, 08:06
Ok, I read doom's guide, the berkeley site and videotools.net and I am still in the dark about this one. I've been capturing in VirtualDub w/huffy and then trying to frameserve to CCE. This is the script:

Avisource("C:\presto\capture.avi")
LoadPlugin("C:\Videoencoding\AVISynth\GreedyHMA\GreedyHMA.dll")
clip = AVISource("c:\presto\capture.avi")
return clip.GreedyHMA(1,0,4,0,0,0,0,0)
LoadPlugin("C:\Videoencoding\AVISynth\IVTC\IVTC.dll")
clip = AVIsource("C:\presto\capture.avi")
return clip.DeInterlace(32,8)
Crop(10,10,710,470)
BicubicResize(480,480,0.0,0.60)

It loads fine into VirtualDub and CCE, but the cropping and resize doesn't seem to work. What am I doing wrong? I only want to crop 10 from the left and 10 from the bottom - just to get rid of that VHS stuff at the bottom and left of the screen. The source file is an NTSC source that I wanted to make into an SVCD.

Second, the script won't load into WMP 7.1 - it says "invalid or corrupt data was encountered" - I read on videotools that I may need some kind of Aviwrapper but I can't seem to find it to download. I have the VFW wrapper, but I have a feeling this isn't the same thing.

Can anyone help?

Cels

Acaila
28th April 2002, 08:47
Why don't you try it like this:

LoadPlugin("C:\Videoencoding\AVISynth\GreedyHMA\GreedyHMA.dll")
LoadPlugin("C:\Videoencoding\AVISynth\IVTC\IVTC.dll")
Avisource("C:\presto\capture.avi")
GreedyHMA(1,0,4,0,0,0,0,0)
DeInterlace(32,8)
Crop(10,10,710,470)
BicubicResize(480,480,0,0.6)

Celsitude
28th April 2002, 09:25
Thank you, thank you - it worked. Can you explain why? Is it just the order or was there something I was putting in there to throw it off? Thanks again, Cels

Acaila
28th April 2002, 12:41
No, it was not the order in which you wrote the code, but the way you wrote it that screwed things for you.

Let me try to explain it for each line:

Avisource("C:\presto\capture.avi")
Nothing wrong with this one. It sets Capture.avi as the source for future operations.

LoadPlugin("C:\Videoencoding\AVISynth\GreedyHMA\GreedyHMA.dll")
Also nothing wrong here, you need this to be able to use the GreedyHMA function later on.

clip = AVISource("c:\presto\capture.avi")
This line says to make a variable called "clip" with a value of the avi file mentioned. Since you already set this same file as the source in your first line this is not really needed anymore.

return clip.GreedyHMA(1,0,4,0,0,0,0,0)
Here you call the variable "clip" and perform the GreedyHMA function on it. Nothing really wrong with this, but you don't need the extra step of creating and calling the cariable "clip" just to perform a function on it.

LoadPlugin("C:\Videoencoding\AVISynth\IVTC\IVTC.dll")
Plugin required for DeInterlace, this looks perfect.

clip = AVIsource("C:\presto\capture.avi")
Here you overwrite the existing variable "clip" and reset it to the original video, so the GreedyHMA you performed on it earlier is now lost.

return clip.DeInterlace(32,8)
It calls the vaiable and performs a DeInterlace on it. Like with the GreedyHMA step, it's just creating extra actions you don't really need.

Crop(10,10,710,470)
BicubicResize(480,480,0.0,0.60)
Finally you perform cropping and resizing on ... I'm not sure, but I think on the source you set in your very first line. So both the GreedyHMA AND DeInterlace will be overwritten. Either that, or it doesn't have a source and errors out.


So, as you can see, there's quite a lot of things going wrong here. The way I wrote the code in my previous post is, it just sets a source and performs all following functions on it. That is without creating variables and calling them later on which is (at least for your case) over-complicating things.
When you have just one source you don't need variables. Unless you split the video up into several segments to perform different functions on it.

Kedirekin
28th April 2002, 14:23
I think it was the use of return. Your script effectively ended at the first return line.

Related to Acaila's reply, you might want to look into the implicit 'last' variable concept of AviSynth. In effect, Acaila's script implicitly assigns everything to the 'last' variable on every step, and AviSynth implicitly adds 'return last' at the end of the script.

Nic
28th April 2002, 14:35
Yes, Kedirekin is quite correct. Simply removing the "return"s & the second AVISource would have fixed the script.

-Nic

Celsitude
28th April 2002, 21:06
Thanks everyone, now I understand it a bit better. I really appreciate the help :)

Cels