From a912db8044b682c479f8354cca1f619b9cabec67 Mon Sep 17 00:00:00 2001 From: Joe Groocock Date: Sun, 23 Aug 2020 02:21:01 +0100 Subject: [PATCH] systemd: add gphoto2-ffmpeg user service Streams 720p25 video from a gphoto2-compatible camera through ffmpeg into /dev/video* for use as a generic video/camera device. Signed-off-by: Joe Groocock --- systemd/user/gphoto-ffmpeg@.service | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 systemd/user/gphoto-ffmpeg@.service diff --git a/systemd/user/gphoto-ffmpeg@.service b/systemd/user/gphoto-ffmpeg@.service new file mode 100644 index 0000000..978ff2d --- /dev/null +++ b/systemd/user/gphoto-ffmpeg@.service @@ -0,0 +1,15 @@ +[Unit] +Description=GPhoto2 capture with ffmpeg encoding + +[Service] +Type=simple +ExecStartPre=gphoto2 --abilities +ExecStart=/bin/sh -c 'exec gphoto2 --set-config /main/capturesettings/continuousaf=1 --set-config /main/capturesettings/focusmode="AI Servo" --set-config /main/imgsettings/whitesbalance=Tungsten --capture-movie --stdout --set-config viewfinder=0 | ffmpeg -i - -f rawvideo -vf "crop=iw:iw*9/16" -pix_fmt yuv420p -threads 0 -s:v 1280x720 -r 25 -f v4l2 /dev/video%i' +ExecStop=/bin/kill $MAINPID +ExecStop=-/usr/bin/gphoto2 --set-config viewfinder=0 +Restart=always +RestartSec=5 +Slice=app.slice + +[Install] +WantedBy=default.target