commit 16597c226cef2e27a32c13f5610d2a3b4b935e1d
parent c644e286eb7f1269a95d29d538f26f2f0d581d30
Author: Alex Balgavy <a.balgavy@gmail.com>
Date: Sun, 4 Aug 2019 00:35:30 +0200
gif2mp4: convert a gif to an mp4 video
Former-commit-id: 045dbbe88691cb1a6ac31b62bcf46e6a10862dbb
Diffstat:
2 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/README.md b/README.md
@@ -19,6 +19,7 @@ If you read a script and see some improvements that could be made, let me know.
* `dashedit.rb`: script to allow Dash submissions from the commandline. Largely useless to anyone except me.
* `epub-convert`: uses Calibre's ebook converter program to convert anything to an epub
* `executable`: my first script. Makes any file executable, along with further options. Usage: `executable file.sh`
+* `gif2mp4`: convert a gif to an mp4 video. Usage: `gif2mp4 file.gif`
* `ffmpeg-split.py`: split videos using ffmpeg. [Here's the README.](scripts/ffmpeg-split-README.md)
* `global-git-status`: git status of all of your cloned git repositories
* `httpc`: an interactive http request console using httpie
diff --git a/scripts/gif2mp4 b/scripts/gif2mp4
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+if ! command -v ffmpeg &> /dev/null; then echo "ffmpeg not found" && exit 1; fi
+if ! [ -f "$1" ] ; then echo "$1 not found." && exit 1; fi
+if ! [[ "$1" == *.gif ]]; then echo "$1 is not a gif." && exit 1; fi
+ffmpeg -i "$1" -r 30 -movflags faststart -pix_fmt yuv420p -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" "${1%%.gif}.mp4"