Skip to content

Instantly share code, notes, and snippets.

@maricn
Created November 13, 2021 13:20
Show Gist options
  • Save maricn/17346dadf400d0b93c8d1f5fbeb75fc3 to your computer and use it in GitHub Desktop.
Save maricn/17346dadf400d0b93c8d1f5fbeb75fc3 to your computer and use it in GitHub Desktop.
Use the Sony RX100m7 as a webcam. Requires `gphoto2`, `v4l2loopback-dkms`, `v4l2loopback-utils` and `ffmpeg`.
#!/bin/bash
sudo modprobe v4l2loopback devices=1 exclusive_caps=1 max_buffers=2 video_nr=2 card_label="fake-cam"
DUMMY_VIDEO=$(v4l2-ctl --list-devices | grep Dummy -A1 | tail -n1 | awk '{ print $1 }')
gphoto2 --stdout --capture-movie | ffmpeg -i - -vcodec rawvideo -pix_fmt yuv420p -threads 0 -f v4l2 "$DUMMY_VIDEO"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment