WebRTC resolution limit

thanh picture thanh · Jul 6, 2013 · Viewed 8.5k times · Source

I tried this and this, but the maximum resolution I can get is 640x480.
The pictures taken by other windows apps by the same camera have the resolution of 1600x1200.
Is there any limit for resolution in WebRTC?
I cannot find any official documentation about that.

Answer

tomtheengineer picture tomtheengineer · Jul 6, 2013

You can do it by using constraints and passing those to getUserMedia as shown in the links you provided. It's possible that your webcam only supports 640x480 for video and higher resolutions for still images (this is common).

Here's another example, where you can try setting various resolutions and it will print out the corresponding constraints object: http://webrtc.googlecode.com/svn/trunk/samples/js/demos/html/constraints-and-stats.html

For example, to try to force it to 720p at 30FPS:

{
 "audio": true,
 "video": {
  "mandatory": {
   "minWidth": "1280",
   "maxWidth": "1280",
   "minHeight": "720",
   "maxHeight": "720",
   "minFrameRate": "30"
  },
  "optional": []
 }
}

Note that the current spec does not allow querying the hardware capabilities, due to concerns over privacy due to fingerprinting: http://lists.w3.org/Archives/Public/public-media-capture/2012Jan/0014.html