obsd-bkp/dotfiles/dotfolder/.local/bin/cam-play

49 lines
880 B
Bash
Executable File

#!/usr/bin/env sh
_vid="$(sysctl -n kern.video.record)"
if [ "$_vid" = "0" ]; then
doas sysctl kern.video.record=1
echo "Allow video record on!"
elif [ "$_vid" = "1" ]; then
echo "Allow video record on!"
fi
_res_list="
1: 320x240: 30, 15
2: 352x288: 30, 15
3: 424x240: 30, 15
4: 640x360: 30, 15
5: 640x480: 30, 15
6: 800x448: 15
7: 960x540: 10
8: 1280x720: 10
"
printf '%s\n' "Choose the webcam output size: $_res_list"
printf '%s' "Choice: " >&2
read -r _choice
case $_choice in
1)
_choice_res="320x240";;
2)
_choice_res="352x288";;
3)
_choice_res="424x240";;
4)
_choice_res="640x360";;
5)
_choice_res="640x480";;
6)
_choice_res="800x448";;
7)
_choice_res="960x540";;
8)
_choice_res="1280x720";;
esac
#printf '%s\n' "${_choice_res}"
ffplay -f v4l2 -input_format mjpeg -video_size "${_choice_res}" -i /dev/video0