On Mon, May 25, 2020 at 05:00:50PM +0200, Éloi Rivard wrote:
> Hi. I hope this won't be too off-topic.
> 
> Using gphoto2 + ffmpeg + v4l2 works very well to use a camera as a
> webcam. However it requires some computers skills to achieve since you
> have to install packages, play with kernel modules, and then launch
> gphoto2 + ffmpeg each time you need to use your webcam.
> 
> I was wondering what technically prevents to make the whole process
> automatic : just plug your camera and it your system detects it as a
> webcam. Do you have ideas on this?

There is not much that needs to be done for this.

- add udev rules to trigger a systemd service
- systemd service could just run a variant of:

  Once in a system startup (PreExec)

        modprobe v4l2loopback exclusive_caps=1 card_label="GPhoto2 Webcam" 


   in systemd service do something like this loop: 

   while /bin/true
   do
        # detect the device we need to use
        device=`v4l2-ctl --list-devices | while read header; do echo $header | 
grep v4l2loopback > /dev/null && read device && echo $device ; done`

        echo "Starting preview capture feed to $device ... "

        # run gphoto2 feeding to this device
        gphoto2 --stdout --capture-movie | ffmpeg -i - -vcodec rawvideo 
-pix_fmt yuv420p -threads 0 -f v4l2 $device
   done


CIao, Marcus


_______________________________________________
Gphoto-devel mailing list
Gphoto-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gphoto-devel

Reply via email to