Nota: lo script utilizza mencoder per riunire i file, esistono anche altri tool tipo avimerge per fare queste cose ma siccome richiedono tool che di solito non sono installati di default (nel caso di avimerge ad esempio transcode), ho preferito quindi optare per il ben più noto e usato mencoder.
#!/bin/bash
help () {
echo "Usage:"
echo "$(basename $0) -o output.avi file1.avi file2.avi ..."
echo "-o specify output file (required)"
echo "-h show this help"
return 0
}
OUTPUT_FILE=output_joinavi.avi
if [[ "$1" != "-o" ]]
then
help
exit 1
fi
while getopts ":o:h" OPTION; do
case $OPTION in
o)
OUTPUT_FILE=$OPTARG
;;
h)
help
exit 0
;;
*)
echo "Command Line Option Not Valid or Missing Argument"
help
exit 1
;;
esac
done
if [[ $#-2 -lt 2 ]]
then
help
exit 1
fi
echo "Joining " ${@:$OPTIND} " into the file " $OUTPUT_FILE
echo "Waiting..."
mencoder -forceidx -ovc copy -oac copy -o $OUTPUT_FILE "${@:$OPTIND}"
echo "Done!"
Nessun commento:
Posta un commento