-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathrotateVideo90
More file actions
executable file
·49 lines (40 loc) · 904 Bytes
/
Copy pathrotateVideo90
File metadata and controls
executable file
·49 lines (40 loc) · 904 Bytes
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
47
48
#!/bin/bash
#
# Dreht ein Video um 90° im Uhrzeigersinn
#
# 0 = 90CounterCLockwise and Vertical Flip (default)
# 1 = 90Clockwise
# 2 = 90CounterClockwise
# 3 = 90Clockwise and Vertical Flip
function errorexit
{
echo "$1" 1>&2
exit 1
}
usage="Usage: $0 [-d 0|1|2|3] file"
transpose=0
while getopts 'd:h' opt ; do
case "$opt" in
d) transpose="$OPTARG";;
h) echo "$usage"
exit 0;;
[?]) echo "$usage"
exit 2;;
esac
done
shift $(($OPTIND-1))
if [ "$1" == "" ]
then
errorexit "Zu drehendes Video angeben. Abbruch."
elif [ ! -f "$1" ]
then
errorexit "\"$1\" ist keine Datei. Abbruch."
fi
directory=$(dirname "$1")
filename=$(basename "$1")
filenameWithoutSuffix=${filename%.*}
suffix="${filename##*.}"
newFilename="$filenameWithoutSuffix.rotated.$suffix"
echo $newFilename
ffmpeg -i "$directory/$filename" -vf "transpose=$transpose" "$directory/$newFilename"
exit 0