Genymobile / Genymobile/scrcpy
Request: multiple cameras at once
- Dominant language
- C
- Stars
- 150k
- Forks
- 13.7k
- Avg merge
- 4d 13h
- Merged PRs (30d)
- 2
Description
- [x] I have checked that a similar [feature request](https://github.com/Genymobile/scrcpy/issues?q=is%3Aopen+is%3Aissue+label%3A%22feature+request%22) does not already exist.
**Is your feature request related to a problem? Please describe.**
My phone has 4 different cameras. I'd love to be able to use >1 at a time. It'd be nice to be able to capture, for example, myself, and the thing I'm looking at the same time. Another use case, I've started making videos of some of my bicycle rides. It'd be great if I could have both a wide angle shot and a tight shot rolling at once, from the wide angle and zoom back cameras.
**Describe the solution you'd like**
Ideally I could run multiple copies of `scrcpy` with different `--camera-id`'s specified and get multiple different cameras streaming at once into different windows.
**Describe alternatives you've considered**
One alternative that likely would be acceptable for me is to stream multiple cameras as multiple different windows via a single instance of `scrcpy`. A user might be able to specify multiple different streaming things, separated by `--` or some such. This is not-optimal for me, as I can't turn cameras on and off on the fly; both cameras need to be configured ahead of time and stay on. But it would be better than what I have now.
One thought I had but wasn't able to follow up on is maybe it's possible to create multiple different multiple serial links to my phone and that maybe that might help. I don't know `adb` very well nor it's technical limitations, but I poked around for a bit & I don't think I got anywhere in terms of setting up multiple connections. One thing I tried here was seeing if I could use -P port to maybe launch multiple adb servers at once and have them each pair. I was able to pair from each server, but they both listed the same serial id, and I'm not sure if this was helping at all. I couldn't find any way to point scrcpy at different adb ports, and don't know if that makes sense/is a thing.
Nightmare scary mode (to me)_might be trying to make one `scrcpy` somehow blit multiple cameras or screens together in some way. That seems like it would be hard to configure well.
**Additional context**
I am using adb-over-wifi serial to talk to a Samsung S22, with Android 13. Right now I'm on a Windows 11 box. (I should try again once I get this beefy desktop machine's dual boot running again!)
I'm trying to run scrcpy twice, as so:
```sh-session
$ scrcpy -s adb-R5CRC3MLEFK-Po0SPe._adb-tls-connect._tcp. --no-audio --video-bit-rate=2M --video-source=camera --camera-size=960x720 --camera-id=0 --window-title=phonecam-back
$ scrcpy -s adb-R5CRC3MLEFK-Po0SPe._adb-tls-connect._tcp. --no-audio --video-bit-rate=2M --video-source=camera --camera-size=960x720 --camera-id=1 --window-title=phonecam-front
```
When I start the second scrcpy, the first instance dies as so, closing the window, and then the new scrcpy window starts up with the desired video camera (as normal, without trouble):
```
[server] WARN: Camera disconnected
[server] WARN: Camera capture failed: frame 121
[server] WARN: Camera capture failed: frame 122
[server] WARN: Camera capture failed: frame 123
[server] WARN: Camera capture failed: frame 124
[server] WARN: Camera capture failed: frame 125
[server] WARN: Camera capture failed: frame 120
WARN: Device disconnected
```
One additional bit of context, I can run either the front or back camera while also capturing the screen. Ex of that invocation:
```sh-session
$ scrcpy -s adb-R5CRC3MLEFK-Po0SPe._adb-tls-connect._tcp. --no-audio --video-bit-rate=3M --window-title=phone
```
I've also played with various settings some, to no effect. I've tried running one stream with `--audio-source=mic` and one with `--audio-source=output`. I've tried with one `--no-audio` and the other a source. I've tried using some other resolutions (640x480). I've tried `--video-codec=h264` and each of the 4 different `--video-encoder` options shown for h264 in `--list-encoders` (full list: `OMX.google.h264.encoder c2.qti.avc.encoder OMX.qcom.video.encoder.avc c2.android.avc.encoder`). One thing that I thought was promising was to specify a `--port=28183:28199` non-default port for the second camera, but that didn't help. So far none of these have made a difference that I've seen.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the two `scrcpy` commands using distinct `--camera-id` values over the shown adb-over-Wi-Fi connection, and compare them with simultaneous camera and screen capture. The payload names no source files or tests; done means multiple camera streams remain active in separate windows without the first instance reporting camera or device disconnection.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, c
- Domain
- audio-video-rtc, mobile-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100