Snellcom
Personal Projects

Android Phone as a Webcam on Fedora (via android-ip-camera)

Turning an Android phone into a virtual webcam that Zoom, Meet, Firefox and Discord all accept, using v4l2loopback and ffmpeg.

Android Phone as a Webcam on Fedora (via android-ip-camera)

Turns your phone into a virtual webcam usable in Zoom, Chrome/Meet, Firefox, and Discord on Fedora, using android-ip-camera + v4l2loopback + ffmpeg.


1. Phone setup

  1. Install android-ip-camera on your phone — from GitHub Releases, F-Droid, or Obtainium.
  2. Open the app, go to Settings:
    • Set stream mode to MJPEG
    • Turn off TLS/HTTPS (plain HTTP avoids ffmpeg fighting the app's self-signed cert — fine on a trusted home network)
    • Optionally set a username/password
  3. Start the server. Note the IP address and port shown (default port 4444), e.g. 10.10.1.11:4444.
  4. Make sure the phone and your Fedora machine are on the same WiFi network.

2. Fedora: install packages

# Enable RPM Fusion (not on by default)
sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm

# Install what's needed
sudo dnf install akmod-v4l2loopback v4l2loopback-utils ffmpeg

Reboot afterward so the kernel module builds against your running kernel.

Confirm your user is in the video group (usually automatic on Fedora, but check):

groups $USER

If video isn't listed: sudo usermod -aG video $USER, then log out and back in.


3. Create the virtual camera device, persistently

echo "v4l2loopback" | sudo tee /etc/modules-load.d/v4l2loopback.conf
echo 'options v4l2loopback video_nr=10 card_label="AndroidIPCam" exclusive_caps=1' | sudo tee /etc/modprobe.d/v4l2loopback.conf

exclusive_caps=1 is required — without it, the device advertises itself as both a capture and output device, which Firefox filters out entirely (Chrome tolerates it, Firefox doesn't).

Reboot, then verify:

v4l2-ctl --list-devices

You should see AndroidIPCam at /dev/video10.


4. Auto-configure the device at boot (fixes Firefox detection)

By default, /dev/video10 reports no video format at all whenever nothing is actively writing to it — and Firefox (unlike Chrome) refuses to list a camera with no declared format. Fix this by explicitly locking the format and telling the device to remember it even when idle.

Setup script:

sudo tee /usr/local/bin/androidcam-setup.sh > /dev/null << 'EOF'
#!/bin/bash
# Wait for the loopback device to exist
for i in {1..10}; do
    [ -e /dev/video10 ] && break
    sleep 0.5
done
v4l2loopback-ctl set-caps /dev/video10 YUYV:960x720@25/1
v4l2-ctl -d /dev/video10 -c keep_format=1
EOF
sudo chmod +x /usr/local/bin/androidcam-setup.sh
Adjust 960x720@25/1 if your phone streams at a different resolution/framerate — check the ffmpeg startup output (see step 6) for the actual values, they should match.

Systemd service to run it at every boot:

sudo tee /etc/systemd/system/androidcam-setup.service > /dev/null << 'EOF'
[Unit]
Description=Configure AndroidIPCam v4l2loopback device
After=systemd-modules-load.service
Requires=systemd-modules-load.service

[Service]
Type=oneshot
ExecStart=/usr/local/bin/androidcam-setup.sh
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target
EOF

sudo systemctl daemon-reload
sudo systemctl enable androidcam-setup.service

5. Fix Firefox specifically (PipeWire camera portal)

Firefox on Linux/Wayland routes camera access through PipeWire's camera portal by default, which doesn't reliably detect v4l2loopback devices — completely separate from the raw V4L2 access Chrome uses. Chrome will work without this step; Firefox needs it.

  1. Go to about:config in Firefox
  2. Search for media.webrtc.camera.allow-pipewire
  3. Set it to false
  4. Fully restart Firefox (quit completely, not just close the window)

6. One-word command to start streaming

mkdir -p ~/.local/bin
tee ~/.local/bin/androidcam > /dev/null << 'EOF'
#!/bin/bash
ffmpeg -i "http://<PHONE_IP>:4444/video/mjpeg" -f v4l2 -pix_fmt yuyv422 -s 960x720 -r 25 /dev/video10
EOF
chmod +x ~/.local/bin/androidcam

Replace <PHONE_IP> with your phone's actual IP (check the app each time you start it, since it can change on DHCP networks — a static IP/DHCP reservation on your router avoids this).

Make sure ~/.local/bin is on your PATH:

echo $PATH | grep -q "$HOME/.local/bin" && echo ok || echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc

Everyday usage (after setup is done once)

  1. Start the server in the android-ip-camera app on your phone.
  2. In your video chat app, select AndroidIPCam as the camera.
  3. Ctrl+C in the terminal when you're done.

Open a terminal and run:

androidcam

No sudo, no modprobe, no manual device setup — steps 3–5 above only need to be done once per fresh install.