Skip to content
Till edited this page Jan 22, 2023 · 6 revisions

How to stream the preview image from a photo camera via USB

Webcam image looks noisy and blurry, but you have a top DSLR camera? Stream the preview and use it as an (expensive) webcam:

gphoto2 --stdout --capture-movie | gst-launch-1.0 fdsrc fd=0 ! decodebin name=dec ! queue ! videoconvert ! tee ! v4l2sink device=/dev/video0

Source Tested with a 5D Mark II.

Same functionality as above, but using FFmpeg instead of GStreamer:

gphoto2 --stdout --capture-movie | ffmpeg -i - -vf format=yuv420p -f v4l2 /dev/video0

This should work with all the cameras listed here.

You system might mount the camera automatically as a file system and then some gphoto2 commands outpout the error message "cannot claim device". In this case unmount the camera using your file browser or by running gio mount -s gphoto2.

Further information about gPhoto2 can be found here.

Clone this wiki locally