There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

Everything wrong with DroidCam and how to solve it

DroidCam is a freemium application which allows you to use your phone as a web camera (thus getting a better picture quality for meetings than ordinary webcams)

So, needless to say, it’s very helpful.

Now, I have been facing a number of issues with this application for a few days and I felt it would be best if I just share stuff regarding how I make it work seamlessly, it won’t look good when you are late for a meeting because you are troubleshooting droidcam, so here’s how I use it.

  1. v4l2loopback package can cause a lot of problems, so, I would suggest you to download it from source, you can do that using this script given below (this also installs droidcam on your linux computer)

This isn’t the most efficient script there is, but it works.

First, run the command

vim installation_droidcam.sh && chmod +x installation_droidcam.sh

(you might have vi editor installed by default, so if you don’t have vim, just replace vim with vi, if neither are available, run sudo apt install vim, I personally use featherpad)

Now, paste the below script into your text editor (this doubles as a reinstallation script too, but if you want the latest and greatest, you would have to replace the installation commands of droidcam given below with whatever is available here on the official website


<span style="color:#323232;">#!/bin/bash
</span><span style="color:#323232;">
</span><span style="color:#323232;">cd ~
</span><span style="color:#323232;">
</span><span style="color:#323232;">pkill droidcam
</span><span style="color:#323232;">
</span><span style="color:#323232;">sudo /opt/droidcam-uninstall
</span><span style="color:#323232;">
</span><span style="color:#323232;"># installation script for droidcam
</span><span style="color:#323232;"># if you want the latest version, go to
</span><span style="color:#323232;"># https://www.dev47apps.com/droidcam/linux/
</span><span style="color:#323232;">cd /tmp/
</span><span style="color:#323232;">wget -O droidcam_latest.zip https://files.dev47apps.net/linux/droidcam_2.1.3.zip
</span><span style="color:#323232;"># sha1sum: 2646edd5ad2cfb046c9c695fa6d564d33be0f38b
</span><span style="color:#323232;">unzip droidcam_latest.zip -d droidcam
</span><span style="color:#323232;">cd droidcam && sudo ./install-client
</span><span style="color:#323232;"># end of installation script
</span><span style="color:#323232;">
</span><span style="color:#323232;">
</span><span style="color:#323232;">cd ~
</span><span style="color:#323232;">
</span><span style="color:#323232;">sudo rm -r v4l2loopback
</span><span style="color:#323232;">
</span><span style="color:#323232;">pkill droidcam
</span><span style="color:#323232;">
</span><span style="color:#323232;">
</span><span style="color:#323232;">gh repo clone umlaeute/v4l2loopback
</span><span style="color:#323232;">
</span><span style="color:#323232;">cd v4l2loopback
</span><span style="color:#323232;">
</span><span style="color:#323232;">make && sudo make install $ sudo depmod -a
</span><span style="color:#323232;">
</span><span style="color:#323232;">cd ~
</span><span style="color:#323232;">
</span><span style="color:#323232;">sudo modprobe v4l2loopback
</span>

Now, save the script and exit it.

Everything required for droidcam to work has been installed on your laptop (you would still have to install Droidcam (green) on your android device and set it up over there tho, I am not gonna guide with that)

Here’s a video for that by Mental Outlaw

Now, you would have to edit the desktop entry for droicam on your laptop to include sudo modprobe v4l2loopback command, because this needs to be running for droidcam to work. So, to do that, we will create another script

run vim /home/$USER/droidcam_start_menu_libre_desktop_file.sh && chmod +x /home/$USER/droidcam_start_menu_libre_desktop_file.sh and paste the below script and save it


<span style="color:#323232;">#!/bin/bash
</span><span style="color:#323232;">
</span><span style="color:#323232;">sudo modprobe v4l2loopback
</span><span style="color:#323232;">
</span><span style="color:#323232;">/usr/local/bin/droidcam
</span>

After this, menulibre if you don’t have it already by doing sudo apt install menulibre and edit the desktop file entry for droicam such that it looks like the image below (make sure you Tick Run in Terminal) as you need to have v4l2loopback running in the background for droidcam to work.

In the command text box, you much have /home/$USER/droidcam_start_menu_libre_desktop_file.sh (location of the script we just created) and now save it.

And that’s it!

From now on, you would be able to start droidcam (while keeping droicam on on your android device) The terminal would open, enter your password and you can now connect and use your phone as a second camera (a much better second camera)

I haven’t been very articulate, so doubts are welcome

desktop entry should look like this

thepiguy ,

I just use scrcpy. They have instructions on their github.

Subject6051 OP ,

wot!? Scrcpy can double as a webcam, God, kill me now.

I have been using scrcpy to open the phone so I can turn on droidcam on it! :')

thepiguy ,

XD yea. scrcpy --video-source=camera --no-audio --v4l2-sink=/dev/video0 --no-playback this is the command I use. There are a few more config options for orientation and to select the camera.

Subject6051 OP ,

hey, thank you very much!

atzanteol ,

This is sooo verbose.

TLDR:

  1. Install the latest droidcam from github
  2. Install the latest v4l2loopback from source

And you never mention what problems this solves… I use the package manager version of v4l2loopback and have no problems, and it auto updates. And I would use a package manager version of droidcam for the same reason.

lemmyvore ,

Yeah most distros should have the droidcam module available as DKMS module, meaning you don’t have to prepare it yourself.

Jumuta ,

what do you need the droidcam module for? the v4l2loopback in the distro repos work fine for me

Chewy7324 ,

Iirc the droidcam module gives the virtual cam a proper name to be displayed in an app (e.g. browser, …).

lemmyvore ,
  • You’ll see “DroidCam” in the list of webcams.
  • It works with Skype+Chrome without the need for exclusive_caps=1.
  • The install scripts will configure v4l2loopback-dc to auto-load after reboot.

But you’re right, it also works with the standard v4l2loopback module that comes with most distros.

Subject6051 OP ,

And you never mention what problems this solves…

ah… problems like v4l2loopback not found. I used to face it a lot, and I never found the reason why it was not working in the same place (I might get one thing here and another thing there) so I tried to aggregate everything and create this post, so that people who face that issue would get this post and they won’t stay confused for a long amount of time like I did.

Subject6051 OP ,

verbose

til a new word…

Ghoelian ,

Your script uses gh, which I think is the github cli, to clone a repository.

It would be easier for most people to just do a git clone [email protected]:umlaeute/v4l2loopback (or git clone https://github.com/umlaeute/v4l2loopback). I don’t really understand why you’d use gh for something as simple as a clone tbh.

beeng ,

Do you need to setup config.usernameemail with gh clone repo

Maybe you don’t even need that for git pull?

Only thing I can think of.

velox_vulnus ,

Creating a script with privilege escalation is a terrible idea. How do I know if this does not install binaries in the root in some unknown directory?

You don’t need to do all of this - there’s probably a simpler and better way to do this. Maybe create a service, or something similar?

Subject6051 OP ,

I am hard of hearing, can you please say that slowly :')

Sorry, please explain a lil more

velox_vulnus ,

You’re running a script that you downloaded off the internet, which isn’t deterministic, with a sudo command, as opposed to using a relatively deterministic binary on a substitute server from the distro maintainers themselves. The better solution is to just use the Flatpak version of OBS, which comes with a DroidCam plugin, or Nix, or maybe Guix, if that’s what you prefer.

boredsquirrel ,
@boredsquirrel@slrpnk.net avatar

Remote Video Camera (Stream video/audio between two phones. Zero configuration.) f-droid.org/packages/org.avmedia.remotevideocam/

Ghoelian ,

That one seems to only do remote streaming over network. Droidcam can be used over a USB connection as well, which works much more reliably (than the wireless version of droidcam, at least) in my experience.

boredsquirrel ,
@boredsquirrel@slrpnk.net avatar

@jumuta

Strange, I remember there was an app for creating a video stream on Android

Jumuta ,

it says that’s for streaming between 2 android devices

Strit ,
@Strit@lemmy.linuxuserspace.show avatar

Android 14 has the option to present itself (the phone) to a computer as a USB webcam. Very handy and does not require any special software on the PC.

boredsquirrel ,
@boredsquirrel@slrpnk.net avatar

True! Over USB

Subject6051 OP ,

With every new version, I lost some liberty to do something I like in the name of security. I am not exactly excited over newer versions of android :(

GolfNovemberUniform ,
@GolfNovemberUniform@lemmy.ml avatar

Android is dying imo, especially AOSP. A14 has serious source code issues afaik and I don’t think anyone dares to say they’re not intentional.

ReversalHatchery ,

What kind of source code issues do you mean? This is the first time I hear this and I’m interested

GolfNovemberUniform ,
@GolfNovemberUniform@lemmy.ml avatar

Idk what exactly is going on there but custom ROM devs are talking about it a lot. The issues I noticed are mostly UI and animation glitches but there can be other things in the backend.

TheEntity ,

Which features do you mean? Not disagreeing with you, I’m just curious.

Subject6051 OP ,

automation & scripting. The more advanced the android, the less liberties I have over my own device in terms of customization.

mactan ,

everything about cams kinda sucks, hope the pipewire camera project can address most of it

Subject6051 OP ,

hey, what ya mean? Droidcam is actually perfect for me, I use it for Zoom, video calls, meets, you name it!

The only issue was reliability and I apparently just had to have v4l2loopback running in the background, and I solved that by creating a script and running that script to open Droidcam

boredsquirrel ,
@boredsquirrel@slrpnk.net avatar

This loopback kernel mod stuff is not needed with Pipewire. Thats the biggest issue here.

Subject6051 OP ,

With every new version, I lost some liberty to do something I like in the name of security. I am not exactly excited over newer versions of android :(

ohh… thanks! I will look into it!

boredsquirrel ,
@boredsquirrel@slrpnk.net avatar

I like that Android is way more reliable than any Laptop OS I ever used.

But true, it is very uncustomizable.

atzanteol ,

When you have something like zoom in the mix it becomes necessary though. They’re unlikely to support pipewire so presenting a camera device works nicely.

boredsquirrel ,
@boredsquirrel@slrpnk.net avatar

Yes this may be true. I wonder if XWayland-Videobridge could work here though?

  • All
  • Subscribed
  • Moderated
  • Favorites
  • [email protected]
  • random
  • lifeLocal
  • goranko
  • All magazines