Created
February 8, 2019 17:06
-
-
Save larrybolt/c3fd56fc9f19bc5729023ba08bc30e9f to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env bash | |
set -o nounset | |
set -o errexit | |
trap 'echo "Aborting due to errexit on line $LINENO. Exit code: $?" >&2' ERR | |
set -o errtrace | |
set -o pipefail | |
function gif2mp4 { | |
# https://unix.stackexchange.com/a/294892 | |
ffmpeg -hide_banner -loglevel panic -i "$1" -movflags faststart -pix_fmt yuv420p -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" "$1.mp4" | |
exiftool -overwrite_original "-alldates<filename" "-filemodifydate<filename" "$1.mp4" | |
} | |
# https://unix.stackexchange.com/a/9499 | |
OIFS="$IFS" | |
IFS=$'\n' | |
for file in `find . -type f -name "$1" -maxdepth 1 -name "*.gif"` | |
do | |
gif2mp4 "$file" | |
done | |
IFS="$OIFS" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment