Genymobile / scrcpy

Display and control your Android device
Apache License 2.0
109.12k stars 10.49k forks source link

package h264 output as video capture device for use by other apps #1304

Open solnyshok opened 4 years ago

solnyshok commented 4 years ago

I would like to use scrcopy output in other apps, as video capture device. For example this would allow to use instagram app video effects camera and then feed it to skype, zoom, twitch, obs, etc.

There is already part of the solution (as I see it, could be wrong of course) in ws-scrcopy fork (websocket server). Maybe could process it with v4l2loopback tools to make virtual "videocam" in linux.

unfortunately do not know of similar library in windows. but there are windows apps, e.g. xsplit-vcam or chromacam - which create such devices on windows too. but there is a code for obs plugin that simulates virtual webcam under Windows. https://github.com/CatxFish/obs-virtual-cam

image

image

solnyshok commented 4 years ago

// added reference to obs-virtual-cam plugin as possible source of code for windows solution.

rom1v commented 4 years ago

A v4l2 device with v4l2loopback would be great :+1:

tcboy88 commented 4 years ago

This feature will be great, I want to use the screen capture frames directly to Tensorflow using Python-OpenCV. Hope it will be available =)

sakibdev commented 4 years ago

That feature would be great. Please add soon. Thanks

TruthAI commented 4 years ago

i'm upping this also, this feature would not be great only but awsome in fact :D obs-virtual-cam plugin and other solutions seem to decrease the video FPS and add latency..

pranshuthegamer commented 4 years ago

i want it too

mmBesar commented 3 years ago

Great to have.

ajayvarghese2000 commented 3 years ago

This would be so good. All the other solutions require extra apps and provide mediocre quality and framerate. If scrcpy could clone the screen as a virtual webcam it could be an even more powerful tool than it already is, especially with the current situation the world is in.

jmichael2497 commented 3 years ago

if scrcpy is pulling a hardware encoded h264 feed of the phone display, is that something with an ip based web address i might be able to use? basically could vlc open the stream?

if so, then the cross platform https://github.com/webcamoid/webcamoid uses ffmpeg to read inputs and it should be able to handle streams of video over http or rtsp for example, to turn that input into a virtual camera feed.

considering how smooth the scrcpy phone stream is, it seems like it could be part of a lighter foss solution to repurpose older phones as webcams (i've yet to find recommendations for w10 that aren't closed source or that require heavy solutions like installing obs).

rom1v commented 3 years ago

A v4l2 device with v4l2loopback would be great +1

Here it is: https://github.com/Genymobile/scrcpy/pull/2268