From 98f028c0079a2d3faadd4e90757ebb3e940dac02 Mon Sep 17 00:00:00 2001 From: meliurwen Date: Thu, 10 Mar 2022 16:26:14 +0100 Subject: [PATCH] Decreased latency in webcam script --- i3/.config/i3/scripts/webcam-toggle.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/i3/.config/i3/scripts/webcam-toggle.sh b/i3/.config/i3/scripts/webcam-toggle.sh index 14f8b31..8487a62 100755 --- a/i3/.config/i3/scripts/webcam-toggle.sh +++ b/i3/.config/i3/scripts/webcam-toggle.sh @@ -1,12 +1,19 @@ #!/bin/sh -pkill -f /dev/video || \ +CAMERA=${CAMERA:-/dev/video0} + +pkill -f "$CAMERA" || \ mpv --title="mpv-floating-window" \ --no-config \ --no-osc \ --no-input-default-bindings \ --input-conf=/dev/null \ - -vo=gpu \ + --vo=gpu \ --geometry=-0-0 \ --autofit=30% \ - av://v4l2:/dev/video0 + --profile=low-latency \ + --untimed \ + --demuxer-lavf-format=video4linux2 \ + --demuxer-lavf-o-set=input_format=mjpeg \ + --demuxer-lavf-o=video_size=320x240\ + "$CAMERA"