[whatwg] video tag: pixel aspect ratio

Silvia Pfeiffer silviapfeiffer1 at gmail.com
Mon Dec 1 16:29:31 PST 2008

On Tue, Dec 2, 2008 at 11:02 AM, Silvia Pfeiffer
<silviapfeiffer1 at gmail.com> wrote:
> On Tue, Dec 2, 2008 at 4:19 AM, Lachlan Hunt <lachlan.hunt at lachy.id.au> wrote:
>> Philip Jägenstedt wrote:
>>> On Mon, 2008-12-01 at 12:39 +0000, Ian Hickson wrote:
>>> <video src="circle.mpg" width="400" height="400"> <!-- circle -->
>>> <video src="circle.mpg" width="400" height="300"> <!-- pillarbox -->
>> This is effectively how YouTube behaves now with their recent change to a
>> widescreen player.  It would look terrible if 4:3 videos were stretched to
>> fill the 16:9 viewport, instead of just using black bars on the side.  Even
>> before when they were still using a 4:3 player, widescreen videos were
>> rendered as letterbox.
> Not all video players behave like the YouTube one though. Many stretch
> with the width/height attributes.

I checked this out a little more, since I remembered using the JW
player for some flv videos and they were stretched to the size of the
player no matter what their original encoded size.

According to this thread http://www.jeroenwijering.com/?thread=13766
it depends on whether the video metadata contains the original
width/height of the video. If it doesn't have that, the JW player
stretches to whatever is given. Jeroen might have changed that by now,
since it seems that many players now decode a few frames of video to
determine the original width/height of the video if this information
is not provided in the video metadata.

There are tools to include such metadata into the video headers for
the different video formats that exist and I am sure someone like
YouTube will make sure that metadata is available. However, I would
not expect the common user to be clever enough to make sure their
videos provide this data.

This raises a few questions:
* Do we want to prescribe the use of the width/height metadata for
determining the video size inside the viewport?
* How often is the widht/height metadata in videos encoded with wrong values?
* Do we want to force all video players to decode a few frames and get
the correct width/height values to then adapt to the viewport?
* Do we have use cases for overriding correct aspect ratio displays by
users? (and should that then go into a CSS control?)

I would much prefer the default video display to get it right inside a
viewport, than to risk relying on users to get the aspect ratio right.

Also, the viewport approach makes it easier to have a consistently
sized video player rather than adapting the video player to the
video's actual size and thus potentially constantly switching between
4:3 and 16:9.

So (contrary to what I wrote just before), I think the attribute
should not be a "keepaspectratio" attribute but rather something like
"fillviewport" and it should probably be a CSS attribute.


More information about the whatwg mailing list