cheatsheets/animated_gif.md

28 lines
559 B
Markdown
Raw Permalink Normal View History

2013-10-14 02:36:58 +00:00
---
2017-09-21 08:05:49 +00:00
title: Animated GIFs
2015-11-24 05:06:06 +00:00
category: CLI
2013-10-14 02:36:58 +00:00
---
2017-09-21 08:05:49 +00:00
## Animated GIFs
{: .-one-column}
2013-09-17 10:06:00 +00:00
2017-09-21 08:05:49 +00:00
### Convert MP4 to GIF
2013-09-17 10:06:00 +00:00
2017-09-21 08:05:49 +00:00
```bash
mkdir -p gif
mplayer -ao null -vo gif89a:outdir=gif $INPUT
mogrify -format gif *.png
gifsicle --colors=256 --delay=4 --loopcount=0 --dither -O3 gif/*.gif > ${INPUT%.*}.gif
rm -rf gif
```
2013-09-17 10:06:00 +00:00
2017-09-21 08:05:49 +00:00
You'll need `mplayer`, `imagemagick` and `gifsicle`. This converts frames to .png, then turns them into an animated gif.
### A given range
```bash
mplayer -ao null -ss 0:02:06 -endpos 0:05:00 -vo gif89a:outdir=gif videofile.mp4
```
See `-ss` and `-endpos`.