Skip to content

Instantly share code, notes, and snippets.

@usr-ein
Last active November 29, 2024 21:23
Show Gist options
  • Save usr-ein/6bbfbd2445865cb8118e56c87d55e597 to your computer and use it in GitHub Desktop.
Save usr-ein/6bbfbd2445865cb8118e56c87d55e597 to your computer and use it in GitHub Desktop.
Make Elgato Cam Link 4K work on GNU Linux (tested in debian 4.19.0-9-amd64)
#!/usr/bin/env bash
# You need to run
# sudo apt install v4l2loopback-utils v4l2loopback-dkms
# And restart your computer after that so that it reloads the kernel (just in case)
# Creates a dummy device
sudo modprobe v4l2loopback devices=1 exclusive_caps=1
# Find the dummy device file path
V4LOOP=$(v4l2-ctl --list-devices | grep Dummy -A 1 | tail -n 1 | tr -d '\t')
echo "Video4Linux loop device is $V4LOOP"
# Find the cam link device file path
ELGATO=$(v4l2-ctl --list-devices | grep 'Cam Link' -A 1 | tail -n 1 | tr -d '\t')
echo "Elgato Cam Link loop device is $ELGATO"
# Streams the elgato to the dummy, decoding the weird encoding on the fly
# Don't change the resolution/framerate, the driver will change it back anyway
ffmpeg -f v4l2 -input_format yuyv422 -framerate 60 -video_size 1920x1080 -i "$ELGATO" -vf hflip -pix_fmt yuyv422 -f v4l2 "$V4LOOP"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment