[whatwg] video tag: pixel aspect ratio

Ian Hickson ian at hixie.ch
Mon Dec 1 17:24:51 PST 2008


On Tue, 2 Dec 2008, Silvia Pfeiffer wrote:
> 
> Not all video players behave like the YouTube one though. Many stretch 
> with the width/height attributes.

Yeah, it's really annoying. :-)


> I would support an explicit keepaspectratio attribute, which turns the 
> width/height from a video width/height to a viewport. In fact, such an 
> attribute would be awesome for images, too. It could be a CSS attribute 
> or an explicit video element attribute - I am not fussed.

I think that this belongs in CSS, for the reason Nils gave:

On Tue, 2 Dec 2008, Nils Dagsson Moskopp wrote:
>
> Better make it CSS – this is as presentational as it can get.


On Tue, 2 Dec 2008, Silvia Pfeiffer wrote:
>
> 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?

We already do.


> * How often is the widht/height metadata in videos encoded with wrong values?

Relatively often, IMHO, that's why I wanted pixelratio="". But we've 
established that this is not something we're addressing in v1.


> * 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?

We already force them to decode the end of the stream to get the right 
duration, having them decode one frame so that they can render that frame 
seems reasonable enough.


> * Do we have use cases for overriding correct aspect ratio displays by 
> users? (and should that then go into a CSS control?)

There are always use cases for presentational effects, and those indeed 
belong in CSS.


> 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.

Indeed.


> 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.

Right.


> 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.

Agreed.


On Tue, 2 Dec 2008, Philip Jägenstedt wrote:
> 
> The point wasn't that it is OK for UA:s to distort video because there 
> are people who don't notice, but that some people do/will encode video 
> with the wrong aspect ratio without noticing/caring. The general 
> consensus seems to be that this isn't worth the effort fixing.

Right, that's why we dropped pixelratio="". :-)


> But in any event, if a CSS solution is in fact possible that would be 
> much better than any video-specific solution. I don't think CSS 
> transforms can do it though, unless someone can give an example?

Well, CSS transforms don't officially exist yet, but you could use a 
scale() or scaleX() transform:

   http://webkit.org/specs/CSSVisualEffects/CSSTransforms.html

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'


More information about the whatwg mailing list