Re: aspect-ratio property

On Thu, Jan 5, 2012 at 2:20 PM, Hugh Guiney <hugh.guiney@gmail.com> wrote:
> Hope this isn't too divergent; spin-off the thread if necessary, but I
> just read your proposed spec Tab (http://www.xanthir.com/blog/b4810),
> and have some comments.
>
>> You can use it to, for example, require that an HTML <video> element is as wide as its parent element at all times, but maintain a 4:3 ratio.
>
>> However, several common ratios are usually expressed as fractions or explicit ratios, such as "16 by 9". These can be easily expressed using the calc() function, like aspect-ratio: calc(16/9);.
>
> The problem with these is that in the video world, aspect ratio is a
> lot more complicated. When somebody says "4:3" or "16:9", all you can
> really be sure of what they mean is "frame size that is nearly as tall
> as it is wide" and "frame size that is noticeably wider than it is
> tall", respectively. The aspect ratios of video described in these
> terms, more often than not aren't literally 4:3 or 16:9, due to
> varying pixel aspect ratio dimensions.
>
> I explained this problem in some detail on WHATWG a few years back
> (first reply block):
> http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2009-December/024541.html
>
> The problem is, if an author has a 720x480 pixel video, and specifies:
>
>    max-height: 480px;
>    aspect-ratio: calc(16/9);
>
> What do they get? The blind mathematics are simple, but the correct
> square-pixel width could be 853, 854, 856, 864, 873, or 875 depending
> on the video specification being observed. And that's just on the
> "NTSC" side; there are still other definitions for PAL-area video.
> Most authors and even video professionals are oblivious to these
> conflicting definitions so even if there were a way to specify the
> standard manually it wouldn't be used.
>
> Thus I think the best solution would be a rewording of the spec that
> states the value of aspect-ratio is interpreted literally; that
> depending on the video standard, the shorthands 4:3 or 16:9 may not
> produce the correct ratio.

So you'd just like a further note to that note, saying that videos are
often not exactly 4:3 or 16:9 due to oddities in encoding standards,
so beware when setting up ratios on dom elements depending on a video
being the same size?

~TJ

Received on Thursday, 5 January 2012 23:46:03 UTC