aboutsummaryrefslogtreecommitdiff
path: root/.local/bin/showFace
blob: ba7bf2edbf9910db8ff3d6bd9ed3ed7d70849c59 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/sh

if [ -z "$1" ] || [ "$1" = "--help" ] || [ "$1" = "-h" ]; then
    echo "usage: showFace </dev/video device number>"
    exit 1
fi

if ! [ "$1" -eq "$1" ] 2>/dev/null; then
    echo "error: argument must be a number"
    exit 0
fi

video_device="/dev/video$1"

if [ ! -e "$video_device" ]; then
    echo "error: webcam not available at $video_device"
    exit 0
fi

mpv --demuxer-lavf-format=video4linux2 \
    --demuxer-lavf-o-set=input_format=mjpeg \
    "av://v4l2:$video_device" \
    --profile=low-latency \
    --untimed \
    --vf=hflip &