Skip to content

Instantly share code, notes, and snippets.

@kiyoon
Last active December 2, 2021 10:22
Show Gist options
  • Save kiyoon/5be3809f708e63edce063a3188868b8c to your computer and use it in GitHub Desktop.
Save kiyoon/5be3809f708e63edce063a3188868b8c to your computer and use it in GitHub Desktop.
Canon Camera Webcam with Ubuntu
# https://community.usa.canon.com/t5/Camera-Software/When-available-Canon-EOS-Utility-for-Linux-Ubuntu/td-p/314449
# https://www.crackedthecode.co/how-to-use-your-dslr-as-a-webcam-in-linux/
pkill -9 gvfs-gphoto2-volume-monitor
pkill -9 gvfsd-gphoto2
# CPU
gphoto2 --stdout --capture-movie | ffmpeg -i - -vcodec rawvideo -pix_fmt yuv420p -threads 0 -f v4l2 /dev/video0
# GPU
# You might have to do this:
#export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
gphoto2 --stdout --capture-movie | ffmpeg \
-hwaccel nvdec \
-c:v mjpeg_cuvid \
-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