Android SDK setResolution

Howdy, I'm facing a weird behaviour when recording a stream with Android SDK No matter what i try to set resolution for constraints - I'm always getting a recorded file that is 480x640. I used to get lower resolutions too, e.g. 384x384, 288x352, 144x175 but never anything higher than 480x640. Using setBitrate we have achieved decent video quality but the resolution is still too low. How do we set a higher resolution for a recorded stream, e.g. 1280x720?



Staff member

Are you sure that web cam on the android device supports resolution higher than 640x480 ?
What is the device and its cam on board?
It's Samsung Galaxy A02 and natively it can record video at 1920x864 at 30fps, 17mbps. Here is a ffprobe of what it can record natively:


Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '20220622_074607.mp4':
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
creation_time : 2022-06-22T04:46:20.000000Z
location : +48.2731+025.9300/
location-eng : +48.2731+025.9300/ 11 30.000000
Duration: 00:00:12.27, start: 0.000000, bitrate: 17318 kb/s
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x864, 17070 kb/s, SAR 1:1 DAR 20:9, 29.60 fps, 30 tbr, 90k tbn, 180k tbc (default)
rotate : 90
creation_time : 2022-06-22T04:46:20.000000Z
handler_name : VideoHandle
Side data:
displaymatrix: rotation of -90.00 degrees
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 256 kb/s (default)
creation_time : 2022-06-22T04:46:20.000000Z
handler_name : SoundHandle


Can we do the same with Android SDK?


Staff member
Android SDK
It's Samsung Galaxy A02
The model has Android 10 (OneUI 2.5) at start (and may be has update to Android 11). On Android 8 and higher we strongly recommend to use Android SDK 1.1 which has a newer WebRTC library vesion comparing to Android SDK 1.0. The latest build is
Please also try to reproduce the issue using media-devices-debug.apk from build archive.
Note that the resolution you set when publishing a stream is not mandatory, it may be lower if channel bandwidth between mobule device and server is not enough.