Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
22nd June 2009, 12:40 | #1 | Link |
Didée Fan
Join Date: Feb 2006
Location: Canada
Posts: 1,079
|
How to crop correctly. A guide using Megui.
How to crop your video using megui avs script creator
_______________________________________________________________ Watch youtube video guide Step 1: Initializing the avs script editor to then use either method 1 or method 2 _______________________________________________________________ - From the megui tool tab, click avs script creator. - Open the avs script creator and load your avs file. Your avs file should look like this. Notice nor resizing or cropping in the code: directshowSource("C:\Users\red\Desktop\Blade Runner.GRF",audio=false,fps=23.976) - From the Input Dar, go to "Select AR". If the dvd box says 2.35:1, then type in 2.35 If the dvd box says the aspect ratio is 1.78:1, then type in 1.78 Then press ok. Method 1 _______________________________________________________________ - Check the "Resize", "Suggested resolution mod16", "Crop" boxes. - Assuming your source resolution is 720, 480 or 720, 576 Widescreen, And there is 8 pixel black bars on the left and right side of the video, change the 720 to 704 using the down arrow to the left of 720. Pressing it once will change the resolution to 704. - Assuming the video is 720, 480 or 720, 576 Widescreen and there is no 8 pixel black bars on the left and right side, then keep the resolution to 720. - Click the "Clever anamorphic encoding"box. - You can now save the file. Open the saved file and copy and paste the code you need to the avs you opened in the avs script creator process. I needed to get 1.78:1 and after doing this my created avs looked like this: # Set DAR in encoder to 16 : 9. The following line is for automatic signalling global MeGUI_darx = 16 global MeGUI_dary = 9 Import("C:\Users\canteen\Desktop\test run2.avs") #deinterlace crop( 0, 0, 0, 0) LanczosResize(704,464) # Lanczos (Sharp) #denoise And my working avs looked ike this after all this work was done and I'm ready to start encoding: mpeg2source("C:\Users\canteen\Desktop\afro.d2v") global MeGUI_darx = 16 global MeGUI_dary = 9 LanczosResize(704,464) Method 2 _______________________________________________________________ - Assuming your source resolution is 1920x 1080 High Definition. - Check these boxes: Resize, Suggested resolution mod 16. This will change the resolution of the 1920, 1080. - Uncheck Suggested resolution mod 16. - Check the crop box. - Click Auto crop. - Save the file. - Copy and paste the results into your working avs file as done in method 1. ______________________________________________________ This picture shows how to initialize avs script creator to then do either of the two methods below Method 1 method 2 Comparison pictures below - You may be asking which method is the best one? There is no Best method is the answer. Try a method. When have a finished avs with the values you got from the avs script editor, open the avs with megui, and there will be a picture pop up and it will show the aspect ratio of that picture. If you do not think the aspect ratio shown in the picture is good enough, then try the other method. Simple as that. - About cropping. If you select a video using your avs, and when the video screen pops up,and that video has a miniature video picture on the screen that is not what the rest of the movie resolution is. Then when you crop using the avs script creator it will crop out the black border surrounding that miniature picture. So you need to have a picture the size of the main movie in the pop up box when you start the avs script creator. Note Below is the original post for reference purpose. Above the line is my edited post with my solution I found ________________________________________________ sample vob I want to resize the video to these three resolutions. Not all at once in the same encode though. The first resolution is 720x480, or ntsc sd dvd The second resolution is 720x576 or pal dvd The third resolution is 1080p, or 1920x1080 This is the solution I have now and I think it's wrong? Code:
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\DGDecode.dll") setmtmode(5) mpeg2Source("C:\Users\Red\Desktop\test run.d2v") setmtmode(2) a= last b=a.Spresso() SeeSaw(a,b) LimitedSharpenFaster(strength=11) LimitedSharpenFaster(strength=11) super = MSuper(pel=2,hpad=4,vpad=4) backward_vec = MAnalyse(super,chroma=false, blksize=16, isb = true, search=5, searchparam=1) forward_vec = MAnalyse(super, chroma=false, blksize=16) MFlowFps(super, backward_vec, forward_vec, num=60, den=1, mask=1, ml=49) distributor() Crop(0,0,-0,-0) Spline36Resize(720,480)
__________________
When I get tired during work with dvd stuff i think of River Tamm (Summer Glau's character). And the beauty that is Serenity. Last edited by Jeremy Duncan; 7th July 2009 at 21:15. |
22nd June 2009, 14:13 | #2 | Link |
Registered User
Join Date: Dec 2002
Location: UK
Posts: 1,673
|
It's FHA 16x9.
Not sure about the pointless crop line, but what else can go wrong with the aspect ratio? Just resize to the desired resolution, and make sure you flag the SD versions as 16x9. Cheers, David. |
23rd June 2009, 21:12 | #5 | Link |
Didée Fan
Join Date: Feb 2006
Location: Canada
Posts: 1,079
|
This is what I'm using now for 16:9 1.78:1 aspect ratio.
Ntsc 1.78:1 LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\DGDecode.dll") mpeg2Source("C:\Users\Red\Desktop\test run.d2v") Spline36Resize(848,480) Pal 1.78:1 LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\DGDecode.dll") mpeg2Source("C:\Users\Red\Desktop\test run.d2v") Spline36Resize(1024,576) _____________________ Now what I am thinking of doing is doubling the resolution and I'm wondering if it needs anything like addborders added to the code. if I do then please post the code it needs. The code with double the resolution is below. Ntsc 1.78:1 LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\DGDecode.dll") mpeg2Source("C:\Users\Red\Desktop\test run.d2v") Spline36Resize(1696,960) Pal 1.78:1 LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\DGDecode.dll") mpeg2Source("C:\Users\Red\Desktop\test run.d2v") Spline36Resize(2048, 1152)
__________________
When I get tired during work with dvd stuff i think of River Tamm (Summer Glau's character). And the beauty that is Serenity. |
24th June 2009, 08:46 | #6 | Link |
Registered User
Join Date: May 2004
Posts: 67
|
did you not say you wanted to resize to ntsc/pal DVD resolution? If so what's with 848x480 and 1024x576? Follow 2Bdecided's advice if that's your goal.
The last 2 pieces of code are ok, just remember they are for square pixels though.
__________________
Sorry I had to go see about a girl |
24th June 2009, 13:46 | #7 | Link | |
Didée Fan
Join Date: Feb 2006
Location: Canada
Posts: 1,079
|
Quote:
Where would this be set in megui I wonder? I have a request. Could you or somebody translate my code in post #5 into non-square pixel resolution?
__________________
When I get tired during work with dvd stuff i think of River Tamm (Summer Glau's character). And the beauty that is Serenity. |
|
25th June 2009, 00:40 | #9 | Link |
Didée Fan
Join Date: Feb 2006
Location: Canada
Posts: 1,079
|
I don't think so. For that you would use hc enc and make a mpeg2 then use a dvd builder to make the vobs.
__________________
When I get tired during work with dvd stuff i think of River Tamm (Summer Glau's character). And the beauty that is Serenity. |
25th June 2009, 11:25 | #11 | Link |
Didée Fan
Join Date: Feb 2006
Location: Canada
Posts: 1,079
|
I ripped different aspect ratio sd dvd's then opened then in ripbot264 and got the cropping and resize resolutions for hd and sd at different aspect ratios.
The resolution of the 1.78:1 had no cropping applied or fancy resolution for hd or ntsc sd dvd. So I used the code in post five, section 1. Spline36Resize(848,480) Spline36Resize(1024,576) I read these resolutions were for 16:9 online somewhere. So I decided that doubling them would be a good idea then somebody here said doubling them still kept the 1.78:1 aspect ratio but at hd, or square pixels. So I asked him or somebody for the non-square pixel version.
__________________
When I get tired during work with dvd stuff i think of River Tamm (Summer Glau's character). And the beauty that is Serenity. |
25th June 2009, 15:08 | #12 | Link |
Compiling Encoder
Join Date: Jan 2007
Posts: 1,348
|
NTSC dvds are 720x480, so doubling that gets you 1440x960.
both resolutions need a pixel stretch of 32:27 to get 16:9 AR which you add in the encoder/muxer options. the actual display resolutions at the 32:27 pixel stretch are 853(+1/3)x480 and 1706(+2/3)x960 respectively PAL dvds are 720x576 iirc, so doubling that gets you 1440x1152. both resolutions need a pixel stretch of 64:45 to get 16:9 AR (which again you add in the encoder/muxer options). the actual display resolutions at the 64:45 pixel stretch are 1024x576 and 2048x1152 respectively |
25th June 2009, 15:13 | #13 | Link |
Registered User
Join Date: Dec 2002
Location: UK
Posts: 1,673
|
I might be being incredibly thick, but I don't think that told us what you are trying to do.
I was expecting an answer like: I'm trying to burn them to DVD, I'm trying to upscale them and put them on BluRay, I'm trying to watch them at optimum quality on my PC, I'm trying to upload to YouTube HD - you know, something like that! For as much as you've asked, kemuri-_9 has answered - I just don't understand why you'd want to do this. Cheers, David. |
26th June 2009, 02:02 | #14 | Link |
Didée Fan
Join Date: Feb 2006
Location: Canada
Posts: 1,079
|
What am I trying to do?
I said that ripbot264 showed the crop and resize values for these: sd dvd: ntsc, pal. HD: 1080p, 720p I ran into a problem because for 1.78:1 sd dvd, ntsc. The values shown in ripbot264 were simple with no cropping so I didtrusted this and looked online for the info ripbot264 should have given me and couldn't find it, so I decided to ask here for that info. That's why I said sd dvd and 1080p. I'll try and figure out how to interprete kemuri's answer later. Edit, Where in megui do I set it to 32:27, 64:45? What is the sd dvd pal and ntsc sar for aspect ratios: 2.35:1, 2.40:1, 1.85:1 What is the sar for square pixel hd 1080p: 2.21:1, 1.78:1, 2.35:1, 2.40:1? I looked for a wiki for the answers but couldn't find one, so I'm hoping you may post the answers.
__________________
When I get tired during work with dvd stuff i think of River Tamm (Summer Glau's character). And the beauty that is Serenity. Last edited by Jeremy Duncan; 26th June 2009 at 02:17. |
26th June 2009, 03:26 | #15 | Link | |
Compiling Encoder
Join Date: Jan 2007
Posts: 1,348
|
I don't use meGUI, but there's either a specific section that deals with aspect ratio, or you add the proper parameter to the encoder command line.
Quote:
a ntsc dvd has a 720x480 resolution, which is an AR of 3:2 (3/2) PAL is 720x576, so its AR is 5:4 (5/4) take the desired display aspect ratio you want to calculate the pixel stretch for and divide it by the source AR: i.e. (16/9) / (3/2) = 32:27 (16/9) / (5/4) = 64:45 2.35 / (3/2) = 47:30 2.35 / (5/4) = 47:25 and so on... then naturally multiplying the width of the source aspect ratio by the pixel stretch gets you the display width: 720(x480) * 47/30 = 1128x480 720(x576) * 47/25 = 1353(+3/5)x576 which is what you would need to resize to for encoding as square pixels |
|
26th June 2009, 05:28 | #16 | Link | |
Didée Fan
Join Date: Feb 2006
Location: Canada
Posts: 1,079
|
Quote:
I wish I knew how to do what your asking me to do but that lesson is over my head...No way I'm going to get my answers doing that math on my own. I guess if I stared at it for a hour or so it would make sense but not just at looking at it. Could you do it for me please...?
__________________
When I get tired during work with dvd stuff i think of River Tamm (Summer Glau's character). And the beauty that is Serenity. |
|
26th June 2009, 09:35 | #17 | Link |
Registered User
Join Date: Apr 2008
Location: St. Petersburg, Russia
Posts: 334
|
It is much easier to understand and calculate outside the unnecessary 'square/non-square' theory with its PAR'/DAR's/SAR's.
1.When you read about 'square pixels' this means that (with the type of file in question, like avi, full-res. HDTV etc.) the aspect ratio of a picture is completely defined by pixel numbers stored for its horizontal/vertical dimensions and you can use those numbers to calculate it or set it in the file you create within that type. A pixel itself doesn't have any geometrical properties, it's an artificial assumption derived from properties of the whole picture. 2.When you read about 'non-square pixels' this means that in a particular type of file (e.g.MPEG2 for SD DVD, DV files from camera etc.) the stored pixel numbers don't represent at all the AR of the picture (AR here and below means the same as the often used DAR). In that case the AR is independently defined by a separate parameter stored in video file: the AR flag (in case of DVD there are just 2 standard values: 4:3 or 16:9). Those AR flags are followed by a player independently from ratio of the stored numbers (mpeg2 stored pixel numbers can be 720x480/576, 480x480/576 - SVCD, 544x480/576 - DVB; they all can be 16:9 by AR). In case 1 your resizing calculations are quite transparent. In case 2 they are as simple if the originally shot video is either 4:3 or 16:9 - then you resize what you have to the standard numbers like 720x480 (no matter what the ratio of those numbers is) and set one of those two AR versions in your encoder. That is what 2BDecided already explained in the beginning of the thread. In case original video is different from both 4:3 or 16:9 (like 2,35:1), you'll have to reduce image height + add horizontal borders inside a 720x480/576 image. This can be done using simple proportions known from primary school, still without involving tables of fractional numbers, PAR's etc. And you'll keep understanding what's happenning while you calculate it. E.g. for letterboxing a 2.35:1 image within 1.777:1, the new height will be: 480x1.777/2.35=363=~360 (it's a good rule to round it to a multiple of 8 or 16 when possible); then you add borders like 56+64 (mod 8). There can also be considerations for setting DVD image width 720 or 704 (with or without borders) but they don't have influence on the above image height calculation. |
26th June 2009, 15:49 | #18 | Link | |
Registered User
Join Date: Dec 2002
Location: UK
Posts: 1,673
|
I still don't get what you're trying to do (what's your intended output?), but anyway...
Quote:
The sample you posted had no black bars. It's 16x9. You want 16x9. So ripbot264 didn't want to crop it. Makes sense to me. Cheers, David. |
|
26th June 2009, 16:08 | #19 | Link | |
Avisynth language lover
Join Date: Dec 2007
Location: Spain
Posts: 3,431
|
Quote:
Once you understand how it works, you will be able to use that understanding in every future project you do (rather than just following a recipe). BTW like 2Bdecided, I don't get what you're trying to do either. |
|
26th June 2009, 21:00 | #20 | Link | |
Didée Fan
Join Date: Feb 2006
Location: Canada
Posts: 1,079
|
Quote:
I quoted your reply because I did not know this. Edit, You ask what my intended output is? It is a resolution at a aspect ratio, the file format is not important to me. I want to be able to rip a dvd, look at the chart i put together and get the correct cropping and resize to get the sd dvd at ntsc or pal. For instance. I chose sd dvd ntsc (720, 480) at 2.35 aspect in ripbot264 and it gave me this avisynth code: Crop(video,0,56,-0,-62) Spline36Resize(video,640,272) As you can see the resolution is different than 720x480. So there you go, get it yet? Gavino, I was going to devote some time to learning how to manually do the math, but now I see ripbot264 answers are correct then I don't need to do the work myself.
__________________
When I get tired during work with dvd stuff i think of River Tamm (Summer Glau's character). And the beauty that is Serenity. Last edited by Jeremy Duncan; 26th June 2009 at 22:10. |
|
Tags |
1.78;1, crop |
Thread Tools | Search this Thread |
Display Modes | |
|
|