forked from mediamicroservices/mm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathblackatends
executable file
·46 lines (41 loc) · 1.13 KB
/
blackatends
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash
# blackatends
# Accepts one or many video files as an input and determines how many frames of black are at the beginning and at the end
scriptdir=$(dirname "${0}")
. "${scriptdir}/mmfunctions" || { echo "Missing '${scriptdir}/mmfunctions'. Exiting." ; exit 1 ;};
version=1.0
cleanup(){
_log -a "Process aborted"
exit 1
}
trap cleanup SIGHUP SIGINT SIGTERM
usage(){
echo
echo "$(basename "${0}") ${version}"
echo "This program will report on the number of black frames at the beginning and end of a video file."
echo
echo "Usage: $(basename $0) file1 [ file2 ... ]"
echo
echo "Options:"
echo " -h display this help"
echo
exit
}
[ "$#" = 0 ] && usage
# command-line options to set mediaid and original variables
OPTIND=1
while getopts ":h" opt; do
case "$opt" in
h) usage ;;
\?) echo "Invalid option: -$OPTARG" ; exit 1 ;;
:) echo "Option -$OPTARG requires an argument" ; exit 1 ;;
esac
done
shift $(( ${OPTIND} - 1 ))
while [ "${*}" != "" ] ; do
_log -b
[ "$#" != 0 ] && sourcefile="${1}"
black_at_ends "$sourcefile"
_log -e
shift
done