Genymobile / scrcpy

Display and control your Android device
Apache License 2.0
112.25k stars 10.73k forks source link

OBS broadcast into my android's camera. #5167

Closed qqlvl closed 3 months ago

qqlvl commented 3 months ago

I've been trying to solve this problem for a long time, tell me if it's possible at all, I accidentally found this guide on the Internet, and I'm trying through Scrcpy and OBS to connect to my android camera that- to output my image to it, but so far without success.

I can't start the broadcast in OBS, I tried to do it by the IP I see in CMD when I connect to my android via tcpip, but it doesn't work.

Can you tell me if this is possible at all?

Also, if I use scrcpy, when I open the camera in the apps, the connection is immediately dropped, can this be fixed?

  1. Install Screen Mirroring/Streaming App: You'll need to install a screen mirroring or streaming app on your Android device. Some popular options include "ApowerMirror," "Screen Stream Mirroring," or "Scrcpy." These apps allow you to display your computer screen on your Android device.

  2. Connect Your Android Device: Ensure your computer and Android device are connected to the same Wi-Fi network. Open the screen mirroring app on your smartphone.

  3. Configure OBS Studio: In OBS Studio, set up your desired scene with the content you want to feed into the camera app. Go to "Settings" > "Stream" in OBS Studio. Select "Custom Streaming Server" as the service. In the "URL" field, enter the IP address and port displayed in the screen mirroring app on your Android device. Click "OK" to save the settings.

  4. Start Streaming: Back in OBS Studio, click "Start Streaming" to send your scene to the specified IP address and port. View the Feed on Your Android Device: On your Android device, you should see the OBS Studio feed in the screen mirroring app.

  5. Open the Camera App: While the OBS feed is displayed on your Android device, open your native camera app. You should now be able to capture images or videos with the content coming from OBS Studio.

rom1v commented 3 months ago

On Linux, you can use the v4l2 feature to send the scrcpy capture to v4l2, and capture v4l2 in OBS: https://github.com/Genymobile/scrcpy/blob/master/doc/v4l2.md

On other platforms, you can display your camera in a window on the computer, and capture the window in OBS (which is not ideal).

qqlvl commented 3 months ago

В Linux вы можете использовать функцию v4l2 для отправки записи scrcpy на v4l2 и захвата v4l2 в OBS: https://github.com/Genymobile/scrcpy/blob/master/doc/v4l2.md

На других платформах вы можете отображать свою камеру в окне на компьютере и захватывать окно в OBS (что не идеально).

So if I do that, I can stream anything to my android camera?

And if I stream from my phone to Instagram for example, my OBS video will be there?

I'm asking to make sure that we understand each other correctly, because now I can not even open the camera on android if scrcpy is running because it immediately crashes

rom1v commented 3 months ago

So if I do that, I can stream anything to my android camera?

Oh sorry, I misunderstood your request, it's the other way around: you cannot inject a video stream to your device camera.

I can not even open the camera on android if scrcpy is running because it immediately crashes

If you open an app using your camera while scrcpy is using your camera, the camera for scrcpy will be terminated so scrcpy will close, that's "expected".