neige d'aout

knowledge, art, and other stuff

User Tools

Site Tools


v4l2loopback

This is an old revision of the document!


v4l2loopback

Setup

Automatically load module

/etc/modules-load.d/v4l2loopback.conf
v4l2loopback
/etc/modprobe.d/v4l2loopback.conf
options v4l2loopback devices=0 exclusive_caps=1

With devices=0, it won't create any /dev/video device by default. You can use v4l2loopback-ctl to create one later.

Give user access to v4l2loopback-ctl

/etc/udev/rules.d/60-v4l2loopback.rules
KERNEL=="v4l2loopback", GROUP="video"

Then you can add your user to group video:

# usermod -aG video yuki

Use a GoPro HERO3 as a webcam

~/.local/bin/goprocam
function api()
{
  curl -sS http://10.5.5.9/$1 -o$2
}
 
# Make sure we're on the GoPro wifi
nmcli c s --active | grep GoPro > /dev/null
if [ $? -eq 1 ]
then
  echo "Error: not connected to GoPro"
  exit 1
fi
 
# Create the video device and delete it on script exit
DEVICE=$(v4l2loopback-ctl add -n "GoPro")
function rmdevice()
{
  v4l2loopback-ctl delete $DEVICE
}
trap rmdevice EXIT
 
# Make sure preview is on
PASSWORD=$(api bacpac/sd - | strings)
api "camera/pv?t=$PASSWORD&p=%02" /dev/null
 
ffmpeg -hide_banner -loglevel error -stats -i "http://10.5.5.9:8080/live/amba.m3u8" -vf format=yuv420p -f v4l2 $DEVICE

See also

v4l2loopback.1782693501.txt.gz · Last modified: by Yuki