Downscaling kamerki Elgato Cam Link 4

yay linux-header
sudo modprobe v4l2loopback

ls -1 /sys/devices/virtual/video4linux # sprawdzamy które urządzenie jest wirtualne

ffmpeg -f v4l2 -framerate 25 -pix_fmt nv12 -i /dev/video0 -f v4l2 -vcodec rawvideo -vf scale=-1:720 /dev/video6

Bardziej zaawansowany skrypt, z elementami GUI:

Uwaga! Wymaga v4l2-loopback-git z AUR

#!/bin/zsh -x

if [ ! -d /sys/devices/virtual/video4linux ] || [ $(ls -1 /sys/devices/virtual/video4linux | wc -l) -eq 0 ]; then
  sudo modprobe v4l2loopback  #exclusive_caps=1 "card_label=UVC Camera 2"
fi

DEVICE_NO=19

int_handler()
{
  sudo v4l2loopback-ctl delete $DEVICE_NO
  echo EXITING;
  exit 1;
}

trap 'int_handler' INT


vdev=$(ls -1 /sys/devices/virtual/video4linux | head -n 1 | sed 's/\n//') # sprawdzamy które urządzenie jest wirtualne
dev=$(~/bin/pick-video-device.sh)
resolution=$(echo "1080p\n1920:1080\n720p\n1280:720\n480p\n853:480\n234p\n416:234" | zenity --list --column=resolution --column=resolution-value --hide-column=2 --print-column=2)
width=$(echo $resolution | awk -F: '{print $1}')
height=$(echo $resolution | awk -F: '{print $2}')

sudo v4l2loopback-ctl add \
     -n "loopy doopy ${DEVICE_NO} ${height}p" \
     -w $width \
     -h $height \
     -x 1 \
     -v \
     /dev/video$DEVICE_NO

sudo v4l2loopback-ctl set-caps /dev/video$DEVICE_NO YU12:${width}x${height}@25

#ffmpeg -f v4l2 -framerate 25 -pix_fmt nv12 -i $dev -f v4l2 -vcodec rawvideo -vf "scale=-1:480" /dev/$vdev

# this worked: 
ffmpeg -f v4l2 -pix_fmt nv12 -i $dev -f v4l2 -vf "scale=$resolution,format=yuv420p" /dev/video$DEVICE_NO