Log in

View Full Version : calculating aspect ratio after crop


m3mbran3
2nd August 2009, 10:17
So I have a pretty simple problem, I'm just not sure what formula I should be using to solve it.

I have a 720x480 NTSC DVD with a 4:3 aspect ratio. Using ARS calculator it tells me that my SAR for x264 should be 8:9.

If I then crop the video to 704x480 I have changed my horizontal width by 2.22 %. This has changed my aspect ratio, I'm just not sure by how much or how to calculate it. If someone could help me out with that then I could calculate my new SAR value.

So I have original video
Pixel Frame Size: 720x480
Movie Aspect Ratio: 4:3
Aspect Ratio Signalling: 8:9

after crop
Pixel Frame Size: 704x480
Movie Aspect Ratio: ?
Aspect Ratio Signalling: ?

GodofaGap
2nd August 2009, 10:49
Cropping doesn't change the SAR value, as it defines the aspect ratio of one sample/pixel. If you'd resize the SAR value would have been different (but then the DAR doesn't change).

TinTime
2nd August 2009, 10:50
SAR remains the same regardless of what cropping you do. No formula required, it's still 8:9. The display aspect ratio is width * SAR / height.

However, just to through a small spanner in the works - according to this guide (http://lipas.uwasa.fi/~f76998/video/conversion/)the SAR for your DVD should be 4320:4739.

m3mbran3
2nd August 2009, 12:38
I know the SAR is 8:9 from my untouched source (720x480 @ 4/3). In megui it calculates the SAR for me of 10:11 after cropping (704x480). Should I be using 8:9 or 10:11 as my SAR? I know the difference is only less than 3% but I figure I should still get it right.

smok3
2nd August 2009, 14:20
there is nothing to calculate, just figure out what your original PAR/SAR is,

for example:
a. according to http://lipas.uwasa.fi/~f76998/video/conversion/#conversion_table
this would be 4320/4739
b. according to my calc (same value rounded to 3 decimals) it would be
911/1000

(SAR/PAR doesn't change with cropping)

medp7060
25th October 2009, 02:51
I have a 1280x720 HD ts stream and cropped to 932x712, DGAVCDecNV preview showed its SAR as 1:1, will a 704x400 be a correct rersising for 4:3 TV?

Keiyakusha
25th October 2009, 02:59
I have a 1280x720 HD ts stream and cropped to 932x712, DGAVCDecNV preview showed its SAR as 1:1, will a 704x400 be a correct rersising for 4:3 TV?

As you probably can see, 704x400 is almost 16x9. So no.

medp7060
25th October 2009, 09:40
I used Smok3's resizeCalc.php @http://resizecalc.somestuff.org/

The source clip was recorded as 1280x720 (16:9), so for PAR, I chose "PAL wide (702)|1.459". it was cropped to 932x712. since it is for 4:3 TV, so I use 704 as the target width and chose "PAL wide (702)|1.094" for the PAR. here is the result:

# resizeCalc Avisynth
# pixels = 281600, DAR error = 0.812
# Crop(Left, top, -right, -Bottom)
Crop(174,4,-174,-4) # 932(4px)x712(-8px)
LanczosResize(704,400) # (modw16,modh16)
# x264 --sar 217:200

Keiyakusha
25th October 2009, 14:38
You probably used it wrong. I don't see the reason why you need to choose "PAL wide (702)|1.459" when you have square pixels. Anyway you don't need calculator here. You also don't need to set such --sar in x264. Just crop and then resize to any 4x3 resolution you like.

medp7060
26th October 2009, 10:58
So just to be sure that I am doing it correctly:
Video dimensions = 720*480
PAR = 1.184722222
Screen/target dimensions =1440*900

The calculations:
new_width=video width*PAR=720*1.184722222=853
new_height=480
so now we have 853*480. We make the width equal to the screen width, calculate the ratio and use it to change the height
ratio = 1440/853 = 1.688159437
new_height2 = new_height*ratio = 480*1.688159437 = 810.31 = 810
So I should display the video at fullscreen at 1440*810 dimensions.

Is this correct?

In my case:
Video dimensions = 1280*720
PAR = 1:1
After cropping, Video dimensions = 932*712
Screen/target dimensions =704 * new_height

The calculations:

We make the width equal to 932, the ratio to be used to change the height:
ratio = 1280/720 = 16/9

Since the correct height = 932/(16/9)= 524.25, which is bigger than 712, so we keep the height 712 and calculate the correct width:

the correct width= 712*(16/9)= 1265.78

So pad 333.78 (1265.78-524.25) to make it 1265.78*712

Thyen the new_height will be calculated like this:

704/new_height = 1265.78/712

new_height = 396.0 or 400 (mod 16)

Is this correct?

smok3
26th October 2009, 12:23
I used Smok3's resizeCalc.php @http://resizecalc.somestuff.org/

The source clip was recorded as 1280x720 (16:9), so for PAR, I chose "PAL wide (702)|1.459". it was cropped to 932x712. since it is for 4:3 TV, so I use 704 as the target width and chose "PAL wide (702)|1.094" for the PAR. here is the result:

# resizeCalc Avisynth
# pixels = 281600, DAR error = 0.812
# Crop(Left, top, -right, -Bottom)
Crop(174,4,-174,-4) # 932(4px)x712(-8px)
LanczosResize(704,400) # (modw16,modh16)
# x264 --sar 217:200

i'd go for 4:3 pal of some sort in your case, example;
http://resizecalc.somestuff.org/index.php?ssmw=1280&sar=1&sar2=&ssmh=720&CT=4&CL=174&CR=174&CB=-4&mplayCrop=&trw=704&dar=1.06667&dar2=&modw=&modh=&padw=&padh=&css=&doit=true
(this should be valid input for mpeg2 dvd encoding imho)

Ghitulescu
26th October 2009, 13:37
It depends on your viewing target: TV (rectangular pixels ie PAR<>1) or PC (usually PAR = 1).

medp7060
27th October 2009, 07:25
Thank, Smok3.

Dogway
26th March 2010, 12:12
Sorry. Im having difficulties on calculating the par on my encoded video.

Source is NTSC 720x480 4:3

The content Im cropping to is an anamorphic 16:9 letterbox (thus making up the 4:3)
My cropped size is 702:364, and I am resizing it to 848x480. What PAR should I set it to?

I have tried many settings but couldnt come up with a solution.

b66pak
26th March 2010, 18:30
(702:364)xPAR=(16:9)

so your PAR (SAR) is (16:9)/(702:364)=1024:1053
_

Dogway
27th March 2010, 05:09
But the cropped is not 16/9 (its anamorphic),and Im cropping some pixels inside, so in fact what I really want to do is to extrapolate the expected local proportions, no matter what AR finally is. Like say, if this 4:3 is PAR x then the 16:9 should be PAR y, but I have cropped some pixels inside, so it is not 16:9 but almost.

I resized the cropped version with only visual accuracy (matching circles, etc) so you see what I mean. Although I would like to do this mathemathically and on display (AR)


http://img534.imageshack.us/img534/1227/trrj.th.jpg (http://img534.imageshack.us/i/trrj.jpg/) into this->http://img534.imageshack.us/img534/1805/46918658.th.jpg (http://img534.imageshack.us/i/46918658.jpg/)

I hope it makes sense

MatLz
27th March 2010, 11:18
I resized the cropped version with only visual accuracy (matching circles, etc)So why set a PAR if the proportions are correct?
Edit: or if you keep 702x364, par should be 229:250 to matche with the ar of your 'correct ar resizing'

b66pak
27th March 2010, 18:37
@Dogway ok i get it...

your source is 720x480 (4:3) which mean:

(720:480)x(PAR 8:9)=(4:3) witch is DAR=(720:540) with (PAR 1:1) or DAR=(640:480) with (PAR 1:1) depending on what player you use...

by cropping you don't change the PAR (SAR)! so you have:

(702:364)x(PAR 8:9)=(468:273) witch is DAR=(702:409[.5]) with (PAR 1:1) or DAR=(624:364) with (PAR 1:1) depending on what player you use...this is exact 1.714285 but you need (848x480)...so:

(468:273)x(new PAR)=(848:480) so your PAR is (848:480)/(468:273)=371:360


here is a formula:

croped Resolution x source PAR = new DAR

new DAR x new PAR = final DAR


new PAR = (final DAR)/(croped Resolution x source PAR)
_

Dogway
28th March 2010, 00:33
It doesnt output the same proportions as my example,also does it have in count the anamorphic? strangely the 1024:1053 gave me a convincing look (round circles...), but I think that with an unoticeable error of the cropped pixels.
But I wanted to say my thoughts are wrong, the content by being anamorphic+cropped in theres no way to calculate the PAR. But Im still trying to prove it wrong.

I came up with this, which is not exactly the expected but near:
cropped*Or.PAR = Target*(desiredPAR*CorrectionRATIO)
(702/364)*(4320/4739)=(848/480)*(32/27*CorrectionRATIO)

New PAR=(32/27*Correction)=199:200

This is no correct too because circles are still flattened, but you can see my thinking.

I simplified your concept to compare it better (result remains the same):
(702:364)x(PAR 8:9)*newPAR=848:480
The difference with mine is that Im multiplying the NewPAR with the target Resolution, and the NewPAR itself is a multiply between the ideal 16:9 and its correction ratio (due to pixel cropping)

EDIT: I got it:

720/480 * 8/9 = 702/364 * new par
new par = 0.6913
Problem comes here if 702/364 = PAR 0.6913 then 848/480 = PAR ? I cant make an expression with this, I dont know how to extrapolate this.

EDIT2: I overthought, the formula is almost the same one I had been using before posting here:
((702/364)*(8/9))/(848/480)=new par
((source.taggedAR)*(cropped.Res))/(target.Res)=new par

Its almost as you firstly said:
1024:1053(0.9724) vs the 97:100 (0.97035) I get from this last formula.

I only have one last question, in what cases should I use 10:11, 8:9 and 4320/4739?

Guidance

Algebra Calculator
So you put your values into the formula and paste it here:
http://easycalculation.com/expression.php

Decimal to Fraction
Then you take your value (round it if you want), and put it here to get the fraction:
http://webmath.com/dec2fract.html


EDIT: No more software, nor headaches. I have used it since this post in 3 works and worked great, just be sure what your original source PAR is.