Trying to use an Android phone as webcam?

Webcams are in short supply - on back order & have long shipping times right now.
Also - an Android phone's camera usually has a higher quality than most webcams.

This is supposed to be possible - and there are apps & tutorials for it, but I haven't been able to make it work & I'm hoping some folks here may guide me past the errors somehow, please ??

For me, a USB connection is preferred, and I tried both Droidcam and Iriun, and both failed because v4l2loopback isn't there and will not install for some reason.

I have U/M 18.04.3 64 bit with kernel 5.4.6-050406 and I do not know what about my PC causes this problem:
"FATAL: Module v4l2loopback not found in directory /lib/modules/5.4.6-050406-generic"

As an example=>
The directions here are useless for my system:
https://www.dev47apps.com/droidcam/linuxx/
(And it actually looks like Dev47Apps needs to do some updating...?)

Please point me in a better direction, if possible ??
Thanks.

I haven't used the software--but you were looking for ideas, right?
Looks like you're missing a kernel module called v4l2loopback. Some search-fu shows that module lets virtual video devices connect as if they were real.

I'd have a go with installing some packages such as v4l2loopback-dkms. You can find others using the search function from synaptic (or whatever you use).

you can
~$ lsmod | grep v4l2
before and after to see whether relevant modules change

FWIW, none of those packages are installed on my mostly stock 18.04 LTS systems.

A couple of years ago I've found out a possible solution

Good luck!

Iriun Webcam is real nice if you need both a webcam and flashlight function. Its desktop software is also pretty dope — An actual GUI, compared to Droidcam's terminal-only interface.

Shame I can't get audio to work in it since it seems limited to Jack. I'll see about what other options there are to make audio with Iriun work.

Thanks for your replies Folks !!

@charles-nix :
In Synaptic it shows as v4l2loopback-dkms & v4l2loopback-utils as installed.

Doing lsmod | grep v4l2 brings this result:

videobuf2_v4l2 24576 1 uvcvideo
videobuf2_common 49152 2 videobuf2_v4l2,uvcvideo
videodev 221184 3 videobuf2_v4l2,uvcvideo,videobuf2_common
mc 53248 5 videodev,snd_usb_audio,videobuf2_v4l2,uvcvideo,videobuf2_common

Which I must confess is not helpful for me as it seems only to confirm that v4l2loopback-(whatever) is missing ??

@Ugnvs:
As posted in the OP, I already have Droidcam, but it does not work due to the reasons I posted, or something else...

@Tiox:
Even if Iriun has only video, adding a mic would be OK, but as it stands I could not even get that far.

Lots of articles I've seen appear to insist that this is both doable and working for many Ubuntu users, and it baffles me that what it needs appears to be installed - but not present as a kernel module, or some other mysterious lack.

This should be a staple item right about now as most folks have smartphones & the need for videoconferencing has exploded along with the ability to get any sort of webcam (anytime soon...) these days is just about nil.

Videoconferencing on a small (~7") tablet screen can be done - but with the need to display several people it is a poor option as compared with using the PC screen & a webcam of any sort.

Hopefully someone else here has mastered this SNAFU & will reveal the 'secrets' of it for others ?!?

Thanks Again Folks.

So you tried downloading this package and installing with apt? Because that's the Iriun Webcam desktop software which must be running it to receive a transmission from Iriun Webcam on phone.

Also; had you enabled developer tools for Android to try using the phone with USB? You shouldn't need to do this for WiFi transport but for USB transport it's necessary.

I always enable USB debugging in the dev options on all Android devices that I have & use.

As to the Iriun deb, it does the same as I described earlier, look here please:

Unpacking iriunwebcam (2.0) ...
Setting up iriunwebcam (2.0) ...
> modprobe: FATAL: Module v4l2loopback not found in directory /lib/modules/5.4.6-050406-generic
dpkg: error processing package iriunwebcam (--install):
installed iriunwebcam package post-installation script subprocess returned error exit status 1
Processing triggers for desktop-file-utils (0.23-1ubuntu3.18.04.2) ...
Processing triggers for bamfdaemon (0.5.3+18.04.20180207.2-0ubuntu1) ...
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for mime-support (3.60ubuntu1) ...
Errors were encountered while processing:
iriunwebcam

Same error - different day - still have no idea how to solve this...

Thanks.

Sorry I took so long to reply. I think it's a kernel issue. The reason I say this is because I can get iriunwebcam to work after installing dkms and v4l2loopback-dkms in Manjaro via pamac.

BTW I use Arch now.

1 Like

Yeah, somebody has to give a damn and fix how v4l2loopback-dkms works. Tried using mainline 5.6, doesn't want to play nice. (But it'ss not suppose to be in the hands of commoners like me, because I really don't know what I am doing.)

What's the working theory on why this works in Manjaro, but not in Ubuntu? What is Ubuntu doing wrong?

1 Like

On second thought, it might be less of a kernel issue and more of a headers issue. Because it seems like on Manjaro, their kernel has no headers. But i install the liquorix kernel along with its headers and everything works just fine after I enable v4l2loopback with sudo modprobe v4l2loopback exclusive_caps=1,

I am not sure what the issue is. Could it be that the Linux kernel used in 20.04 has header files that dkms can't make sense of?

Alright yeah IDK what the problem with 20.04 is. Gonna ping @wimpy and see if he can provide extra insight on this, because I am stumped. Is it the computer I am using? Is it the headers? Is it the kernel? Is it DKMS? Is it V4L? Is it the app I am trying to make work using V4L, Iriun Webcam? The problem also happens with Droidcam from what the OP said, so it has to not be Iriun Webcam because it's certainly some issue with DKMS. I have everythhing I need to my knowledge. Everything that I use with Manjaro is also in Ubuntu. Using modprobe doesn't work to fix it. I am like, so done with this.

Also, happy that I am on Manjaro and not experiencing these issues on kernel 5.6, but like, that won't even fly with Ubuntu because DKMS doesn't want to play using Liquorix kernel. You've probably lost the OP by now, but this needs to be solved soon. Especially because there are people with a vested interest in making this work because not everybody wants to use mobile apps for telecomms.

TL;DR 20.04 hurts more than 19.10 and I am so mad I don't even care anymore, fix it right now.

Wow.
Still important - still not possible - still not answered with any fix.
Major PAPER CUT here !!

Found 'webcamoid' & did a test install - would not run - error message about a 'core dump' - so I just removed it.

Supposedly one can use this to get video as a webcam device:


Sadly I see no reasonable way to get that - very, very complicated (NOT just a simple script as it claims to be...) ?!?

I can use IP Webcam on a phone to serve up a live video stream at HTTP port 8080 via browser - but it is no use with any VC apps.

All this of course seems to point back to the v4l2loopback and/or v4l2loopback-dkms parts that are somehow broken:

sudo modprobe v4l2loopback
[sudo] password for user:
modprobe: FATAL: Module v4l2loopback not found in directory /lib/modules/5.4.6-050406-generic

In my curiosity I have found this info:
For Linux Kernel >= 3.18, you need to manually build the v4l2loopback kernel module to get DroidCam work.
See the info at this link:


Again - just leaves me uncertain of what steps one would take in fixing this to make it work MINUS borking the entire system ??

Here is a sideways funny that is directly related:
OBS has an Ubuntu version and a plugin to use it as a virtual cam too - all pertinent links follow:
https://obsproject.com/download


Oh...bummer - it needs a working v4l2loopback to be usable...hmmmm.

We also have a perfectly good, fully functional Wifi or ethernet connected IP camera that is reachable for streaming via browser & IP address - but I have found no viable way to get that stream to mimic a webcam in this OS.

What fascinates me is that the IP cam streams perfectly into VLC via the RTSP protocol, IP address, port & filename - but I've no idea how to make that mimic a webcam & searching for that info brought an excess number of useless results.

How can this problem be so strongly in need of a working solution - and yet so completely unanswered, still ?!?

I just tested Droidcam on 18.04.4 and 20.04 - both work just fine. v4l2loopback compiles and sudo modprobe loads the module with no errors. Can see camera images with guvcview.

Kernels -
18.04.4 / Kernel 5.3.0-62-generic #56~18.04.1-Ubuntu SMP Wed Jun 24 16:17:03 UTC 2020
20.04 / Kernel 5.4.0-39-generic #43-Ubuntu SMP Fri Jun 19 10:28:31 UTC 2020

Headers for those kernels are installed on each respective system.

Need more details? I don't know why yours will not work.

djb

Someone mentioned that it is likely due to kernel 5.4.6-050406-generic + 18.04.3

OK...long time, no change here, so I ask this in hopes to MAYBE get this back on track:

Since my PC has kernel 5.4.6-050406-generic + U/M 18.04.3, AND;
I was totally unaware that Ubuntu uses its own 'special' kernel versions - might it work for me to roll back the kernel version, and if so=>

  • The correct way to do so (I used Ukuu...) ??
  • Any specific version, like maybe 5.4.0-39-generic #43-Ubuntu SMP which Dave_Barnes mentioned above, that might be best for this ??

Thanks for any further, helpful replies !!