View Full Version : Can I crop out subs on top?
vcdude
11th January 2004, 11:06
I have an AVI file I want to convert to DVD using DVD2SVCD. It has subs at the top of the screen I would like to crop out, and crop some of the sides to maintain aspect ratio. It is a 16:9 aspect which I want to keep for an amamorphic DVD. Detailed help would be appreciated. Thanks. I tried a search but not much on anamorphic and cropping.
Nick
11th January 2004, 12:37
OK, we're going to be messing with avisynth scripts here so find the AVISYNTH.INI file in your DVD2SVCD folder and make a backup copy in another folder for later! This is rather important!
First we need to know the resolution and framerate of your AVI file and do a bit of maths. Resolution and framerate can be determined with the old media player (Start button > Run > mplayer2). Open your avi and either in properties or statistics options in the menus you can find what you need. Firstly determine if it is PAL or NTSC. PAL=25 frames per second (fps), NTSC will be 29.97 or 23.976 fps. Then determine what percentage of the vertical aspect you wish to trim off the top. Clearly to maintain aspect ratio the same percentage must be lost horizontally.
The bicubic resize command in avisynth has source cropping facility to trim from the source frame before resizing to target resolution - in this case for DVD that is 720x480(ntsc) or 720x576(pal). You can trim from (l)eft and (t)op then provide source width(sw) and source height(sh) effectively cropping the right and bottom respectively.
BicubicResize(Targetwidth,targetheight,0,0.6,l,t,sw,sh)
So, if we say your avi has a resolution of p horizontally, and q vertically and you are cropping z% off the top and nothing off the bottom
t=(z/100)q
For the horizontal crop we are presumably cropping (z/2)% from the left and (z/2)% from the right.
So
l=(z/200)p With me so far? LOL :D
OK so if, say z=10, we've cropped z% off the top so source height would be (100-z=)90% of initial height and so sh and sw in our bicubic resize command should be 90% of their original value. So for any z value...
sw=((100-z)/100)p and
sh=((100-z)/100)q (OK even I'm lost now :) )
So by determining PAL or NTSC from source framerate, we can determine target width and height. Using the formulae above we can determine l,t,sw and sh values. So you can construct the correct resize command by putting the numbers in the brackets.
Now launch DVD2SVCD and load up your AVI file. Choose anamorphic for your aspect ratio. Select bicubic resize in the frameserver tab resize method box. Click the "edit avisynth script" button at the top right (pen-and-paper icon) and replace the contents of the brackets with your new parameters. Since the source is 16/9 there are no borders to add and so you should scrub the AddBorders and b and c value lines from the script leaving just the bicubic resize.
Now preview the video. The aspect ratio will not look right but don't worry about this. Click on "Show DVD2SVCD" and in the frameserver tab toggle between Bilinear and bicubic resize. You should see the same frame both cropped and uncropped. If the results look like you expected, select bicubic resize and convert as normal.
Then afterwards restore AVISYNTH.INI from your backup.
Good luck
Nick
vcdude
12th January 2004, 03:38
Think I'll have to leave that in the too hard basket. Thanks for all the effort though. None of those icons appear to be present in my version (1.1.3b2). Wouldn't it be nice if there was a plugin with a preview window in which you could drag a rectangle over the image and the rest would be done automatically. For now the subs stay. :)
r6d2
12th January 2004, 18:50
@vcdude,
Try AutoFitCD plugin for DVD2SVCD. It has that preview window and all, and it will handle aspect ratio for you. It may even crop the subs automatically, but if it fails, you can enter the "top" border to have them cropped.
Select 1:1 as input if the AVI has square pixels (likely). Report back if need any help.
Nick
12th January 2004, 19:40
I had a look at that plugin but couldn't come up with a way to solve his problem. I'll have another look.
vcdude
12th January 2004, 20:45
Someone should be paying you guys for this. :)
Nick
12th January 2004, 21:33
All major credit cards accepted :D
Nick
14th January 2004, 15:48
Nope. Tried again with AutoFitCD but whatever I crop off the top, it crops the same off the bottom. You've got me beat there R6D2!
@vcdude - get the latest version from DVD2DVD.org and give it a try. The "manual" way with an edit of the avisynth script isn't that tricky. Unless I explained it poorly in which case I'll happily clarify...
r6d2
14th January 2004, 23:05
Originally posted by Nick
[B]Nope. Tried again with AutoFitCD but whatever I crop off the top, it crops the same off the bottom. You've got me beat there R6D2!
@Nick, try this.
Suppose you have a 640x360 16:9 source with 1:1 PAR. AutoFitCD will detect borders and if the sample frame has subs, they will be detected. And you select SVCD frame output size.
Suppose I get this default script:
BilinearResize(448,308,2,20,636,320)
AddBorders(16,80,16,92)
Now you have to tune the film pixel area manually. Set the height first (on this example, 320 is the height). Then, adjust the top margin to crop the subs. On this example, I set it to 30 instead of the default of FitCD.
Then I get this script:
BilinearResize(448,308,2,30,636,320)
AddBorders(16,80,16,92)
Please report back if it does not work for you.
Nick
15th January 2004, 20:02
Yeah. Worked first time.
Cheers
Nick
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.