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.

 Doom9's Forum How to calculate resize dimensions
 Register FAQ Calendar Search Today's Posts Mark Forums Read

 23rd January 2021, 11:31 #1  |  Link sugargenius Registered User   Join Date: Oct 2007 Posts: 10 How to calculate resize dimensions When ripping a dvd, I am always confused about the "correct" dimensions for resizing. Here's what I currently do:Open a vob in mpc Take screenshot Crop black bars Calculate AR Compare to IMDB 95% of the time my calculated AR and IMDB match. That's what I input into Megui for DAR. However, I never can make sense of the resize dimensions that Megui's avisynth editor comes up with. I'll use The Mask as an example. The source is non-anamorphic, 480p dvd. After ripping, I load the dvi into Megui and change the DAR from itu 16:9 (1.823169) to 1.85. I crop 6 from the top and 12 from the bottom. Megui comes up with a resize dimensions of 720x376 yielding an AR of 1.915 and AR error of -0.37378%. My question is, why not use 720x392 (AR 1.84)? That seems a lot closer to how the movie was shot. For a 1.85 non-anamorphic dvd, shouldn't I always use 720x392? The situation I could see using another resize would be if more than combined 88 pixels cropped from top/bottom (480-88=392) as that would imply "upscaling" the vertical. Obviously the megui author knows a million times more than me regarding video, so I am sure my logic is flawed somehow. I would just like to know how and what is the "correct" way to arrive at a resize given AR and crop.
23rd January 2021, 15:44   #2  |  Link
Sharc
Registered User

Join Date: May 2006
Posts: 3,851
Quote:
 Originally Posted by sugargenius The source is non-anamorphic, 480p dvd.
Really? All DVD sources are anamorphic, i.e. non-square pixel.

Secondly, your very asymmetric top/bottom cropping looks a bit unusual to me for a 1.85 movie.
Did you set some 'mod' constraint in your GUI for cropping/resizing?

 23rd January 2021, 19:45 #3  |  Link sugargenius Registered User   Join Date: Oct 2007 Posts: 10 Here's before cropping Here's after cropping
 24th January 2021, 15:28 #4  |  Link Sharc Registered User   Join Date: May 2006 Posts: 3,851 Where is here?
 24th January 2021, 19:24 #5  |  Link StainlessS HeartlessS Usurer     Join Date: Dec 2009 Location: Over the rainbow Posts: 9,486 sugargenius, Your before cropping and after cropping look very similar Is this of any help, [From here:- https://forum.doom9.org/showthread.p...93#post1576193 ] Avisynth Script: Code: ```# Based on MEGUI WIKI : http://mewiki.project357.com/wiki/MeGUI/Aspect_Ratio_Signalling_in_AviSynth_Scripts # # SAR=Sample ie pixel Aspect Ratio. FAR=Frame Aspect Ratio (width/height). DAR=Aspect Ratio for Display. ColorBars().ConvertToYV12().Trim(0,300) # 640x480 DAR = 16.0/9.0 # Pretend (FULL FRAME) DAR = 16/9 (Choose your variety of poison) SAR = getSAR(DAR) # Calc SAR, no change when cropping. #Crop(20,20,-20,-20) # We dont want to change DAR here, just testing if MEGUI actually sets 16:9 Aspect ratio correctly. NewDAR = getDAR(SAR) # Calc new DAR after crop and before Resize. DAR no change when resizing. LanczosResize(200,300) # Test to see if MEGUI sets DAR 16:9. (FAR = tall and skinny, MEGUI should set DAR=16:9 ie short and fat) SignalDAR(NewDAR) # Signal DAR to MeGUI : EDIT: Change Name to SignalDAR (From SetDar) return last Function GetDAR(clip c, float SAR) { return Float(c.width) * SAR / Float(c.height)} # Gets the DAR from the SAR Function GetSAR(clip c, float DAR) { return DAR * Float(c.height) / Float(c.width) } # Gets the SAR from the DAR Function SignalDAR(float DAR) { global MeGUI_darx = Round(1000 * DAR) global MeGUI_dary = 1000 } # Signals DAR for MEGUI``` Code: `DAR = 16.0/9.0 # Pretend (FULL FRAME) DAR = 16/9 (Choose your variety of poison)` Above DAR is usually 16/9 or 4/3 frame, is for FULL FRAME including letterboxing. Code: `SAR = getSAR(DAR) # Calc SAR, no change when cropping.` Above is sample(pixel) aspect ratio. Code: ```#Crop(20,20,-20,-20) # We dont want to change DAR here, just testing if MEGUI actually sets 16:9 Aspect ratio correctly. NewDAR = getDAR(SAR) # Calc new DAR after crop and before Resize. DAR no change when resizing.``` Above, after cropping, SAR is still sample/pixel aspect ratio, so is not changed. Then get new 'Presentation' DAR as it should be after crop, and used via MeGUI. EDIT: If Interlaced, Can only crop top and bottom in multiples of 4 when YV12, or Multiples of 2 if other colorspace. EDIT: Code: ` DAR = FAR * SAR ::: FAR = DAR / SAR ::: SAR = DAR / FAR` __________________ I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 24th January 2021 at 19:30.
24th January 2021, 23:12   #6  |  Link
SeeMoreDigital
Registered User

Join Date: Jun 2003
Location: Notts, UK
Posts: 11,914
Quote:
 Originally Posted by sugargenius When ripping a dvd, I am always confused about the "correct" dimensions for resizing....
Why are you bothering to re-encode them. Why not keep the original MPEG-2 video stream?

Nowadays HDD's are cheap and offer huge capacities!
__________________
| I've been testing hardware media playback devices and software A/V encoders and decoders since 2001 | My Network Layout & A/V Gear |

 25th January 2021, 12:55 #7  |  Link Sharc Registered User   Join Date: May 2006 Posts: 3,851 @sugargenius: Not having seen your source, my best guess from your description would be: 1. The source is "480p DVD" with movie content, hence it is most probably an NTSC DVD with DAR 16:9 2. All DVD video is anamorphic by the DVD standard, there is no "non-anamorphic 480p DVD" 3. As the content seems to be a movie (The Mask) it is most likely progressive video 4. According to IMDB the movie has an aspect ratio of 1.85. Assuming 1. is true, one would expect a frame size of 720x480 with top and bottom black bars of about 10 pixels each. After cropping, the cropped frame without borders has a size of 720x(480-20) = 720x460. It is still anamorphic with a PAR (Pixel Aspect Ratio) of 32:27=1.1852 (or a value close to it, acc. DVD or mpeg2 spec.). 5. 720x460 can be horizontally resized to 854x460 or vertically to 720x388 for square pixels (PAR 1:1) => 854/460=720/388=1.85. Above explains the basic steps (independent of any GUI) based on some assumptions(!) about your source. (MeGUI may round a bit differently due to mod constraints.) For better advice you would have to upload a sample. Last edited by Sharc; 25th January 2021 at 13:14.
25th January 2021, 13:47   #8  |  Link
sugargenius
Registered User

Join Date: Oct 2007
Posts: 10
Quote:
 Originally Posted by Sharc Where is here?
Here are the url for screenshots. I guess they got stripped out due to my post count?

https://ibb.co/MGQDZMp

https://ibb.co/Hg1GBSn

 25th January 2021, 14:29 #9  |  Link Sharc Registered User   Join Date: May 2006 Posts: 3,851 It's exactly as I assumed. Nothing unusual. MeGUI just shows the anamorphic source, original and cropped. Someone who knows MeGUI may chime in and explain how it is supposed to resize with which settings, tickmarks and options .....
25th January 2021, 20:18   #10  |  Link
manolito
Registered User

Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,008
Quote:
 Originally Posted by Sharc 2. All DVD video is anamorphic by the DVD standard, there is no "non-anamorphic 480p DVD"
WHAT ????

I think you are a bit confused about the DVD standard. Of course DVDs do not use square pixels, but this has nothing to do with anamorphic vs. non-anamorphic.

MPEG2 clips can be either flagged as 4:3 (non-anamorphic) or 16:9 (anamorphic). For 16:9 content it makes sense to encode the movie to anamorphic because you do not sacrifice vertical resolution. But for 4:3 content it does not make sense at all to encode it to 16:9 anamorphic.

I suggest you take some time to google for "anamorphic vs. non-anamorphic DVDs".

 25th January 2021, 21:11 #11  |  Link SeeMoreDigital Registered User     Join Date: Jun 2003 Location: Notts, UK Posts: 11,914 Sharc is correct. Any image that requires correcting in order for it to be viewed at the proper shape is by virtue...'anamorphic'. __________________ | I've been testing hardware media playback devices and software A/V encoders and decoders since 2001 | My Network Layout & A/V Gear |
 25th January 2021, 22:02 #12  |  Link Sharc Registered User   Join Date: May 2006 Posts: 3,851 It's a common misconception that someone once started to call 4:3 DVDs "non-anamorphic" and 16:9 DVDs "anamorphic. All non-square pixel formats are "anamorphic", by definition.
 25th January 2021, 23:10 #13  |  Link SeeMoreDigital Registered User     Join Date: Jun 2003 Location: Notts, UK Posts: 11,914 Indeed __________________ | I've been testing hardware media playback devices and software A/V encoders and decoders since 2001 | My Network Layout & A/V Gear |
25th January 2021, 23:31   #14  |  Link
manolito
Registered User

Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,008
Quote:
 Originally Posted by Sharc It's a common misconception that someone once started to call 4:3 DVDs "non-anamorphic" and 16:9 DVDs "anamorphic. All non-square pixel formats are "anamorphic", by definition.
I think that the misconception lies at your end...

https://www.pcmag.com/encyclopedia/term/anamorphic-dvd
https://en.wikipedia.org/wiki/Anamorphic_widescreen
http://thedigitalbits.com/featured/g...d-for-everyone
http://invisionsvc.com/Services/Proj...namorphic.html

The term "Anamorphic" originates from the anamorphic lenses which were used in film cameras to make it possible to film widescreen movies on traditional 4:3 film material. For DVDs this term has a special meaning, and with the exception of you guys everybody else has agreed on what an anamorphic DVD is. To say that all non-square pixel formats are anamorphic by definition is just ridiculous...

 25th January 2021, 23:40 #15  |  Link SeeMoreDigital Registered User     Join Date: Jun 2003 Location: Notts, UK Posts: 11,914 The term 'anamorphic' is not solely related to lenses. It's way older than that! Anamorphosis... __________________ | I've been testing hardware media playback devices and software A/V encoders and decoders since 2001 | My Network Layout & A/V Gear | Last edited by SeeMoreDigital; 25th January 2021 at 23:42.
 26th January 2021, 02:11 #16  |  Link Asmodian Registered User   Join Date: Feb 2002 Location: San Jose, California Posts: 4,262 In this context I always use 'anamorphic' as meaning 'non-square pixels'. If it is a dichotomy between anamorphic or not anamorphic then this seems like the only useful definition, otherwise how do you describe square pixels? __________________ madVR options explained
 26th January 2021, 10:42 #17  |  Link hello_hello Registered User   Join Date: Mar 2011 Posts: 4,520 It's the industry that decided to call 16:9 DVDs "Widescreen Anamorphic" to differentiate them from "Full Screen" 4:3 DVDs, which filled the screen when CRTs ruled the world. If the definition of anamorphic is anything with non-square pixels, then they're all anamorphic. The dictionary definition of anamorphic. https://www.merriam-webster.com/dictionary/anamorphic producing, relating to, or marked by intentional distortion (as by unequal magnification along perpendicular axes) of an image
26th January 2021, 11:35   #18  |  Link
hello_hello
Registered User

Join Date: Mar 2011
Posts: 4,520
Quote:
 Originally Posted by sugargenius When ripping a dvd, I am always confused about the "correct" dimensions for resizing. Here's what I currently do:Open a vob in mpc Take screenshot Crop black bars Calculate AR Compare to IMDB
Don't do any of that. There's no guarantee the picture hasn't been cropped a little and has the exact aspect ratio as the "official" one. Plus MPC=HC always resizes to exactly 16:9 or 4:3, but the DVD could use an ITU/mpeg4 DAR which is a little wider (ITU and mpeg4 are virtually the same).

Quote:
 Originally Posted by sugargenius I'll use The Mask as an example. The source is non-anamorphic, 480p dvd. After ripping, I load the dvi into Megui and change the DAR from itu 16:9 (1.823169) to 1.85.
Don't do that. It's the Input DAR and there can only be two choices for a 16:9 DVD. ITU or exact 16:9. For newer 16:9 DVDs choose the latter. The DVD is anamorphic.

Quote:
 Originally Posted by sugargenius I crop 6 from the top and 12 from the bottom. Megui comes up with a resize dimensions of 720x376 yielding an AR of 1.915 and AR error of -0.37378%. My question is, why not use 720x392 (AR 1.84)? That seems a lot closer to how the movie was shot. For a 1.85 non-anamorphic dvd, shouldn't I always use 720x392? The situation I could see using another resize would be if more than combined 88 pixels cropped from top/bottom (480-88=392) as that would imply "upscaling" the vertical.
I had to crop a couple of extra pixels from the top to minimise aspect error, but it's very close to 1.85. Set the mod option to mod4 rather than mod8 for more accurate resizing.

Resizing the width up instead of reducing the height for maximum detail. It's mental it's disabled by default.

480 x (16/9) = 853.33 (resized to square pixel dimensions - 853.33 x 480)
853.33 / 460 (after cropping) = 1.85507
There's a very small aspect error when resizing.
852 / 460 = 1.85217
720 / 388 = 1.85567

You can also play with this function. I often crop with MeGUI, then remove MeGUI's cropping from the script and use the same cropping for CropResize. If you specify the correct input DAR for CropResize there can never be any aspect error, as it crops to prevent it if necessary.

MeGUI's ITU Input DAR's are possibly a little off. It uses the second lot of ITU (almost exact) pixel aspect ratios in the table I've linked to below as the basis for it's ITU DARs. I create two custom Input DARs of 20:11 and 15:11. They're the mpeg4 DARs. My rule of thumb is always use 15:11 for 4:3 DVDs, 20:11 for older 16:9 DVDs, and 16:9 for newer 16:9 DVDs.

This post provides tables of the possible sample/pixel aspect ratios. For the mpeg4 sample/pixel aspect ratios, they work out to a display aspect ratio of 20:11 for both NTSC and PAL 16:9 DVDs, and 15:11 for 4:3 DVDs.
The generic pixel/sample aspect ratios give you exactly 16:9 and 4:3.

Last edited by hello_hello; 26th January 2021 at 19:25.

26th January 2021, 20:02   #19  |  Link
manolito
Registered User

Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,008
Quote:
 Originally Posted by hello_hello It's the industry that decided to call 16:9 DVDs "Widescreen Anamorphic" to differentiate them from "Full Screen" 4:3 DVDs, which filled the screen when CRTs ruled the world. If the definition of anamorphic is anything with non-square pixels, then they're all anamorphic.
Exactly, and this definition is what I grew up with. To me in the context of DVDs Anamorphic means "Widescreen Anamorphic". And this is clearly what the OP referred to when he said:
Quote:
 The source is non-anamorphic, 480p dvd

26th January 2021, 20:14   #20  |  Link
manono
Moderator

Join Date: Oct 2001
Location: Hawaii
Posts: 7,395
Quote:
Originally Posted by manolito
Exactly, and this definition is what I grew up with. To me in the context of DVDs Anamorphic means "Widescreen Anamorphic". And this is clearly what the OP referred to when he said:
Quote:
 The source is non-anamorphic, 480p dvd
I'm not sure why you're so adamant about this. We all understood what he meant, even if he wrote it incorrectly. Then he was corrected. Maybe what he should have written was:
Quote:
 The source is a 4:3, 480p dvd
Except, looking at the picture it seems to be 16:9, so what he wrote about it as being non-anamorphic now seems nonsensical.

Last edited by manono; 26th January 2021 at 20:31.