Add an example of how to cut clips with GES
authorAntonio Ospite <ao2@ao2.it>
Thu, 10 Sep 2015 10:45:55 +0000 (12:45 +0200)
committerAntonio Ospite <ao2@ao2.it>
Thu, 10 Sep 2015 10:45:55 +0000 (12:45 +0200)
shell/ges-cut-clip.sh [new file with mode: 0755]

diff --git a/shell/ges-cut-clip.sh b/shell/ges-cut-clip.sh
new file mode 100755 (executable)
index 0000000..d1a9aec
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+set -e
+
+usage() {
+  echo "usage: $(basename $0) <input> <inpoint in HH:MM:SS> <duration in HH:MM:SS> <output>"
+}
+
+[ -f "$1" ] || { usage 1>&2; exit 1; }
+INPUT_FILE="$1"
+
+read INPOINT_HH INPOINT_MM INPOINT_SS <<< ${2//:/ }
+read DURATION_HH DURATION_MM DURATION_SS <<< ${3//:/ }
+
+INPOINT=$(($INPOINT_HH * 60 * 60 + $INPOINT_MM * 60 + $INPOINT_SS))
+DURATION=$(($DURATION_HH * 60 * 60 + $DURATION_MM * 60 + $DURATION_SS))
+
+[ -e "$4" ] && { echo "Output file already exists, bliling out!" 1>&2; exit 1; }
+OUTPUT_FILE="$4"
+
+ges-launch-1.0 -s "$INPUT_FILE" $INPOINT $DURATION -o "$OUTPUT_FILE"