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 Sample Aspect Ratio calcutions
 User Name Remember Me? Password
 Register FAQ Calendar Search Today's Posts Mark Forums Read

 Thread Tools Search this Thread Display Modes
 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
 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.
 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.
 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.
 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
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??

 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
 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)?
 3rd February 2006, 13:33 #9  |  Link SeeMoreDigital Life looks better in UHD     Join Date: Jun 2003 Location: Notts, UK Posts: 11,754 If you can guys, try and calculate "everything" as a fraction, because converting fractions to decimals and back to fractions again "can" produce conflicting Aspect Ratio Signalling (ARS) values. If your NTSC movie has an aspect ratio of 1.33:1, then this can be represented as a fraction of 4/3. Meaning: - Code: ```4 480 1920 8 - x --- = ---- lowest dominator - Giving an ARS value of 8:9 3 720 2160 9``` If your NTSC movie has an aspect ratio of 1.77:1, then this can be represented as a fraction of 16/9. Meaning: - Code: ```16 480 7680 32 -- x --- = ---- lowest dominator -- Giving an ARS value of 32:27 9 720 6480 27``` If your NTSC movie has an aspect ratio of 1.85:1, then this can be represented as a fraction of 37/20. Meaning: - Code: ```37 480 17760 37 -- x --- = ----- lowest dominator -- Giving an ARS value of 37:30 20 720 14400 30``` If your NTSC movie has an aspect ratio of 2.35:1, then this can be represented as a fraction of 47/20. Meaning: - Code: ```47 480 22560 47 -- x --- = ----- lowest dominator -- Giving an ARS value of 47:30 20 720 14400 30``` If your NTSC movie has an aspect ratio of 2.40:1, then this can be represented as a fraction of 12/5. Meaning: - Code: ```12 480 5760 8 -- x --- = ---- lowest dominator - Giving an ARS value of 8:5 5 720 3600 5``` For working out the "Aspect Ratio Signalling" values of PAL sources, simply substitute 480/720 to 576/720 and recalculate. The same formula can be used to work out the "Aspect Ratio Signalling" values of cropped and re-sized encodes too by entering the relevant resolutions. 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; 3rd February 2006 at 16:01.
3rd February 2006, 14:07   #10  |  Link
bkman
Registered User

Join Date: Jan 2006
Posts: 294
Quote:
 Originally Posted by SeeMoreDigital The same formula can be used to work out the "Aspect Ratio Signalling" values of cropped and re-sized encodes too by entering the relevant resolutions.
See, that is what I have been doing, but what yaz says seems to contradict this.

So that is the question that I haven't seen everyone agree upon: If you have a movie/show that you "know" the aspect ratio of (16:9, 4:3, etc) but it has black bars which need to be cropped, do you a.) Use the cropped size in your SAR calculation, or b.) Use the original size before cropping?

3rd February 2006, 14:43   #11  |  Link
SeeMoreDigital
Life looks better in UHD

Join Date: Jun 2003
Location: Notts, UK
Posts: 11,754
Quote:
 Originally Posted by bkman So that is the question that I haven't seen everyone agree upon: If you have a movie/show that you "know" the aspect ratio of (16:9, 4:3, etc) but it has black bars which need to be cropped, do you a.) Use the cropped size in your SAR calculation, or b.) Use the original size before cropping?
What I do is establish the aspect ratio of the source movie. The popular "Movie Aspect Ratio's" (MAR's) are, 1.85:1, 2.35:1, 2.40:1

All MAR's can be converted to a fraction. For example: -
1.85:1 works out at 37/20
2.35:1 works out at 47/20
2.40:1 works out at 12/5

The MAR value can then be placed into the equation like this: -
Code:
```MAR    FAR                              ARS
47     368     17296                    1081
--  x  ---  =  -----  lowest dominator  ----  Giving an ARS value of 1081:900
20     720     14400                     900```
Which can be further simplyfied by converting: -
Code:
```1081      1080                    6
----  to  ----  lowest dominator  -  Giving an ARS value of 6:5
900       900                    5```
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; 3rd February 2006 at 16:00.

 3rd February 2006, 15:06 #12  |  Link bkman Registered User   Join Date: Jan 2006 Posts: 294 Well, yes I understand that, but it doesn't really answer my question about how to deal with DVD's that require cropping off the black bars. Another related question is: Why are the padding bars even there on the DVD? Are they part of the original image as it was meant to be displayed or just artifacts of DVD conversion? Answering this will answer the first question also.
3rd February 2006, 15:27   #13  |  Link
yaz
n00b ever

Join Date: May 2002
Posts: 627
Quote:
 Originally Posted by bkman 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.
definitely not. really, black bars are not part of the movie but they are part of the image/stream. they are used to maintain the stream dimensions which must(!) be always 720x576 for pal dvd and 720x480 for ntsc dvd. whithin this fixed-size box u can place any stream having quite arbitrary dimensions. (say, 654x321 is ok, if its 'bordered' to 720x576/480)
this box is resized during the playback according to the 'par' value (which simply defines how much it should be streched horizontally) calculated as showed above.

don't ask me why is it figured out like this but that's what we have

Quote:
 Originally Posted by bkman 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)?
hmm ... can't get u here, but ... the stream must be shown 4/3 on your screen/display/tv but how it's stored in a file/dvd/whatever depends on the intention of the creator. there are possibilities (see above).
about the borders ... maybe they just cut away some dirty/bleeding/shifted/ringing/... pixels round the pictures for getting better compression. dunno

the bests
y

3rd February 2006, 15:40   #14  |  Link
SeeMoreDigital
Life looks better in UHD

Join Date: Jun 2003
Location: Notts, UK
Posts: 11,754
Quote:
 Originally Posted by bkman Well, yes I understand that, but it doesn't really answer my question about how to deal with DVD's that require cropping off the black bars.
When you crop away the black mattes from a DVD source, the important thing is too make sure you end up with horizontal and vertical resolutions that are in multiples of 16 pixels (aka: "mod16").

However, because this is not always possible with cropping alone, you may end up having to re-size the image slightly until you obtain a "mod16" frame size.

In theory, it is possible to display an encode at any shape you want, once the required AR signalling value has been applied.

Quote:
 Originally Posted by bkman Another related question is: Why are the padding bars even there on the DVD? Are they part of the original image as it was meant to be displayed or just artifacts of DVD conversion?
The black mattes are there because that is what was agreed upon and later defined within the MPEG-2 DVD standard.

It was decided that the most effective way of displaying images with different aspect ratios was to overlay the "image portion" onto a "black background portion" (aka: matte) with a fixed Frame Aspect Ratio (FAR). So this is why all commercial PAL DVD's have an fixed FAR of 720x576 or 5/4. All commercial NTSC DVD's have a fixed FAR of 720x480 or 3/2.

Hope that helps.... a bit
__________________
| 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; 3rd February 2006 at 15:44.

 3rd February 2006, 15:45 #15  |  Link bkman Registered User   Join Date: Jan 2006 Posts: 294 Hmm, I'm still not quite satisfied with an answer, so let me phrase the question in another way with an example case: You have T.V. show on an NTSC DVD. The video has 8 pixels of black padding on either size, so you crop them off and are left with a resolution of 704x480. What SAR would you set in this case? 10:11? 8:9? Something else?
3rd February 2006, 15:59   #16  |  Link
SeeMoreDigital
Life looks better in UHD

Join Date: Jun 2003
Location: Notts, UK
Posts: 11,754
Quote:
 Originally Posted by bkman Hmm, I'm still not quite satisfied with an answer, so let me phrase the question in another way with an example case: You have T.V. show on an NTSC DVD. The video has 8 pixels of black padding on either size, so you crop them off and are left with a resolution of 704x480. What SAR would you set in this case? 10:11? 8:9? Something else?
If you followed the formula I provided you would be able to work it out....

Code:
```MAR   FAR                             ARS
4     480     1920                    10
-  x  ---  =  ----  lowest dominator  --  Giving an ARS value of 10:11
3     704     2112                    11```
I'm presuming the source is intended to be displayed at 4:3?
__________________
| I've been testing hardware media playback devices and software A/V encoders and decoders since 2001 | My Network Layout & A/V Gear |

3rd February 2006, 15:59   #17  |  Link
kotrtim
Registered User

Join Date: Dec 2005
Posts: 145
Quote:
 Well, yes I understand that, but it doesn't really answer my question about how to deal with DVD's that require cropping off the black bars.
I would say use the original size for calculations, because SAR is the heightXwidth of every little pixel, cropping off the black bars won't affect

lets say you have a pice of paper, 100 cm long, 10 cm width, you divide eqaully into 10 cells (similar to pixels), of course 100/10 = 10cm, therefore each box is 10cm x10cm, the sample ratio is 1x1, now cut off one cell, the piece of paper is now 90cm long, 10cm width, but the ratio of each cell is still 1x1, it never change, you can still use the previous equation 100/10 = 10cm , not 90/10.....

but for DAR, it is changed, before you cut, DAR is 100x10, after you cut it is 90x10

This is what I understand about cropping without resizing, hope you can imagine what i'm trying to tell

Last edited by kotrtim; 3rd February 2006 at 16:11.

 3rd February 2006, 16:08 #18  |  Link SeeMoreDigital Life looks better in UHD     Join Date: Jun 2003 Location: Notts, UK Posts: 11,754 kotrtim, I think you are thinking about "square" pixels and not "anamorphic" (aka: non square) pixels. Do you understand the differences? Cheers __________________ | I've been testing hardware media playback devices and software A/V encoders and decoders since 2001 | My Network Layout & A/V Gear |
 3rd February 2006, 16:23 #19  |  Link nm Registered User   Join Date: Mar 2005 Location: Finland Posts: 2,643 I agree with kotrtim here. Your formula doesn't apply directly because 4:3 is _not_ the movie aspect ratio of the cropped image. However, the SAR doesn't change when cropping.
3rd February 2006, 16:24   #20  |  Link
bkman
Registered User

Join Date: Jan 2006
Posts: 294
Quote:
 Originally Posted by SeeMoreDigital I'm presuming the source is intended to be displayed at 4:3?
Good question. How would you know definitively? Are all NTSC Television sources 4:3? If so, why the padding bars?

 Thread Tools Search this Thread Search this Thread: Advanced Search Display Modes Linear Mode

 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 Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home Announcements and Chat     General Discussion     News     Forum / Site Suggestions & Help General     Decrypting     Newbies     DVD2AVI / DGIndex     Audio encoding     Subtitles     Linux, Mac OS X, & Co Capturing and Editing Video     Avisynth Usage     Avisynth Development     VapourSynth     Capturing Video     DV     HDTV / DVB / TiVo     NLE - Non Linear Editing     VirtualDub, VDubMod & AviDemux     New and alternative a/v containers Video Encoding     (Auto) Gordian Knot     MPEG-4 ASP     MPEG-4 Encoder GUIs     MPEG-4 AVC / H.264     High Efficiency Video Coding (HEVC)     New and alternative video codecs     MPEG-2 Encoding     VP9 and AV1 (HD) DVD, Blu-ray & (S)VCD     One click suites for DVD backup and DVD creation     DVD & BD Rebuilder     (HD) DVD & Blu-ray authoring     Advanced authoring     IFO/VOB Editors     DVD burning Hardware & Software     Software players     Hardware players     PC Hard & Software Programming and Hacking     Development     Translations

All times are GMT +1. The time now is 23:04.

 Doom9.org - Archive - Top

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