Use the phone as a webcam
Note
This feature is not in a release yet. It is planned for Tetheron 0.5.0. The latest release, 0.4.1, does not have it.
The phone’s camera becomes available to video call apps and browsers on the desktop as a camera named Tether Phone Camera.
Before you begin
You need:
- The enhanced tier set up and ready for the phone. See Set up the enhanced tier. The group Webcam appears on the phone’s Overview tab only then.
- Administrator rights on the desktop, once, to create the virtual camera.
- The kernel module
v4l2loopback. The Tetheron package suggests it but does not install it, because it brings a compiler and kernel headers with it. The tarball’s install script does not install it either.
In the commands, replace <id> with the device id, or a unique prefix of it,
from tether-cli devices.
Set up the virtual camera
The virtual camera is a device on the desktop that Tetheron feeds with the phone’s picture. You set it up once per desktop.
-
Install the kernel module:
sudo apt install v4l2loopback-dkms v4l2loopback-utilsOn Fedora, enable RPM Fusion Free and run
sudo dnf install akmod-v4l2loopback. On Arch Linux, runsudo pacman -S --needed v4l2loopback-dkms v4l2loopback-utils linux-headers, with the headers package of the kernel you run. The Virtual camera dialog shows the command for your distribution. -
In the Tetheron app, select the phone and open the Overview tab.
-
In the group Webcam, press Set up… in the row Virtual camera. The dialog Virtual camera opens.
-
If the dialog says One package is missing, do step 1 and press Check again.
-
Switch on Create it at every start if the camera should survive a restart of the desktop. Otherwise it is gone after a restart and you repeat this set-up.
-
Press Set up. Nothing is loaded into the kernel before that.
-
Enter your password in the system’s prompt. It reads “Authentication is required to set up the virtual camera that shows your phone’s camera”.
The dialog now says The virtual camera is ready and names the device,
for example /dev/video42.
Later, the same dialog offers Always create when the camera exists only until the next restart, and Stop when it is created at every start. Both ask for the password again.
From the command line:
tether-cli webcam-setup status
tether-cli webcam-setup load
tether-cli webcam-setup persist
tether-cli webcam-setup remove
| Action | Effect |
|---|---|
status | Prints the state: unsupported, not_installed, not_loaded, no_device or ready, the device, and whether it is created at every boot. The default action. |
load | Creates the virtual camera now. It lasts until the desktop restarts. |
persist | Like load, and creates the camera at every boot. Writes /etc/modprobe.d/tether-webcam.conf and /etc/modules-load.d/tether-webcam.conf. |
remove | Deletes those two files. The camera that exists now stays until the desktop restarts. |
load, persist and remove ask for an administrator password.
Start and stop the webcam
- On the phone’s Overview tab, switch on Use as webcam in the group Webcam. If the virtual camera is not set up yet, the Virtual camera dialog opens first.
- Wait for the line under the switch to read On. Choose “Tether Phone Camera” as the camera in the call app.
- In the call app or the browser page, open the camera list and choose Tether Phone Camera. Call apps list the camera only while the switch is on. If the app was open before, open its camera list again.
The phone’s camera stays on until you switch Use as webcam off, even when no app on the desktop looks at the picture. The phone shows its camera indicator and uses more battery. Switch it off when the call is over.
From the command line:
tether-cli webcam <id> on
tether-cli webcam <id> off
tether-cli webcam <id>
Without an action the command prints the state, what is streaming and the settings.
The picture is 1280 × 720 at 30 frames per second by default. To change
that, set webcam_size and webcam_fps. See
Configuration and files.
The webcam uses whichever adb connection the enhanced tier has. When USB and Wireless debugging are both available as the helper starts, Tetheron uses USB. A cable that is plugged in later does not move a running helper. To switch, restart the helper.
Adjust the picture
While the switch is on, the group Webcam shows these controls. They take effect at once, also during a call.
| Control | What it does | Command |
|---|---|---|
| Camera | Chooses the front or the back camera, or one of several on phones that have more. Shown when the phone has more than one camera. | tether-cli webcam <id> camera front, camera back or camera <camera id> |
| Rotation | Turns the picture a quarter turn anticlockwise or clockwise per press. | tether-cli webcam <id> rotate <0, 90, 180 or 270> |
| Mirror the picture | Swaps left and right. | tether-cli webcam <id> flip on or flip off |
| Torch | Switches the light next to the camera. Shown when the chosen camera has one. Off again every time the webcam is switched on. | tether-cli webcam <id> torch on or torch off |
| Zoom | Zooms in, up to what the chosen camera allows. Shown when the camera can zoom. | tether-cli webcam <id> zoom <factor, 1.0 or more> |
Tetheron does not follow how the phone is held. If the picture lies on its side, use Rotation. The picture is fitted into the fixed frame with bars where needed.
Camera, rotation, mirroring and zoom are remembered per phone. The row
Streaming now shows which camera is in use, what the phone sends and what
call apps get. tether-cli webcam <id> cameras lists the phone’s cameras
with their ids, sizes and frame rates.
Remove the virtual camera
- Switch Use as webcam off.
- If the camera is created at every start, open the Virtual camera
dialog and press Stop, or run
tether-cli webcam-setup remove. - Restart the desktop. The camera device disappears with the restart.
To remove the kernel module as well, uninstall the packages from step 1 of the set-up.
If something does not work
| What you see | Cause and remedy |
|---|---|
| No group Webcam on the Overview tab | The enhanced tier is not ready, or the helper cannot use the camera on this phone. Check the group Phone screen. |
| One package is missing | v4l2loopback is not installed for the running kernel. Install it and press Check again. After a kernel update, the module may need to be rebuilt by DKMS first. |
| A message that Secure Boot rejected the virtual camera driver | The module’s signing key is not enrolled. Follow the command in the message to enrol the machine owner key, restart, confirm, and try again. Tetheron cannot do this for you. |
A message that v4l2loopback is already loaded without a “Tether Phone Camera” device | Another program, such as OBS, loaded the module first, and the installed version cannot add a device. Close the programs that use it, run sudo modprobe -r v4l2loopback and try again. |
persist refuses because another file already sets options for v4l2loopback | Add a device with the label Tether Phone Camera in that file. |
| Not available on this computer | The daemon was built without webcam support, or GStreamer’s v4l2sink is missing. |
| Tether Phone Camera is not in the call app’s list | Switch Use as webcam on before you open the list. |
| The camera is in use on the phone | Another app on the phone opened the camera, which takes it away from the webcam. Close that app. Tetheron tries again a few times, then waits until you toggle the switch. |
| The camera is switched off on the phone (privacy switch or device policy) | Switch camera access back on on the phone, then toggle Use as webcam. |
| A message that another phone is the webcam | One phone at a time feeds the virtual camera. Switch the webcam off on the other phone first. |
Every option of tether-cli webcam and tether-cli webcam-setup is listed
in Command-line tools. Why the feature needs a kernel
module is explained in
About screen mirroring, app windows and the webcam.