Can I use my DSLR as webcam through gphoto2 + v4l2loopback?

Turned out to be rather straightforward:

modprobe v4l2loopback

and then do this

gphoto2 --stdout --capture-movie | gst-launch-0.10 fdsrc ! decodebin2 name=dec ! queue ! ffmpegcolorspace ! v4l2sink device=/dev/video0

You should of course change the video device depending on your situation.


As of October 2017, GStreamer has been updated to 1.0 and v4l2loopback has also received some updates.

As such, the old command posted by @Reinaert Albrecht doesn't work anymore, and the new command that works now is

gphoto2 --stdout --capture-movie | gst-launch-1.0 fdsrc fd=0 ! decodebin name=dec ! queue ! videoconvert ! tee ! v4l2sink device=/dev/video0
  • decodebin2 has been replaced by decodebin
  • ffmpegcolorspace has been replaced by videoconvert
  • the tee filter has been added to account for a bug in the v4l2loopback driver (see: https://github.com/umlaeute/v4l2loopback/issues/83)

This command worked better for me:

gphoto2 --stdout --capture-movie | ffmpeg -i - -vcodec rawvideo -pix_fmt yuv420p -threads 0 -f v4l2 /dev/video1