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.

 

Go Back   Doom9's Forum > Video Encoding > MPEG-4 AVC / H.264

Reply
 
Thread Tools Search this Thread Display Modes
Old 1st February 2006, 04:52   #1  |  Link
kotrtim
Registered User
 
Join Date: Dec 2005
Posts: 145
Sample Aspect Ratio calcutions

Source/Encoded Resolution ( X:Y )
Desired Display Resolution/Aspect Ratio ( H:V )

The formula to calculate PAR/SAR

Y ÷ X ÷ V x H = SAR fraction

for example a NTSC 16:9 with resolution 720:480

480 ÷ 720 ÷ 9 x 16 = 1.185185185... (32/27)
therefore the Sample Aspect Ratio that should be keyed in in MeGUI is 32x27

for NTSC 4:3 with resolution 704:480
480 ÷ 704 ÷ 3 x 4 = 0.88888...(10/11)
SAR = 10x11

CROPPING without resizing
won't affect the SAR

Any comments on the way I calculate SAR?
I took quite some time to understand that
SAR is actually the ratio of every single pixel..not
the ratio displayed by the video frame
kotrtim is offline   Reply With Quote
Old 1st February 2006, 10:28   #2  |  Link
yaz
n00b ever
 
Join Date: May 2002
Posts: 627
@kotrtim
the way u derive (s)ar is ok but why do u use different vertical resolutions for the 4/3 and for the 16/9 streams. maybe it's ok (i'm living in the pal world ) just ask.

however, the values calculated
Code:
- for ntsc 720 x 
4:3        64:72 (8:9)
16:9       64:54 (32:27)
- for ntsc 704 x
4:3        10:11
16:9       16:11
the bests
y

Last edited by yaz; 1st February 2006 at 10:31.
yaz is offline   Reply With Quote
Old 2nd February 2006, 20:57   #3  |  Link
Raithmir
Registered User
 
Join Date: Dec 2003
Posts: 51
Cropping will change the SAR, at least thats what I was told in the similar thread I posted. This comment might be of use, I saved it and use this calculation...

"The actual way meGUI calculates the SAR is as follows:
1) Apply the cropping and then determine the aspect ratio of the input video image (inputPixelCountRatio).
2) Scale the vertical resolution according to the horizontal resolution that's been specified (resizedVerticalResolution = horizontalResolution / inputPixelCountRatio)
3) Adjust the vertical resolution so that it matches the closest multiple of 16.
4) Set SARX to the horizontal resolution.
5) Set SARY to Round(HorizontalResolution^2 / (VerticalResolution * DAR)), this is then truncated to an integer."

So if you're not resizing you can ignore 1-3 and use the horizontal and vertical resolution after you've cropped.

Last edited by Raithmir; 2nd February 2006 at 21:04.
Raithmir is offline   Reply With Quote
Old 2nd February 2006, 21:03   #4  |  Link
Raithmir
Registered User
 
Join Date: Dec 2003
Posts: 51
http://forum.doom9.org/showthread.php?t=104485

Some confusing information at first but read the whole thread.

No doubt someone else will come along and tell me it's all wrong and I'm doing it incorrectly again.
Raithmir is offline   Reply With Quote
Old 3rd February 2006, 05:06   #5  |  Link
kotrtim
Registered User
 
Join Date: Dec 2005
Posts: 145
My opinion is SAR won't change after cropping as you crop off pixels, and SAR is the ratio of every pixel, so the value of SAR should not change whereas the DAR will change as DAR is the measurement of the whole frame, when you croped, the frame size definitely changes.

If we want to resize, why not just resize so that it is 1:1, of course this is just my opinion
kotrtim is offline   Reply With Quote
Old 3rd February 2006, 06:41   #6  |  Link
bkman
Registered User
 
Join Date: Jan 2006
Posts: 294
Quote:
Originally Posted by kotrtim
My opinion is SAR won't change after cropping as you crop off pixels, and SAR is the ratio of every pixel, so the value of SAR should not change whereas the DAR will change as DAR is the measurement of the whole frame, when you croped, the frame size definitely changes.
For me this brings up the question of what is the true DAR of a DVD source. Ie. If you have what used to be a T.V. program, which as we know is 4:3 (right?), but it has black bars on the side and the resulting AR after cropping them off is not 4:3, what do you do then? Use the bar-less DAR when calculating the SAR, or use the DAR with bars included, or just use the 4:3 DAR that you know it must be as a T.V. source? Quite confusing. For that matter, how is 720x480 4:3??
bkman is offline   Reply With Quote
Old 3rd February 2006, 12:02   #7  |  Link
yaz
n00b ever
 
Join Date: May 2002
Posts: 627
cropping does not change the way of derivation (resizing). if u crop the stream (sar) u 'crop' also what u get on the display (dar). u'd better think of it as 'how to distort each pixel so as to get the right aspect ratio on the display'.

say, u got a pal 4:3 dvd. its stream size is 720x576 (by def) which is 5/4 ratio. it must be displayed 4/3 so as to get the correct ratio on the display, so, it must be resized to 768x576. it is the same as displaying each pixel in a 16x15 rectangle instead of a 15x15 square (measured in whatever unit).
if u crop it to 704x576 (for any reason) it must be resized the same way, so the display size must be ~751x576. otherwise the picture on the display will be distorted.

it's simple as that

the bests
y
yaz is offline   Reply With Quote
Old 3rd February 2006, 12:29   #8  |  Link
bkman
Registered User
 
Join Date: Jan 2006
Posts: 294
But why is it that the "true" DAR includes black bars? Surely they are not part of the actual image, and it should be resized to 4:3 without them. Like if you cropped to 704x576 to give the full image, shouldn't that then be resized to 768x576 (instead of 751x as with counting the black bars) to give proper AR since the original T.V. show was 4:3 (and had no black bars originally)?
bkman is offline   Reply With Quote
Old 4th February 2006, 22:34   #9  |  Link
DigitalDivide
Registered User
 
Join Date: Jul 2005
Posts: 240
Not being the best at math, is there any easy way to work out the lowest common denominator? Is it possible to enter in 1920:2112 as the SAR in MeGUI or must I absolutely break it down further?
__________________
Toronto,ON
DigitalDivide is offline   Reply With Quote
Old 4th February 2006, 22:50   #10  |  Link
DigitalDivide
Registered User
 
Join Date: Jul 2005
Posts: 240
So for my 2.35 NTSC DVD
after cropping
47 368 17296
-- x --- = ----- which breaks down to ? This us entered as SAR in MeGUI
20 704 14080

Is this correct?
__________________
Toronto,ON
DigitalDivide is offline   Reply With Quote
Old 5th February 2006, 00:50   #11  |  Link
SeeMoreDigital
Life's clearer in 4K UHD
 
SeeMoreDigital's Avatar
 
Join Date: Jun 2003
Location: Notts, UK
Posts: 12,219
Quote:
Originally Posted by DigitalDivide
So for my 2.35 NTSC DVD
after cropping
47 368 17296
-- x --- = ----- which breaks down to? This us entered as SAR in MeGUI
20 704 14080

Is this correct?
Yes... Initially this would provide an ARS of 1081:880.

However, this could be further converted to say: -
Code:
1080                             27
---- which, in turn decimates to --
 880                             22
That said, 199:162 would be more exact


Cheers
__________________
| 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; 5th February 2006 at 01:05.
SeeMoreDigital is offline   Reply With Quote
Old 5th February 2006, 18:00   #12  |  Link
DigitalDivide
Registered User
 
Join Date: Jul 2005
Posts: 240
Quote:
Originally Posted by SeeMoreDigital
Yes... Initially this would provide an ARS of 1081:880.

However, this could be further converted to say: -
Code:
1080                             27
---- which, in turn decimates to --
 880                             22
That said, 199:162 would be more exact


Cheers
SMD,

Is there a formula as to how to work out the lowest common den? Is it just guess work with a calculator? Give me something to go on..lol
__________________
Toronto,ON
DigitalDivide is offline   Reply With Quote
Old 5th February 2006, 18:17   #13  |  Link
SeeMoreDigital
Life's clearer in 4K UHD
 
SeeMoreDigital's Avatar
 
Join Date: Jun 2003
Location: Notts, UK
Posts: 12,219
Quote:
Originally Posted by DigitalDivide
SMD,

Is there a formula as to how to work out the lowest common den? Is it just guess work with a calculator? Give me something to go on..lol
I use a Sharp EL-530V calculator to work out and simplify all these fractions.... But I'm thinking about developing a little "ARS Calculator" tool... Something like this: -




EDIT: Here's a 2.35:1 video sample, with a pixel frame size of 704x368 and aspect ratio sigalling at 199:162.


Cheers
__________________
| 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; 5th February 2006 at 22:33.
SeeMoreDigital is offline   Reply With Quote
Old 5th February 2006, 18:53   #14  |  Link
DigitalDivide
Registered User
 
Join Date: Jul 2005
Posts: 240
You should definitely create that ARS calculator. It would definitely help a lot and I'm sure everyone would appreciate it.
__________________
Toronto,ON
DigitalDivide is offline   Reply With Quote
Old 6th February 2006, 02:37   #15  |  Link
iceborne
Registered User
 
iceborne's Avatar
 
Join Date: Aug 2003
Posts: 43
i second that
iceborne is offline   Reply With Quote
Old 6th February 2006, 10:43   #16  |  Link
Wilbert
Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 6,364
SMD likes to stick to non-standard terminology. I think his MAR is the playback AR (after cropping away the black borders). If that's the case, than in many cases you don't know the MAR in advance, unless it is specified on the box of the dvd.
Wilbert is offline   Reply With Quote
Old 6th February 2006, 19:09   #17  |  Link
SeeMoreDigital
Life's clearer in 4K UHD
 
SeeMoreDigital's Avatar
 
Join Date: Jun 2003
Location: Notts, UK
Posts: 12,219
Quote:
Originally Posted by Wilbert
SMD likes to stick to non-standard terminology. I think his MAR is the playback AR (after cropping away the black borders). If that's the case, than in many cases you don't know the MAR in advance, unless it is specified on the box of the dvd.
Yes.... MAR (Movie Aspect Ratio) is the term I'm proposing we adopt to refer to the aspect ratio of the original source.

After looking at the back of a few DVD cases I've found several other expressions, such as: Original Theatrical Presentation, Original Theatrical Exhibition, Presented in x.xx:x, TV Aspect Ratio.


Cheers
__________________
| I've been testing hardware media playback devices and software A/V encoders and decoders since 2001 | My Network Layout & A/V Gear |
SeeMoreDigital is offline   Reply With Quote
Old 8th February 2006, 11:40   #18  |  Link
Seb.26
20-35 a win for Revolver.
 
Seb.26's Avatar
 
Join Date: Mar 2004
Location: FR.26
Posts: 221
Hum ... long & interesting post !

so I've a question : is my way is right or fully ...bad... ?

My way :

For both PAL and NTSC DVD, I just crop up and bottom ( if side borders are not too large ) ... never resize !

And I know :
> PAL : 720*576 -> 1024*576
> NTSC : 720*480 -> 854*480

So if my cropped frame is 720*416 (PAL) for exemple , my AR in MkvMergeGui is 1024*416 ...

is it right or not ?!

Thanks everybody
Seb.26 is offline   Reply With Quote
Old 8th February 2006, 11:47   #19  |  Link
SeeMoreDigital
Life's clearer in 4K UHD
 
SeeMoreDigital's Avatar
 
Join Date: Jun 2003
Location: Notts, UK
Posts: 12,219
If we are not following the ITU specification to the letter, which most (if not all) software players, don't appear to follow.... then the answer is yes
__________________
| I've been testing hardware media playback devices and software A/V encoders and decoders since 2001 | My Network Layout & A/V Gear |
SeeMoreDigital is offline   Reply With Quote
Old 8th February 2006, 11:55   #20  |  Link
Seb.26
20-35 a win for Revolver.
 
Seb.26's Avatar
 
Join Date: Mar 2004
Location: FR.26
Posts: 221
Quote:
Originally Posted by SeeMoreDigital
If we are not following the ITU specification to the letter[...]
Please : Where could I read some papers about that ? ... I don't know what is it
[Edit] -> I will read all on your www ... it looks great !

Quote:
Originally Posted by SeeMoreDigital
[...] then the answer is yes
Ok, so I'm not fully idiot ...

My way looks really simple beside all your heavy-sci-math-computing

So if I'm wrong for 1 ou 2 pixels in height ... what the matter ?!

Thanks for answer SeeMoreDigital !
( from where is your avatar ? a movie, but which ? )

Last edited by Seb.26; 8th February 2006 at 12:06.
Seb.26 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 00:37.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.