tb-dotfiles/chezmoi/dot_zshrc.d/executable_camera.zsh
2022-04-22 10:06:53 -04:00

18 lines
418 B
Bash

if command -v mpv &> /dev/null && command -v fzf &> /dev/null; then
if [[ "$OSTYPE" = linux* ]]; then
function camera() {
(
set -euo pipefail
printf "%s\0" /dev/video* |
fzf --print0 --read0 -m -1 --height="$((LINES/4))" |
xargs -0 -P 0 -I {} mpv \
-vf=hflip \
--demuxer-lavf-format=video4linux2 \
--demuxer-lavf-o-set=input_format=mjpeg \
av://v4l2:{}
)
}
fi
fi