Log in

View Full Version : AVI Synth Newbie (Crop & Resize)


Rassilon
27th April 2005, 11:38
Hi All,
Sorry if I get some of the terminology wrong. I'm "Upskilling" myself to go from a one click solution like DVDRB to doing it all (Mostly) manually. I recorded a program onto DVD-RAM and set the recording up incorrectly, so now I have a video with a black border around it. What I want to do is to crop the black border and resize it back to DVD size and then burn it to DVD-R

What I have done so far is:

Installed AviSynth 2.5 and read through the help on the web page. My first script was:

DirectShowSource("G:\DVD\Dr Who 3 and 4\Dr Who 3 and 4.VRO")

And this failed, mediaplayer just displayed "Could not open as video or audio". So I remembered that DGIndex makes script files so I ran DGIndex and created the following base AVS file:

loadplugin("D:\Program Files\DGMpgDec\DGDecode.dll")
loadplugin("D:\Program Files\AviSynth 2.5\Decomb521.dll")
mpeg2source("G:\DVD\Who.d2v",cpu=6)
fielddeinterlace()

The video plays with no audio in mediaplayer which I am using to see how the modifications to the AVS file come out. I used DGIndex to get figures as to how much to crop the video and made it to the closest multiple of 16 and I than manually added the following:

crop(96, 64, -80, -64)

But this has cropped off too much. Is there a more accurate way to calculate the correct amount of video to crop off?

Once I have cropped the correct amount off I was going to add:

BicubicResize(704,576)

To get it back to full size.

I was thinking of using QuEnc or DVD Author option in ReJig to make the final file?

What are your thoughts?

Thanks in advance for any information and advice.

Boulder
27th April 2005, 15:19
You don't have to crop multiples of 16. The Avisynth documentation entry for Crop contains the rules. You can use DGIndex to measure the amount of pixels you need to crop; I personally use VirtualDub for that.

I recommend FitCD for doing the resizing math to make sure you get correct aspect ratio.

Wilbert
27th April 2005, 15:51
I advice you to read the analog cap guide how to deinterlace (you don't have an analog cap, but it contains a nice and illustrative section about deinterlacing).

Boulder
27th April 2005, 15:58
And to add to that : if your source is really interlaced and you go for DVD, keep it interlaced.

Rassilon
30th April 2005, 01:39
Boulder Said:
You don't have to crop multiples of 16. The Avisynth documentation entry for Crop contains the rules. You can use DGIndex to measure the amount of pixels you need to crop; I personally use VirtualDub for that.
Oops, looks like I misread that page on my initial reading. SSE2/16bytes.
Boulder Said:
You can use DGIndex to measure the amount of pixels you need to crop; I personally use VirtualDub for that.
I couldn't find the option in VirtualDub :(
As for "FitCD" it didn't like the source being 704x576 so no luck there either :( (Until I downloaded a newer version)


I loaded the AVS that I mentioned previously with a modified cropping that I got throught DGIndex and part of the script that FitCD gives me is:
BicubicResize(448,544,0,0.6,0,3,704,570)
AddBorders(16,16,16,16)
So I Gather that I add these two lines to the bottom of my original AVS script?

I thought that adding borders made the final movie file larger as it created hard borders that compressed badly?

Any further suggestions?
Boulder Said:
And to add to that : if your source is really interlaced and you go for DVD, keep it interlaced.

From DGIndex:
Aspect Ratio: 4:3
Frame Size : 704x576
Profile : main@main
Frame Rate : 25.000 fps
Video Type : PAL
Frame Type : Interlaced
Frame Struct: Frame
Field Order : Top

So, from what you're saying I should remove the fielddeinterlace() from my script? I have done this and get a combed effect especially on high motion parts (I'll try to attach a screen cap) or does this "clear" itself once it's back in the TV DVD Player?

Boulder
30th April 2005, 08:38
I couldn't find the option in VirtualDub :(

Load the script in VDub, using only MPEG2Source in it. Choose Video->Filters and add Null transform. Then choose cropping and you get a screen in which you can determine the cropped area. Write down the values and use them in FitCD.

As for "FitCD" it didn't like the source being 704x576 so no luck there either :( (Until I downloaded a newer version)

You can feed the resolution directly in FitCD, then set the aspect ratio at DVD 704 or DVD 720. Enter the crop parameters in the four boxes and either choose 'no cropping' or 'accurate'. The latter one means FitCD will crop in addition to your settings to get minimal A/R error. The former one crops only the amount you specify.

Then just copy-paste the resizing parameters to your script.

I thought that adding borders made the final movie file larger as it created hard borders that compressed badly?

FitCD considers a thing called overscan. Standard TV sets have some overscan which means that some of the image doesn't fit to the display area. When the borders are added, they actually do not show when you watch the video on your TV, provided that it has overscan area.

Using overscan actually improves compression but requires that you resize the image. Some people don't want to resize at all but as you are cropping the image, you probably have to resize anyway.

If you don't want any borders to be added, just set the overscan amount to 0, it's on the destination side of the FitCD window.

So, from what you're saying I should remove the fielddeinterlace() from my script? I have done this and get a combed effect especially on high motion parts (I'll try to attach a screen cap) or does this "clear" itself once it's back in the TV DVD Player?
You won't see the combing on the TV if the field order is set correctly in the encoder. Almost all DVDs are top field first but you can check that manually, the Decomb documentation includes a good tutorial.

If you leave the video interlaced, you must be very careful with how you treat the source. A search will give you some quite recent discussions regarding processing interlaced material.

Rassilon
30th April 2005, 12:34
Load the script in VDub, using only MPEG2Source in it. Choose Video->Filters and add Null transform. Then choose cropping and you get a screen in which you can determine the cropped area. Write down the values and use them in FitCD.
IF I understood you correctly, the result is automatically displayed. The result was 520x424. I tried loading the same script into FitCD and it gave me the same result. :)

So my final script should look something like:
loadplugin("D:\Program Files\DGMpgDec\DGDecode.dll")
mpeg2source("G:\DVD\Who\Who.d2v",cpu=6)
BicubicResize(672,544,0,0.6,0,2,520,420)
AddBorders(16,16,16,16)
#Trim(0,76178).FadeOut(150)


If you leave the video interlaced, you must be very careful with how you treat the source. A search will give you some quite recent discussions regarding processing interlaced material.
I'll do a search for that, I want my output to be as good as possible, which is why I'm doing things the doom9 way. :)

Thanks for your time, advice and patience!

Boulder
30th April 2005, 13:19
Originally posted by Rassilon
IF I understood you correctly, the result is automatically displayed. The result was 520x424. I tried loading the same script into FitCD and it gave me the same result. :)

So my final script should look something like:
loadplugin("D:\Program Files\DGMpgDec\DGDecode.dll")
mpeg2source("G:\DVD\Who\Who.d2v",cpu=6)
BicubicResize(672,544,0,0.6,0,2,520,420)
AddBorders(16,16,16,16)
#Trim(0,76178).FadeOut(150)


The original resolution is 704x576. You get the individual values for cropping for each side in VDub. If you set the source to 704x576 in FitCD, set the AR to DVD 704 and input the values in the four boxes on the left side in the FitCD window, you should get a slightly different script.

Based on the script you got, FitCD thinks that your source is actually 520x424 to begin with. You should always give it the details of the non-cropped video and then input the cropping values in the boxes.

What comes to interlaced processing, it's basically this:

loadplugin("path\tdeint.dll")
loadplugin("D:\Program Files\DGMpgDec\DGDecode.dll")
mpeg2source("G:\DVD\Who\Who.d2v",cpu=6,ipp=true)
AssumeTFF() # AssumeBFF() for bottom field first
TDeint(mode=1)
BicubicResize(672,544,0,0.6,0,2,520,420)
AddBorders(16,16,16,16)
AssumeTFF() # AssumeBFF() for bottom field first
SeparateFields()
SelectEvery(4,0,3)
Weave()
#Trim(0,76178).FadeOut(150)

I assume that your source is top field first but you must check it manually to avoid problems. The Decomb documentation includes a good tutorial on how to do that.