Offer downscaled resolutions and decimated framerates in getUserMedia
Categories
(Core :: WebRTC: Audio/Video, enhancement, P2)
Tracking
()
People
(Reporter: jib, Assigned: pehrsons)
References
(Blocks 15 open bugs, Regressed 1 open bug)
Details
(4 keywords, Whiteboard: webcompat:risk-high, [wptsync upstream])
User Story
platform-scheduled:2025-06-01
Attachments
(22 files, 4 obsolete files)
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review | |
|
48 bytes,
text/x-phabricator-request
|
Details | Review |
Updated•9 years ago
|
Comment 2•9 years ago
|
||
| Reporter | ||
Comment 3•8 years ago
|
||
| Comment hidden (mozreview-request) |
| Comment hidden (mozreview-request) |
Comment 8•8 years ago
|
||
| mozreview-review | ||
Comment 9•8 years ago
|
||
| Reporter | ||
Comment 10•8 years ago
|
||
| Reporter | ||
Updated•6 years ago
|
| Reporter | ||
Comment 13•6 years ago
|
||
Closed wrong bug, sorry.
Comment 14•5 years ago
|
||
Is there any progress on this? I still have compressed 4:3 instead of 16:9 with Firefox 74. As there is much more need of WebRTC these quarantine days it would be awesome if Firefox could deliver beautiful video streams with the correct aspect ratio :-) I tried Jitsi, WebEx, talky.io, ... If I try meet.google.com I see the right aspect ratio before joining a room and the wrong 4:3 after joining - so there might be a workaround existing?
Thanks!
Comment 15•5 years ago
|
||
I would also like an update of some sort. Either this or add support for the aspectRatio constraint. I'm currently developing a webapp for taking profile photos That I want to work with as many cameras as possible in their best provided resolution, and it's sad how firefox forces every camera to 640x480 no matter what getusermedia says it's capable of. I've got it working pulling native resolution in all other browsers but Firefox. I also think this is the reason Slack refuses to support firefox for video calls.
| Reporter | ||
Comment 16•5 years ago
|
||
(In reply to Sam Switzer from comment #15)
I want to work with as many cameras as possible in their best provided resolution, and it's sad how firefox forces every camera to 640x480 no matter what getusermedia says it's capable of. I've got it working pulling native resolution in all other browsers but Firefox.
Hi Sam. Firefox should enumerate all native resolutions of your camera just fine, as you can see here: https://jsfiddle.net/jib1/4p5gqm0o/show
If you are having problems pulling a specific native resolution with that link, please provide info about you camera. Thanks!
| Reporter | ||
Comment 17•5 years ago
•
|
||
(In reply to fburka from comment #14)
I still have compressed 4:3 instead of 16:9 with Firefox 74. As there is much more need of WebRTC these quarantine days it would be awesome if Firefox could deliver beautiful video streams with the correct aspect ratio :-) I tried Jitsi, WebEx, talky.io, ... If I try meet.google.com I see the right aspect ratio before joining a room and the wrong 4:3 after joining - so there might be a workaround existing?
Hi fburka, as you can see in comment 16, Firefox supports all available native modes, and you can't get more "beautiful" than that, as far as quality.
Instead, this bug is about "compressing" higher resolutions down to emulate missing lower resolution modes, like Chrome does, even chopping off the bottom of e.g. 640x480 to produce 640x360 to emulate 16:9.
Unfortunately, the choice of camera resolution rests with the site, so it's hard to know why 4:3 was chosen for you. Many cameras have low-resolution 4:3 modes and high-resolution 16:9 modes. Likely, the site is choosing a lower resolution on purpose, either for perceived network bandwidth reasons or in the case of hangouts/meet, site bugs like bug 1630089 comment 4.
When a low resolution is chosen by the site, you'll likely see it as 4:3 in Firefox (the whole camera frame) vs a 16:9 (cropped native 4:3 camera frame) in Chrome (you're actually seeing more bits in Firefox!)
As to workarounds (for sites, not users):
- Sites could easily use CSS at playback time on receivers if parity and the 16:9 aesthetic is important (at minor bandwidth cost)
- If bandwidth is a concern, there are ways to downscale a high-res 16:9 mode in peer connection, using scaleResolutionDownBy but most sites don't seem to bother.
- File a bug on hangouts/meet to not look at unrelated data like
navigator.hardwareConcurrencyto determine HD vs VGA (& ★ this one)
We hope to get to this soon, as we realize it's become a web compat problem, as most sites don't seem interested in handling native modes directly.
Comment 20•5 years ago
|
||
Excited for this feature, thank you for identifying the root cause of 1645876. Is there an ETA for this or a way I could contribute? We are looking to use this when flash retires this year.
Comment 21•5 years ago
|
||
Does anyone know of workaround? Our video applications would really like to support firefox.
Comment 22•5 years ago
|
||
FWIW, I've noticed macOS-specific behavior:
On MacBook Air 13-inch 2020 build running macOS 10.15.5 and visiting https://test.webrtc.org/
FF81: 320x240 not available
Chrome86: 320x240 is available
while in comparison on Dell Inspiron 14-inch model 7490 with builtin webcam (labelled "Integrated Webcam") running Windows 10 Home visiting the same site...
FF81 and Chrome86: 320x240 is available
| Reporter | ||
Comment 23•5 years ago
|
||
The spec was changed to require this 4 days ago.
Comment 24•5 years ago
•
|
||
For what it's worth, the lack of frame rate decimation caused a web compat problem I ran into a few days ago that was threatening to derail remote school in Firefox for a bunch of students. See https://twitter.com/bytingtheapple/status/1338901952168513537 and preceding thread. Clever put in a workaround, but it would be good to not force people to do that...
Comment 25•5 years ago
|
||
For those looking for a workaround using MediaRecorder, used ffmpeg wasm for desktop support. https://ffmpegwasm.github.io/
Comment 29•4 years ago
|
||
The bug assignee didn't login in Bugzilla in the last 7 months.
:jib, could you have a look please?
For more information, please visit auto_nag documentation.
| Reporter | ||
Updated•4 years ago
|
Updated•3 years ago
|
Comment 31•3 years ago
|
||
The severity field for this bug is relatively low, S4. However, the bug has 9 duplicates.
:jib, could you consider increasing the bug severity?
For more information, please visit auto_nag documentation.
| Reporter | ||
Updated•3 years ago
|
| Assignee | ||
Updated•3 years ago
|
Comment 33•2 years ago
|
||
Hi,
any update on this being one of the last pieces together with this https://bugzilla.mozilla.org/show_bug.cgi?id=1531461 to get FaceTime working?
Thanks
Comment 35•2 years ago
|
||
Getting error while recording video from camera by using custom height(720) and width (420) while it's working well in other browsers like chrome, edge and opera.
MediaStreamError { name: "OverconstrainedError", message: "Constraints could be not satisfied.", constraint: "width", stack: "" }
Updated•2 years ago
|
Updated•1 year ago
|
Comment 36•1 year ago
|
||
It might look like a enhancement, but without it my most liked camera is unusable in Chrome as it offers no smaller resolutions and chrome can only handle about 1-2 fps. Therefor I consider this a bug for my usecase. @hodson.
Comment 37•1 year ago
|
||
I would consider this a defect as it doesn't meet the current minimum specifications: https://w3c.github.io/mediacapture-main/getusermedia.html#constrainable-properties
Specifically:
width: ... The User Agent MUST support downsampling to any value between the min width range value and the native resolution width...
frameRate... The User Agent MUST support frame rates obtained from integral decimation of the native resolution frame rate...
| Reporter | ||
Updated•1 year ago
|
Updated•1 year ago
|
Updated•1 year ago
|
Comment 39•1 year ago
|
||
The main blocker here is bug 1433480.
Updated•1 year ago
|
Updated•1 year ago
|
Updated•1 year ago
|
Updated•1 year ago
|
Updated•1 year ago
|
Updated•1 year ago
|
Updated•1 year ago
|
Updated•1 year ago
|
Updated•1 year ago
|
Updated•1 year ago
|
Updated•1 year ago
|
| Assignee | ||
Updated•11 months ago
|
Updated•10 months ago
|
Updated•10 months ago
|
| Assignee | ||
Comment 40•9 months ago
|
||
A new test for this refactors MediaEngineFakeVideoSource such that it will depend on a webrtc::videocapturemodule::VideoCaptureImpl and therefore needs webrtc::SequenceChecker to function on the MediaManager thread. Bug 1968812 should enable this without too much work in MediaManager.
| Assignee | ||
Updated•7 months ago
|
| Assignee | ||
Comment 41•6 months ago
|
||
The parent knowing about constraints enables it to employ various optimizations,
for instance to drop frames that are not wanted by the content process due to
a maximum framerate constraint and resizeMode crop-and-scale, before said
frame gets copied into an IPC shmem buffer.
| Assignee | ||
Comment 42•6 months ago
|
||
| Assignee | ||
Comment 43•6 months ago
|
||
| Assignee | ||
Comment 44•6 months ago
|
||
| Assignee | ||
Comment 45•6 months ago
|
||
| Assignee | ||
Comment 46•6 months ago
|
||
This makes it possible to chain MozPromises instead of having to nest them.
| Assignee | ||
Comment 47•6 months ago
|
||
| Assignee | ||
Comment 48•6 months ago
|
||
| Assignee | ||
Comment 49•6 months ago
|
||
So it can be used in other modules.
| Assignee | ||
Comment 50•6 months ago
|
||
| Assignee | ||
Comment 51•6 months ago
|
||
| Assignee | ||
Comment 52•6 months ago
|
||
| Assignee | ||
Comment 53•6 months ago
|
||
| Assignee | ||
Comment 54•6 months ago
|
||
This also changes back domSettings to settings as the former name
was formed to avoid ambiguity in the presence of a different kind of
settings object. The approach with the other kind of settings object
was not taken in the end.
| Assignee | ||
Comment 55•6 months ago
|
||
| Assignee | ||
Comment 56•6 months ago
|
||
Settings are updated in Allocate() instead, based on the capability available
then. For gDM where there are no capabilities, MediaManager will hold the track
until the first frame has updated the settings on main thread.
| Assignee | ||
Comment 57•6 months ago
|
||
| Assignee | ||
Comment 58•6 months ago
|
||
| Assignee | ||
Comment 59•6 months ago
|
||
resizeMode: none is simple enough. resizeMode: crop-and-scale per the below:
Camera:
- If ideal (or exact) constraints are given for both width and height, we crop
and scale to exactly those. - If ideal constraints are given for only one of the dimensions, we scale down
maintaining aspect ratio. - If max constraints are given for any dimensions, we scale down maintaining
aspect ratio to satisfy them
Desktop:
- Uses spec-compliant fitness distance for finding correct scale.
See https://jsfiddle.net/pehrsons/xwbtdn5u/ for this version. Forked from
https://jsfiddle.net/jib1/tcz74k0w/ which shows the algorithm prior to this
patch.
| Assignee | ||
Comment 60•6 months ago
|
||
| Assignee | ||
Comment 61•6 months ago
|
||
| Assignee | ||
Comment 62•6 months ago
|
||
| Assignee | ||
Comment 63•6 months ago
|
||
Updated•6 months ago
|
Comment 64•6 months ago
|
||
| Assignee | ||
Comment 66•6 months ago
|
||
Avoids a -Wunused-const-variable warning-as-error.
Comment 67•6 months ago
|
||
Comment 68•6 months ago
•
|
||
Build: 2025-08-28 (Autoland)
This is crashing Fenix and Focus tabs on access to camera in all Focus/Fenix ui-test jobs.
STR:
- https://mozilla-mobile.github.io/testapp/v2.0/permissions.html
- Tap Camera and Microphone, accept permissions
Crash
Updated•6 months ago
|
Comment 69•6 months ago
|
||
Comment 70•6 months ago
•
|
||
Please see the above regression for context.
Backed out for causing Fenix anc Focus failures on SitePermissionsTest#allowCameraPermissionsTest
Updated•6 months ago
|
| Assignee | ||
Updated•6 months ago
|
Comment 71•6 months ago
|
||
Comment 72•6 months ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/8649de9603d2
https://hg.mozilla.org/mozilla-central/rev/05a226d5261c
https://hg.mozilla.org/mozilla-central/rev/bb08dcd4ac87
https://hg.mozilla.org/mozilla-central/rev/6aaa9b6ff41c
https://hg.mozilla.org/mozilla-central/rev/f1f078b25343
https://hg.mozilla.org/mozilla-central/rev/e2aea0877661
https://hg.mozilla.org/mozilla-central/rev/9c430aa474ad
https://hg.mozilla.org/mozilla-central/rev/71bd1c5d7772
https://hg.mozilla.org/mozilla-central/rev/eb2c55de9ce7
https://hg.mozilla.org/mozilla-central/rev/285eedeaaebe
https://hg.mozilla.org/mozilla-central/rev/3839f25f9631
https://hg.mozilla.org/mozilla-central/rev/b270990e890d
https://hg.mozilla.org/mozilla-central/rev/8d48747e0414
https://hg.mozilla.org/mozilla-central/rev/a8a4e536ef6f
https://hg.mozilla.org/mozilla-central/rev/4179c7da3556
https://hg.mozilla.org/mozilla-central/rev/d68ee861218e
https://hg.mozilla.org/mozilla-central/rev/89f0b923ad07
https://hg.mozilla.org/mozilla-central/rev/031e42166831
https://hg.mozilla.org/mozilla-central/rev/96da62c1c969
https://hg.mozilla.org/mozilla-central/rev/e9801354817f
https://hg.mozilla.org/mozilla-central/rev/15595e54cf98
https://hg.mozilla.org/mozilla-central/rev/0d7ae4c7f831
Comment 74•6 months ago
•
|
||
:pehrsons, is there anything you want to call out in a release note? Asking since it's a long-running bug with many duplicates. (Process info)
EDIT: corrected typo
| Assignee | ||
Comment 75•6 months ago
|
||
| dev-doc-info | ||
(In reply to Donal Meehan [:dmeehan] from comment #74)
:phesrosn
☺️
is there anything you want to call out in a release note? Asking since it's a long-running bug with many duplicates. (Process info)
Thanks for the ping. I think we can add something per below.
Release Note Request (optional, but appreciated)
[Why is this notable]: Implements the resizeMode constraint for getUserMedia, to allow applications to crop and downscale camera video to any resolution. The lack of this constraint broke several sites in the wild.
[Affects Firefox for Android]: Yes
[Suggested wording]: The resizeMode getUserMedia constraint is now available, allowing developers to crop and downscale video captured from a camera to any resolution they choose.
[Links (documentation, blog post, etc)]: nothing as of now
dev-doc-needed as some updates may be warranted to the relevant pages about getUserMedia and constraints.
Note what this does in a bit more verbose terms is:
- Adds the
resizeModeconstraint with two modes:"none"and"crop-and-scale". We default to"crop-and-scale". "crop-and-scale"allows cropping (camera-only) and downscaling to constraints. A native higher framerate than requested can also be decimated to match constraints."none"prohibits cropping, downscaling and framerate decimation.- For cameras, our previous behavior was on par with
"none"."crop-and-scale"makes it so we will crop and/or downscale (upscale not permitted) to the resolution with the shortest fitness distance to the requested constraints. - For screens and windows, our previous behavior was similar to
"crop-and-scale"in that we downscaled (no cropping then, still not permitted now) to something close to the requested resolution. Spec compliance has improved here in that we find the correct resolution wrt fitness distance.resizeMode"none"is also new here and will avoid scaling entirely, sticking with the physical resolution of the display. Note noscreenPixelRatiosetting yet (bug 1965499), and no downscaling by that ratio by default in"crop-and-scale"yet either (bug 1703991).
Comment 76•6 months ago
|
||
Thanks, added to the Fx144 nightly release notes, please allow 30 minutes for the site to update.
Keeping the relnote-firefox flag as ? to keep it on the radar for inclusion in the final Fx144 release notes.
(In reply to Andreas Pehrson [:pehrsons] from comment #75)
(In reply to Donal Meehan [:dmeehan] from comment #74)
:phesrosn
☺️
Sorry for the multiple letter typo....
Comment 77•5 months ago
•
|
||
FF144 MDN docs work for this can be tracked in https://github.com/mdn/content/issues/41132
This talks only about getUserMedia(), but also refers to screens/windows. Would I be correct in thinking that for this case we're talking about using the constraint with getDisplayMedia()?
In addition, for the screen case, does the crop-and-scale also reduce the frame rate to match constraints, or only the resolution?
Last of all, I see that crop-and-scale is Firefox default. However I can't see it specified as a default in the spec. Is this specified or is it up to the implementation?
| Assignee | ||
Comment 78•5 months ago
|
||
(In reply to Hamish Willee from comment #77)
FF144 MDN docs work for this can be tracked in https://github.com/mdn/content/issues/41132
This talks only about
getUserMedia(), but also refers to screens/windows. Would I be correct in thinking that for this case we're talking about using the constraint withgetDisplayMedia()?
Correct.
In addition, for the screen case, does the crop-and-scale also reduce the frame rate to match constraints, or only the resolution?
Also frame rate decimation.
Note the main difference between getUserMedia and getDisplayMedia wrt resizeMode: "crop-and-scale" is that cropping is not allowed for getDisplayMedia.
Last of all, I see that
crop-and-scaleis Firefox default. However I can't see it specified as a default in the spec. Is this specified or is it up to the implementation?
Calling it default is a bit misleading perhaps. The spec finds the most fitting (per fitness distance in the SelectSettings algorithm) setting given some constraints. If there's no resizeMode constraint provided, all settings dictionaries, i.e. involving both "none" and "crop-and-scale", are part of calculations. Also note that, by spec, for every settings dictionary with resizeMode: "none" there is an otherwise identical settings dictionary with resizeMode: "crop-and-scale", which we pick given all else being equal. I think the relevant bit in the spec is around here:
For any property with a system default value for the selected device, the system default value SHOULD be used if compatible with the above algorithm. This is usually the case for properties like
sampleRateorsampleSize. Other properties, likeechoCancellationorresizeModedo not usually have system default values. The User Agent defines its own default values for these properties. Implementors need to be cautious to select good default values since they will often have an impact on how media content is generated.
Comment 79•5 months ago
•
|
||
Thanks @Andreas
- What I think you're saying is that if the resizeMode is not specified the browser is allowed to find the best fitness match for all the constraints, including "generated" constraints where
nonewas specified and wherecrop-and-scalewere specified, and if there are still several equally fit options based on those constraints and one of the choices is a system default then that should be preferred. Right? - For the "cropping is not allowed for getDisplayMedia." - is that a Firefox implementation thing or a spec requirement?
| Assignee | ||
Comment 80•5 months ago
|
||
(In reply to Hamish Willee from comment #79)
Thanks @Andreas
- What I think you're saying is that if the resizeMode is not specified the browser is allowed to find the best fitness match for all the constraints, including "generated" constraints where
nonewas specified and wherecrop-and-scalewere specified, and if there are still several equally fit options based on those constraints and one of the choices is a system default then that should be preferred. Right?
Right, but note in the case of resizeMode we're down to a user agent, rather than system, default, as per the spec cited in comment 78.
- For the "cropping is not allowed for getDisplayMedia." - is that a Firefox implementation thing or a spec requirement?
That's a MUST NOT crop by spec: https://w3c.github.io/mediacapture-screen-share/#downscaling-and-frame-decimation
Updated•5 months ago
|
Updated•5 months ago
|
Description
•