Skip to content

Instantly share code, notes, and snippets.

@vincens2005
Created August 1, 2021 17:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vincens2005/80b21fa86685835a151764844069e3a8 to your computer and use it in GitHub Desktop.
Save vincens2005/80b21fa86685835a151764844069e3a8 to your computer and use it in GitHub Desktop.
creates a virtual webcam with ffmpeg and v4l2loopback
#!/bin/bash
# WTFPL license
# You might need to change /dev/video2 to something different depending on what hardware you have plugged in
sudo modprobe v4l2loopback
echo "Enter the file path (no spaces):"
read filepath
echo starting stream...
ffmpeg -re -stream_loop -1 -i $filepath -vcodec rawvideo -pix_fmt yuv420p -threads 0 -f v4l2 /dev/video2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment