PDA

View Full Version : need help with cropping


tezenoy
11th August 2005, 06:10
hey guys,
i'm new to avisynth and i need some help.
i have a MPEG-2 file, which i recorded with my DVB card.
here is the file info:
-
Video: MPEG-2 PS/SS (Video/Audio PES) @ 5305 Kbps, vbv 112
Resolution: 704x576
Aspect Ratio: 4:3
Frame Rate: 25
Region: PAL
Bits/(Pixel*Frame): 0.523
Delay: 432
Audio: MPEG-1, Layer2, 44100Hz, stereo, 192kbps, noCRC, delay 432
-
I want to crop 3 pixels from the bottom, 9 pixels from the left, 1 pixel from the top and not to crop anything from the right side.
the video is fullscreen and interlaced but it has a black bar on the left and bad stuff on the bottom and that's why i want to crop.

i've tried using this script:

LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\MPEG2Dec3.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\Decomb521.dll")
mpeg2source("d:\other\a1.mpg")
Crop(9,1,0,-3)
FieldDeinterlace()
BicubicResize(512,384,0,0.5)

this script showed:
Avisynth open failure:
MPEG2Source: couldn't open file
so i changed mpeg2source("d:\other\a1.mpg") to mpegsource("d:\other\a1.mpg") and it worked.
but then, it told me this:
Avisynth open failure:
Crop: YUV images can only be cropped by even numbers (left side).
i've tried to change the line from Crop(9,1,0,-3) to Crop(9,1,-0,-3) but i got the same error.
can anyone help please? i will really appreciate it and thanks in advance.
and if you also know why the mpeg2source didn't work and the mpegsource did, it will be great.
by the way, i'm using AviSynth 2.5 with VirtualDub 1.6.10. i've also tried using mpeg2dec.dll and another dll except the one i'm currently using but all of them didn't work when i tried mpeg2source(*).

Mug Funky
11th August 2005, 07:11
if your source is progressive and you don't mind a smidgeon of resizing, you can use the cropping feature of avisynth's resizers.

like "lanczosresize(704,576, 9,1,704-9,576-(1+3))" should do what you want.

the resizers have cropping abilities, and the advantage of being able to resize by floating point values (like 3.1415926535898 pixels off the top for example).

however, if there's no rezizing necessary then it will fall back on avisynth's regular crop (and its limitations).

tezenoy
11th August 2005, 07:15
the source is interlaced.
but if i try this script:

LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\MPEG2Dec3.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\Decomb521.dll")
mpegsource("d:\other\a01.mpg")
FieldDeinterlace()
LanczosResize(512,384, 9,1,704-9,576-(1+3))

it seems to do the job (crop and resize to 512x384) and look fine.
feel free to post other solutions.
thanks for the quick response.