Files
2021-02-13 17:25:59 +03:00

55 lines
1.0 KiB
Bash
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# a tiny script to test webcams using mplayer
# options are self explanatory :)
DEVICE="video0"
AUDIO=":noaudio"
FILTER="-vf-add pp=hb:a/vb:a,hqdn3d,mirror"
V4L=""
EXTRA=""
WIDTH="640"
HEIGHT="480"
RESOLUTION="-x 800 -y 600"
FPS=""
for x in $*; do
case "${x}" in
video[0-9]*)
DEVICE="${x}"
;;
-v4l2)
V4L=":driver=v4l2"
FPS="-fps 60"
;;
-v4l)
V4L=":driver=v4l"
FPS="-fps 60"
;;
-audio)
AUDIO=""
;;
-w[0-9]*)
WIDTH=`echo "${x}"|cut -c 4-`
;;
-h[0-9]*)
HEIGHT=`echo "${x}"|cut -c 4-`
;;
-forcefps)
FPS="-fps 30"
;;
-nores)
RESOLUTION=""
;;
-nofilter)
FILTER=""
;;
*)
EXTRA="$EXTRA ${x}"
;;
esac
done
# main
mplayer tv:// -tv device=/dev/$DEVICE:width=$WIDTH:height=$HEIGHT$V4L$AUDIO $RESOLUTION $FILTER $FPS $EXTRA