====== v4l2loopback ======
===== Setup =====
==== Automatically load module ====
v4l2loopback
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 ====
KERNEL=="v4l2loopback", GROUP="video"
Then you can add your user to group ''video'':
# usermod -aG video yuki
===== Use a GoPro HERO3 as a webcam =====
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 =====
* [[arch>v4l2loopback]]
* [[https://github.com/KonradIT/goprowifihack/tree/master/HERO3|GoPro HERO3 hacking]]