(Sorry for the short length of this post, but there's not much to say! I might add some pictures of the quality, or a little more detail later. For now, however, I think this should cover the relatively-simple process to get this to work)
Actually, using just FOSS software, since I don't feel like using proprietary
software especially for something like a webcam. In this case, the software
I used was a combination of Open Camera
, scrcpy
, and OBS
, along
with v4l2loopback and an according extension for OBS to create a virtual webcam.
The way it works is simple. I used Open Camera's preview (in full-screen mode) in order to get a preview of the camera, and then I captured
that using scrcpy
, and piped that into OBS and used that as a virtual webcam. It's a lot, and there is definitely quality loss, but
it's somewhat usable.
So, of course, the first step is to download Open Camera, and enter the Camera preview settings. Then, instead of WYSIWYG, use Maximi(s|z)e preview size. Next, go to the "On screen UI" settings, and set "Immersive mode" to "Hide everything."
Finally, you can return to the camera preivew, and after a few seconds, it will become "full-screen."
Next, plug in the cell phone or tablet to the computer, and start up scrcpy. Here's the command I used:
scrcpy -s <number> --lock-video-orientation 1 -b 4m
Let me walk through the parameters. First, you need to fill in the value for -s
with the device ID, or whatever. You only need the -s
switch if you're using multiple Android devices,
so there's more than a small chance that you won't need this at all. Next, --lock-video-orientation
makes the device run in landscape, and leaves it that way, which is very useful for recording video in landscape mode
(again, if you want to change these things, consult scrcpy
's documentation.) Finally, -b
sets the bitrate so the quality of the video is tolerable.
Now, with that, you just have to capture the scrcpy window, and use the virtual camera extension (I used v4l2sink for Linux, but I recall there being an OBS Virtual Camera extension or something for Windows as well.) And that's it.
I have encountered issues with this as well, however. Namely, scrcpy
seems to have an issue where it disconnects randomly. I'm also not sure if it helps, but I've increased the screen timeout to
30 minutes. Furthermore, this thing will drain your device's battery faster than (my) chargers can charge it. So... it's an iffy solution, and I could probably get better performance by somehow writing
an app to pipe the camera output to the computer, but I don't have that kind of experience with Android development. Maybe, somewhere down the road, I'll be able to do it. But for now, this
more-than-suffices for me, because it gets the job done and doesn't use any paid or relatively-untrustworthy solutions.
An update: I've found that Open Camera's preview likes going out of focus and repeatedly refocusing when doing this, so in order to mitigate that, you can click on the three dots in the Open Camera interface, and click on the lock, which will lock the focus and (supposedly) prevent this from happening again.