How to get a downsampled stream from a high resolution camera capture ?

137 views
Skip to first unread message

Jaya Allamsetty

unread,
Aug 9, 2020, 8:31:57 AM8/9/20
to discuss...@googlegroups.com

Hi,


Is there a way to start a camera capture at a higher resolution and request the browser to give us a downsampled stream of the same capture for lower resolutions ? The problem we are trying to solve happens on certain cameras like the built-in camera of MacBook Pro, which give us different streams. The 720p capture exposes more of a subject's background as opposed to a 360p capture which appears to be zoomed in as shown in the attached screenshot. This could cause a privacy issue when we try to change the capture resolution of a user based on how that user is being viewed by the other participants in the call, especially going from lower to higher resolutions.


Is there a way to mitigate this when using webrtc ? Using applyConstraints on a 720p MediaStreamTrack for obtaining a 360p stream produces the same result as shown in the attached screenshot.


Thanks,

Jaya


720vs360_capture.png


Eric Davies

unread,
Aug 9, 2020, 4:07:51 PM8/9/20
to discuss-webrtc
The second picture is showing less extent in both X and Y.
I think the two images were taken with different zoom values (optical or digital) or possibly focus. I'd try doing something to disable auto zoom and auto focus to check that.

Also, try running two instances of the demo at https://webrtc.github.io/samples/src/content/getusermedia/resolution/
What I did was run the first instance at 720p, and before starting the second instance, i went to its console and typed the assignment
    vgaConstraints.video.height.exact = 360;
that way, when I clicked the vga button, I actually got a 640x360 video stream.

What i could see with the 720p was the same image (but larger) as the 360p image.
It would be curious to know if you got the same results. If you do, then in your app, you could probably cheat by first allocating a 720p stream, then allocate the 360p stream and use it for your media.

Jaya Allamsetty

unread,
Aug 10, 2020, 3:46:03 PM8/10/20
to discuss...@googlegroups.com
Thank you Eric for the suggestion, it seems to make it better but the 360p image was still cropped but it wasn't as bad as restarting the camera with the new 360p constraints.
However, thanks to Philipp Hancke, I was able to change the scaleResolutionDownBy value on the encoding from the RTCRtpSendParameters for the corresponding video track.
The image doesn't get cropped and a downsampled stream is sent by the browser, I didn't know that this would work for a unicast stream like it does in the simulcast case.

Thanks,
Jaya

--

---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/discuss-webrtc/f28cb110-00ab-4ec3-b147-8bdc28d4ddb5o%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages