helper-scripts/audiotrim.sh

35 lines
619 B
Bash
Raw Normal View History

#!/bin/env bash
# Trim an audio file given a startpoint and an endpoint
printHelp() {
cat << EOF
Usage: audiotrim [input file] [start time] [stop time] [output file]
Options:
-h show this help page
EOF
}
2018-10-22 10:36:02 -07:00
while true; do
case "${1}" in
'-h'|'--help')
printHelp
2018-10-22 10:36:02 -07:00
exit
;;
--)
shift
continue
;;
*)
break
;;
esac
2018-10-22 10:36:02 -07:00
done
readonly infile=${1}
readonly starttime=${2}
readonly stoptime=${3}
readonly outfile=${4}
ffmpeg -i "${infile}" -ss "${starttime}" -to "${stoptime}" -c copy "${outfile}"