Created
March 3, 2023 06:11
-
-
Save IamNaN/9934aa2fbd64e3c05b3603c3592c3163 to your computer and use it in GitHub Desktop.
Ruby script to reset and start a DSLR or Mirrorless camera as a webcam using gphoto2, v4l2loopback, and ffmpeg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
system("sudo modprobe -r v4l2loopback") | |
system("pkill gphoto") | |
system("sudo modprobe v4l2loopback exclusive_caps=1 max_buffers=2") | |
system("gphoto2 --stdout --capture-movie | ffmpeg -i - -vcodec rawvideo -pix_fmt yuv420p -threads 0 -f v4l2 /dev/video0") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment