summaryrefslogtreecommitdiff
path: root/tools/rotate-video.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tools/rotate-video.sh')
-rwxr-xr-xtools/rotate-video.sh30
1 files changed, 30 insertions, 0 deletions
diff --git a/tools/rotate-video.sh b/tools/rotate-video.sh
new file mode 100755
index 0000000..6d27b44
--- /dev/null
+++ b/tools/rotate-video.sh
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+set -e
+
+DIR="$( cd "$( dirname "$(realpath "${BASH_SOURCE[0]}")" )" &>/dev/null && pwd )"
+PROGNAME="$0"
+
+. "$DIR/lib.bash"
+
+
+usage() {
+ cat <<EOF
+usage: $PROGNAME FILENAME
+EOF
+ exit 1
+}
+
+[[ $# -lt 1 ]] && usage
+
+oldname="$1"
+if file_in_use "$oldname"; then
+ die "file $oldname is in use by another process"
+fi
+
+newname="${oldname/.mp4/_rotated.mp4}"
+
+ffmpeg -y -i "$(realpath "$1")" -map_metadata 0 -metadata:s:v rotate="90" -codec copy \
+ "$(realpath "$newname")"
+rm "$oldname"
+mv "$newname" "$oldname" \ No newline at end of file