aboutsummaryrefslogtreecommitdiff
path: root/.local
diff options
context:
space:
mode:
authortdro <tdro@users.noreply.github.com>2023-01-19 19:03:46 -0500
committertdro <tdro@users.noreply.github.com>2023-01-19 19:03:46 -0500
commit63013a24b3203e78bf75eec9290c9cb70fc715d7 (patch)
tree7d246fb24231bac638e322136b95d42694299b7e /.local
parent250c3de3aa2a4a8cd20173094ba016f8d01c95c5 (diff)
downloaddotfiles-63013a24b3203e78bf75eec9290c9cb70fc715d7.tar.gz
dotfiles-63013a24b3203e78bf75eec9290c9cb70fc715d7.tar.bz2
dotfiles-63013a24b3203e78bf75eec9290c9cb70fc715d7.zip
.config/nixpkgs: Add gstream camera
Diffstat (limited to '.local')
-rwxr-xr-x.local/bin/camera-gstream2
-rwxr-xr-x.local/bin/camera-mplayer28
-rwxr-xr-x.local/bin/mplayer-camera5
-rwxr-xr-x.local/bin/virtual-camera7
4 files changed, 30 insertions, 12 deletions
diff --git a/.local/bin/camera-gstream b/.local/bin/camera-gstream
new file mode 100755
index 0000000..3b54380
--- /dev/null
+++ b/.local/bin/camera-gstream
@@ -0,0 +1,2 @@
+#!/bin/sh -eu
+gst-launch-1.0 -v v4l2src device=/dev/video0 ! glimagesink
diff --git a/.local/bin/camera-mplayer b/.local/bin/camera-mplayer
new file mode 100755
index 0000000..73f592f
--- /dev/null
+++ b/.local/bin/camera-mplayer
@@ -0,0 +1,28 @@
+#!/bin/sh -eu
+
+program=$(basename "$0")
+option=${1:-0@9}
+real=${option%%@*}
+virtual=${option#*@}
+
+{
+ [ "$option" = "help" ] ||
+ [ "$option" = "-help" ] ||
+ [ "$option" = "--help" ]
+} &&
+ printf '%s 0@9\n# /dev/video0 -> /dev/video9\n' "$program" &&
+ exit
+
+{
+ [ "$option" = "kill" ] ||
+ [ "$option" = "-kill" ] ||
+ [ "$option" = "--kill" ]
+} &&
+ killall mplayer &&
+ killall mplayer &&
+ killall ffmpeg &&
+ exit
+
+ffmpeg -i "/dev/video$real" -f v4l2 -vcodec rawvideo -pix_fmt rgb24 "/dev/video$virtual" &
+sleep 2
+mplayer tv:// -tv "driver=v4l2:device=/dev/video$virtual" -fps 15
diff --git a/.local/bin/mplayer-camera b/.local/bin/mplayer-camera
deleted file mode 100755
index 996c79f..0000000
--- a/.local/bin/mplayer-camera
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh -eu
-program=$(basename "$0")
-[ "$#" = 0 ] && printf '%s 9\n# /dev/video9 -> mplayer\n' "$program" && exit
-[ "$1" = kill ] && killall --quiet -9 mplayer
-mplayer tv:// -tv "driver=v4l2:device=/dev/video$1" -fps 15
diff --git a/.local/bin/virtual-camera b/.local/bin/virtual-camera
deleted file mode 100755
index 0ea6f76..0000000
--- a/.local/bin/virtual-camera
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh -eu
-program=$(basename "$0")
-option=${1:-}
-real=${option%%@*}
-virtual=${option#*@}
-[ "$#" = 0 ] && printf '%s 0@9\n# /dev/video0 -> /dev/video9\n' "$program" && exit;
-ffmpeg -i "/dev/video$real" -f v4l2 -vcodec rawvideo -pix_fmt rgb24 "/dev/video$virtual"