aspect ratio

332 views
Skip to first unread message

pablo platt

unread,
Jan 30, 2012, 9:42:00 AM1/30/12
to discuss...@googlegroups.com
Hi,

In the webrtc examples I saw 4:3 aspect ration like 320X240 and 640X480.
What is the recommended aspect-ratio for the local and remote video elements when using webrtc?
Does it have to be 4:3?
Does it have to be multiples of 80?
Can I use for example 324X243?
Are there implications on quality or cpu?

Thanks

Ralph Giles

unread,
Jan 30, 2012, 1:28:59 PM1/30/12
to discuss...@googlegroups.com, pablo platt
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Mon 30 Jan 2012 06:42:00 AM PST, pablo platt wrote:

> In the webrtc examples I saw 4:3 aspect ration like 320X240 and 640X480.
> What is the recommended aspect-ratio for the local and remote video
> elements when using webrtc?

These are just standard (square pixel) video sizes. You can use (or at
least offer) any resolution the video codec supports. In particular,
16:9 webcams will work fine.

> Does it have to be 4:3?

No. If you look at
http://tools.ietf.org/html/draft-cbran-rtcweb-codec-01, suggested
resolutions for interoperability include 640x360 and 1280x720.

> Does it have to be multiples of 80?

Most video codecs prefer that the frames be a multiple of 8 or 16
pixels.

> Can I use for example 324X243?

Depends on the codec. Most will implement this by encoding a slightly
larger frame and cropping. There's no particular reason that resolution
would be forbidden though.

> Are there implications on quality or cpu?

Hardware implementations sometimes have a limited number of resolutions
they support. Otherwise, the the main thing which affects cpu and
bitrate is the overall number of pixels, not the particular aspect
ratio.

Hope that helps,
-r
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJPJuFWAAoJEEcAD3uxRB3v55YIAJacmIyZpgP0dEhL0uU+8DmG
8zpEdJHpbOG8bBeUfKCrNDZnjWvhr/ca3GAHeTSZIZ0BULFexCMW53ByP6ojkZTV
6AEINFUXybWOgFFND/tfWptnipGItdy6eilyndSzPwe1QbVcJAEYjUxo3quVikmq
fv8JmBq2FhUBW1UEVtoeVPKpWzK62I81M+3/SYWgV/86k9593fl941/T1QGntTsb
SzCSgZ99+CyMnvz2Qw0lvii5Q6idD8oQkMuTG8u3R4fRR/V8rbICHhVyr4K8UMLD
xwDMe3n0yxMFMQLtJOH4y06fO66cKPPgV0Ej6zACVy+lM+JyhxihjUffkq1rXyA=
=W2mV
-----END PGP SIGNATURE-----

pablo platt

unread,
Jan 30, 2012, 8:18:46 PM1/30/12
to Ralph Giles, discuss...@googlegroups.com
If I'm using 448x336 which preserves the 4:3 aspect ratio and is a multiple of 16, should it be ok?
I would have used 320x240 but I have to fit it in an existing UI and leaving thick black margins looks bad.

Is it better to have 16:9 aspect ratio and not just 4:3?
It seems that most new webcams support 16:9.
In that case I'll use 448x252.

If the camera only support 320x240 and 640x480 does it means that it will capture and broadcast in 640x480
and the fact that I'm using a smaller view is a waste of pixels?

Is the limited number of resolutions a problem only with older hardware implementations
or is it possible that also recent hardware will perform suboptimal with non native resolution?

I've tried playing with several resolutions.
Sometimes win7 alert me of poor performance and sometimes the stream freezes but I'm not sure if its related.

Thanks

Punyabrata Ray

unread,
Jan 31, 2012, 2:37:35 PM1/31/12
to discuss-webrtc
Please see my responses.

On Jan 30, 5:18 pm, pablo platt <pablo.pl...@gmail.com> wrote:
> If I'm using 448x336 which preserves the 4:3 aspect ratio and is a multiple
> of 16, should it be ok?
> I would have used 320x240 but I have to fit it in an existing UI and
> leaving thick black margins looks bad.
>
> Is it better to have 16:9 aspect ratio and not just 4:3?
> It seems that most new webcams support 16:9.
> In that case I'll use 448x252.

Please try both resolutions and see which one looks better.
I agree that black borders seems like a waste. I am assuming
you cannot increase the rendering window sizes for some reason.
>
> If the camera only support 320x240 and 640x480 does it means that it will
> capture and broadcast in 640x480
> and the fact that I'm using a smaller view is a waste of pixels?
>
Yes, you will be cropping the video frame.
> Is the limited number of resolutions a problem only with older hardware
> implementations
> or is it possible that also recent hardware will perform suboptimal with
> non native resolution?

Cameras and codecs cannot support an infinite number of resolutions.
Therefore, due to historical/political/technological reasons, below is
a set
of more of the standard resolutions. Again, this is just a list. It
does not
mean that cameras, codecs, or webrtc will support all these
resolutions.
As Ralph cited, the current proposal states:
o MUST support a minimum resolution of 320X240

o SHOULD support resolutions of 1280x720, 720x480, 1024x768,
800x600, 640x480, 640 x 360 , 320x240

While hardware getsvmore powerful, it is always better to match
the resolution of what the video codec / camera support. This will
avoid the need for cropping or adding black borders (very difficult to
encode) or
resampling/resizing which adds more complexity to your application.

List of resolutions:
SQCIF, // 128*96
QQVGA, // 160*120
QCIF, // 176*144
CGA, // 320*200
QVGA, // 320*240
SIF, // 352*240
WQVGA, // 400*240
CIF, // 352*288
W288p, // 512*288
448p, // 576*448
VGA, // 640*480
432p, // 720*432
W432p, // 768*432
4SIF, // 704*480
W448p, // 768*448
NTSC, // 720*480
FW448p, // 800*448
WVGA, // 800*480
4CIF, // 704 576
SVGA, // 800*600
W544p, // 960*544
W576p, // 1024*576
HD, // 960*720
XGA, // 1024*768
WHD, // 1280*720
FullHD, // 1440*1080
WFullHD, // 1920*1080
>
> I've tried playing with several resolutions.
> Sometimes win7 alert me of poor performance and sometimes the stream
> freezes but I'm not sure if its related.

If you are able to correlate the win7 poor alert to the webrtc video
engine,
please file a bug.
> > Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org/

Punyabrata Ray

unread,
Jan 31, 2012, 4:09:32 PM1/31/12
to discuss-webrtc
A colleague also just informed me that
browser <video> tags are resizable
therefore you should be able to use this
to fit the video stream.

pablo platt

unread,
Feb 1, 2012, 4:18:06 AM2/1/12
to discuss...@googlegroups.com
I'll start with one of the native resolutions
and experiment with non native sizes on different machines with different webcams and see how it goes.

Thank you both for the valuable info.

TJ Grant

unread,
Feb 1, 2012, 5:34:34 AM2/1/12
to discuss...@googlegroups.com
Pablo…

As I remember it…

Whatever configuration you give (640x480, 352x288), WebRTC tries to configure the camera capture rate as this, and though on most configurations this is not a problem (my guess is that the drivers are flexible), occasionally you might find a camera model that doesn't support a given resolution. So this has nothing to do with screen resolution or anything non-camera.

So I would go with what Punyabrata mentioned-- 320x240 is the min required, so that should always work.
Alternatively, if you're just testing, use whatever resolution is the lowest supported on your particular camera. (Look up the tech specs for your camera, but this will vary from camera to camera.)

Essentially whatever you pick, you can resize or reshape it to fit whatever UI you come up with, if necessary.
Also, of course, you can enumerate the resolutions until you find one that fits your needs (be it aspect ratio or size), but that's totally up to you to implement.

Reply all
Reply to author
Forward
0 new messages