first commit

This commit is contained in:
2026-05-26 19:25:02 +09:00
commit 972392a192
5 changed files with 131 additions and 0 deletions

29
cam Executable file
View File

@@ -0,0 +1,29 @@
#!/bin/sh
if [ -n "$1" ]; then
out=$1
keep=1
else
out=$(mktemp --suffix=.png)
keep=
fi
conf=$(mktemp)
trap 'rm -f "$conf"; [ -z "$keep" ] && rm -f "$out"' EXIT
printf 's screenshot-to-file "%s" ; quit\n' "$out" > "$conf"
mpv av://v4l2:/dev/video0 \
--demuxer-lavf-format=video4linux2 \
--demuxer-lavf-o=input_format=mjpeg,video_size=1280x720 \
--profile=low-latency \
--force-window=immediate \
--geometry=50%:50% \
--input-conf="$conf" \
--title=cam --osd-msg1="s: snap q: cancel" \
--really-quiet 2>/dev/null
[ -s "$out" ] || exit 0
[ -n "$keep" ] && exit 0
xclip -selection clipboard -t image/png -loops 1 < "$out" &
sleep 0.1