W3C home > Mailing lists > Public > www-style@w3.org > January 2012

Re: aspect-ratio property

From: Hugh Guiney <hugh.guiney@gmail.com>
Date: Fri, 6 Jan 2012 17:01:40 -0500
Message-ID: <CAEHyr+asY6BdQTtaErN40RNMYwXO=dst8RN-iWjApcaEnRj8xw@mail.gmail.com>
To: Brad Kemper <brad.kemper@gmail.com>
Cc: "Tab Atkins Jr." <jackalmage@gmail.com>, Matthew Wilcox <elvendil@gmail.com>, www-style@w3.org
On Fri, Jan 6, 2012 at 11:33 AM, Brad Kemper <brad.kemper@gmail.com> wrote:
> How about a video specific rule (maybe in HTML instead of in CSS), that if the video is sized via a CSS aspect-ratio, it will not distort the video, but rather add black bars. That would make it similar to a 16:9 movie playing on a 16:9 TV.

I presume you mean a 16:9 video playing on a 4:3 TV?

In any case, distortion is actually necessary for anamorphic video
(i.e., video with non-square pixels) although it makes more sense to
call it "un-distortion" since it's actually distorted first during
encoding, with the process reversed during playback. This is important
to recognize since nearly all video that isn't HD and wasn't recorded
directly on a computer is anamorphic. As I said in the thread I linked
to:

> According to the D1 & DV standards, "fullscreen" pixels have a width-to-height ratio of 4320/4739 (~0.9). So a 720x480 "fullscreen" image on a square-pixel device would have to be displayed at ~656x480 pixels to retain its proper aspect ratio.
>
> By the same standards, widescreen pixels are 5760/4739 (~1.2), so a 720x480 widescreen image would have to be displayed at ~875x480 pixels.

While it's true that this kind of resizing is typically done before
exporting a video for the Web, H.264, WebM, Theora (as well as MPEG-2
and many others) all prefer widths and heights that are multiples of
16 for reasons of compressibility and non-RGB color space
restrictions; most encoders will complain if you feed them anything
else. So while the D1/DV "4:3" (which isn't exactly exactly 4:3 but
rather 41:30) video would encode without issue, the widescreen version
wouldn't, as 875 isn't evenly divisible by 16: the two closest numbers
are 864 rounded down and 880 rounded up—so the aspect ratio has to be
compromised merely for the sake of encoding.

This is a problem that wouldn't exist if it were possible to specify
aspect-ratio for the purpose of un-distortion, which is equivalent to
what is already done in the video electronics world with pixel aspect
ratio flags in MPEG streams et al. That way, videos could be exported
at codec-optimized sizes, but displayed at their proper size when
played back.

Where letterboxing (and conversely "pillarboxing") come into play is
if there's a resolution the video can not exceed; I imagine this
effect could already be achieved by constraining width/height.
Although as currently written the spec seems to imply that if neither
width nor height are underspecified, then aspect-ratio is ignored,
correct?

I do also wonder if this is an HTML thing too though, as the AR is
often an inherent property of the video and isn't something that would
typically need to be changed; nor is it something that should be
ignored if CSS is turned off. Additionally, I think it would be
incorrect to stretch/compress the video controls along with the video.
Received on Friday, 6 January 2012 22:02:34 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:48 GMT