Created
June 30, 2017 05:28
-
-
Save luismrsilva/987d272777f806deb25b815006c03b52 to your computer and use it in GitHub Desktop.
Wrapper to fix video rotation on ffmpegthumbnailer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# WARNING: this file is provided AS IS without ANY WARRANTY. | |
# USE AT YOUR OWN RISK | |
# Installation on Ubuntu | |
# - Copy ffwraper.sh to /usr/share/thumbnailers | |
# - In ffmpegthumbnailer.thumbnailer, set: | |
# Exec=/usr/share/thumbnailers/ffwraper.sh -i %i -o %o -s %s | |
while getopts ":i:o:s:" opt; do | |
case $opt in | |
i) | |
i="$OPTARG";; | |
o) | |
o="$OPTARG";; | |
s) | |
s="$OPTARG";; | |
\?) | |
echo "Invalid option: -$OPTARG" >&2 ;; | |
esac | |
done | |
# Exec=ffmpegthumbnailer -i %i -o %o -s %s -f; convert %o -rotate $(exiftool -s -s -s %i -Rotation) %o | |
if [ -z "$1" ] || [ -z "$o" ] || [ -z "$s" ]; then | |
echo "Missing arguments." >&2 | |
exit 1 | |
fi | |
ffmpegthumbnailer -i "$i" -o "$o" -s "$s" -f | |
ROT=$(exiftool -s -s -s "$i" -Rotation) | |
if [ ! -z "$ROT" ]; then | |
convert "$o" -rotate "$ROT" "$o" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment