PDA

View Full Version : So...16:9 and 4:3 arent *REALLY* 16:9 and 4:3??


wst
30th December 2008, 22:27
I have been encoding my DVD TV episodes to H.264 and I was under the impression that the Display Aspect Ratio of a 4:3 show is 1.333 and for 16:9 it is 1.778, based on simple math. I was doing my encoding from the command line; however, when I used MeGUI, it became clear that those numbers may not be correct. MeGUI has listed 1.822784 for 16:9 and 1.367088 for 4:3. Unless the hardware specs are wrong, most HDTVs truly have 1920x1080 or 1280x720 pixels to display - those both work out to 1.778 DAR.

Where does 1.822784 fit into all this? Can someone please clear this up? I did some homework and found:

http://forum.doom9.org/showthread.php?t=42708
http://forum.doom9.org/showthread.php?t=140366

But the best explanation I could find was:

If you want to know why a 16:9 video is not exactly 16:9 look at the ITU specs and docs....In short it is all very complicated and and comes from analogue transmission of video

I can assure you, there's nothing analog involved in my setup - so what happens when something with 1.82 DAR is displayed on a legit HDTV? And more specifically, what should I choose for my encoding DAR (assuming the source is 720x480 DVD)?

Thanks!

smok3
30th December 2008, 23:01
happy reading
http://lipas.uwasa.fi/~f76998/video/conversion/#introduction

wst
5th January 2009, 02:12
Thanks smok3. I've read through this document and - please correct me if I've misunderstood - it appears that 16x9 as broadcast and as displayed on an HDTV television is truly something different from 16x9 because 1080p and 720p are not square pixels (and I was assuming they were). A more accurate term may be "almost-16x9"?

So in order for 16x9 tv episodes to look as they were originally intended on an NTSC DVD, the correct DAR for an encoded mp4, mkv, etc. is the 1.82... number?

scharfis_brain
5th January 2009, 02:16
1080p and 720p are sqare pixels.

but all SD-TV formats don't have square pixels

wst
5th January 2009, 06:44
So, this gets back to my original question. Should the DAR of an MKV whose source was a 16x9 tv show be 1.78 or 1.82? Seems like it should be the former, since that would scale directly, without stretching, to either 720p or 1080p, assuming square pixels. Am I being dense here?

smok3
5th January 2009, 15:28
in purely (theoretical) digital world it should be simply

> 16/9
ans = 1,77778

my calc seems to think the same for 'pal input'
http://resizecalc.somestuff.org/index.php?ssmw=702&sar=1.459&sar2=&ssmh=576&CT=&CL=&CR=&CB=&mplayCrop=&trw=&dar=1&dar2=&modw=&modh=&padw=&padh=&css=&doit=true

SeeMoreDigital
5th January 2009, 18:34
So, this gets back to my original question. Should the DAR of an MKV whose source was a 16x9 tv show be 1.78 or 1.82? Seems like it should be the former, since that would scale directly....And this is precisely what MKVmergeGUI does....

If you import say: -

An 720x576 MPEG-2 DVD source containing 16:9 DAR "bitstream level" signalling. MKVmergeGUI will automatically set the MKV "container level" signalling to 1024x576.

An 720x576 MPEG-2 DVD source containing 4:3 DAR "bitstream level" signalling. MKVmergeGUI will automatically set the MKV "container level" signalling to 768x576

An 720x480 MPEG-2 DVD source containing 16:9 DAR "bitstream level" signalling. MKVmergeGUI will automatically set the MKV "container level" signalling to 853x480.

An 720x480 MPEG-2 DVD source containing 4:3 DAR "bitstream level" signalling. MKVmergeGUI will automatically set the MKV "container level" signalling to 640x480


Cheers

JohnnyMalaria
5th January 2009, 19:35
16:9 is the *display* aspect ratio. How an encoding/decoding scheme chooses to store the video is entirely unrelated. For example, for DV both PAL and NTSC are sampled 720 times across each line. PAL has 576 lines, NTSC 480. In terms of a computer bitmap, this means an aspect ratio of 720:576 (PAL) or 720:480 (NTSC). Neither are 4:3 or 16:9 but are usually intended for display as such. The DV format accommodates others such as 14:9 and 2.35:1, all encoded as 720 x 576 or 720 x 480. The 720 is taken from the D1 format.

HDV is an MPEG2 variant and uses images at 1440 x 1024. This, too, is not the 16:9 that HDV uses for display (1920 x 1024). As long as the decoder knows the internal ratio and the final ratio for display, it doesn't matter what is used.

smok3
6th January 2009, 00:00
HDV is an MPEG2 variant and uses images at 1440 x 1024. This, too, is not the 16:9 that HDV uses for display (1920 x 1024). As long as the decoder knows the internal ratio and the final ratio for display, it doesn't matter what is used.

1440*1080 & 1920*1080 are the numbers i think, other than that i think you have choose some very confusing wording here :)

p.s.
i would go like this:
a. there is DAR
b. there is PAR
c. there is resolution in pixels

and then try to explain the relations....

JohnnyMalaria
6th January 2009, 01:47
You're right. 1080 not 1024. I was multitasking and not paying attention...

wst
6th January 2009, 01:54
For compatibility purposes I set the signaling twice: during the h.264 elementary stream encode using -PAR (calculating based on the DAR and resolution), and then again at the container level (in mkvmerge gui by setting DAR).

I had been doing all of the backward DAR-to-PAR math to engineer it so the resulting anamorphic display ratio would be 1.78 (as SeeMoreDigital pointed out, 853x480, given my 720x480 resolution).

However, in MeGUI, it lets you set the DAR in a box, and then it does the math and automatically sets the x264 switch for PAR. It was here that I saw 1.822784 suggested as the "correct" DAR for 16:9. If you select this, it will calculate a PAR that results in an output image that's NOT exactly 16:9.

Comparing them side-by-side, as expected, one is slightly more stretched than the other, but it's hard to eyeball which one is correct. Maybe I'll have to borrow another HDTV and run some tests, using the original DVD as a reference.

wst
8th January 2009, 19:40
And just to belabor the point, an NTSC anamorphic widescreen DVD (for TV episodes), when converted to square pixels will be either:

1. 853x480 (1.78 DAR), or
2. 874x480 (1.82 DAR)

I just don't see how #2 could be right.

SeeMoreDigital
8th January 2009, 19:53
Here are some more "numbers" for you: -

PAL Output

Non ITU 4:3 - 720 x 16: 15 = 768.00
Non ITU 16:9 - 720 x 65: 45 = 1024.00

ITU Std 4:3 - 720 x 12: 11 = 785.45
ITU Std 16:9 - 720 x 16: 11 = 1047.27

ITU Exact 4:3 - 720 x 128: 117 = 787.6923077
ITU Exact 16:9 - 720 x 512: 351 = 1050.2564100

BBC Std 4:3 - 720 x 197: 180 = 788.00
BBC Std 16:9 - 720 x 35: 24 = 1050.00

THX Disc 4:3 - 720 x 97: 90 = 776.00
THX Disc 16:9 - 720 x 13: 9 = 1040.00

-----------------------------------------------

NTSC Output

Non ITU 4:3 - 720 x 8: 9 = 640.00
Non ITU 16:9 - 720 x 32: 27 = 853.33

ITU Std 4:3 - 720 x 10: 11 = 654.54
ITU Std 16:9 - 720 x 40: 33 = 872.72

ITU Exact 4:3 - 720 x 72: 79 = 656.2025316
ITU Exact 16:9 - 720 x 96: 79 = 874.9367089

BBC Std 4:3 - 720 x 41: 45 = 656.00
BBC Std 16:9 - 720 x 175: 144 = 875.00

THX Disc 4:3 - 720 x 9: 10 = 648.00
THX Disc 16:9 - 720 x 217:180 = 868.00

scharfis_brain
8th January 2009, 20:59
huh, where did you get these numbers from?
This is quite interesting.

cacepi
8th January 2009, 21:14
2. 874x480 (1.82 DAR)

I just don't see how #2 could be right.This second one assumes a horizontally overscanned frame, which makes sense if you're encoding only the active picture - i.e. 704x480 - with a border to fill out the rest of the frame.

720x480 * 40:33 PAR = 872.727272

But cut out the black border, which normally shouldn't be seen due to overscan:

704x480 * 40:33 PAR = 853.333333

So the frame comes out to be pretty close to 720x480 anamorphic.

SeeMoreDigital
8th January 2009, 23:02
huh, where did you get these numbers from?
This is quite interesting.LOL...

The most alarming "numbers" were those calculated from the PAL and NTSC THX sources!

When you take an image grab from any of the 720x480/576 "non square" circles and resize them to as near perfect circles as you can, the resulting "square pixel" images are very weird resolutions.


Cheers

wst
8th January 2009, 23:14
Cacepi - Are you saying that of the raw 720x480 mpeg2 image on a DVD, only 704 of those pixels actually make it to the TV (HDTVs included) do to overscan? So although 720x480 is stored, 1.78 then applies only to 97.78% of the horizontal image - correct? The math seems to check out, since 1.822784*(704/720)=1.78.

So it seems I should either be cropping my episodes at 704x480 to account for overscan and use 1.78 DAR, or keep the original 720x480, no cropping, and account for overscan with 1.82 DAR.

cacepi
9th January 2009, 00:44
Cacepi - Are you saying that of the raw 720x480 mpeg2 image on a DVD, only 704 of those pixels actually make it to the TV (HDTVs included) do to overscan? So although 720x480 is stored, 1.78 then applies only to 97.78% of the horizontal image - correct? The math seems to check out, since 1.822784*(704/720)=1.78.

So it seems I should either be cropping my episodes at 704x480 to account for overscan and use 1.78 DAR, or keep the original 720x480, no cropping, and account for overscan with 1.82 DAR.
No, none of that is correct. There is a difference to how H.264 defines overscan and display overscan; the two are very different creatures, and cause for no end of confusion.

The H.264 allows for the concept of a cropping rectangle, a sort of invisible box over a video frame that specifies what the decoder should display and what it shouldn't; anything inside the cropping rectangle gets shown, anything outside doesn't. When 264 specifies overscan, it means to throw out anything outside of the cropping rectangle, effectively resizing the frame. If there's an overscan flag in your video, then the decoder should apply the pixel aspect ratio (PAR) only after the frame has been cropped, using the information in the cropping rectangle.

The standard 40:33 PAR is confusing because the spec assumes that you're cropping the video somehow if you use that PAR. That's why you're seeing that weird aspect ratio of 1.82; you didn't tell the decoder what you wanted cropped.

But wait, it gets better! The spec doesn't make any of this mandatory, only that it's "suitable" to decode a picture with overscan. It's entirely up to the discretion of the decoder: it might crop your video, but then again it might not.

Ain't standards fun?

Note that none of this applies to DVD, as it has no cropping rectangle, and hence no overscan. The entire 720x480 frame is sent to the display, regardless whether it's a digital display or not. The display itself might overscan the picture - in fact it invariably does - but that doesn't mean it doesn't get the full frame from the decoder.

If you're really interested in preserving aspect ratio, then forget about cropping and overscan and either keep a full 720x480 frame size and apply a custom PAR of 32:27 or resize to 704x480 and apply the standard H.264 PAR (40:33); either are valid for 16:9.

If the video has black bars on the sides I always crop them out and resize to 704x480. I have noticed that most DVDs fill the enitre frame, however.

wst
9th January 2009, 16:43
Thanks Cacepi - fun is not the word I would have chosen. But it looks like I'm okay, since I've been using a 32:27 PAR for almost all of my encodes from 720x480 DVD sources. I'd much prefer not to resize - I'm a pixel preserving type.

On some DVDs I've noticed a few pixels of black bars but never bothered cropping. I just got a Popcorn Hour and I'm curious to see if those bars will ever make it to the TV. If so, I may start cropping.

Thanks again.

SeeMoreDigital
9th January 2009, 17:24
Perhaps you may find this post (http://forum.doom9.org/showthread.php?p=1034465#post1034465) useful to you at some in the future?

Comatose
9th January 2009, 20:33
But that's really just about using anamorphic flags. This thread deals with non-square pixels and how to compensate for them :E