Skip to content

Instantly share code, notes, and snippets.

@sterlingwes
Created January 5, 2017 16:53
Show Gist options
  • Save sterlingwes/8726c9e0fdad2bf9390a3cb6af61a877 to your computer and use it in GitHub Desktop.
Save sterlingwes/8726c9e0fdad2bf9390a3cb6af61a877 to your computer and use it in GitHub Desktop.
Convert video to optimized GIF with libav (avconv)

Prerequisites

  • avconv
  • gifsicle

If you're on Ubuntu:

  • apt-get install gifsicle libav-tools

Command

Turns out avconv flags a comparable to ffmpeg:

avconv -i video.ogv -r 10 -s 700x420 -pix_fmt rgb24 -f gif - | gifsicle --optimize=3 --delay=3 > video.gif

Notable Flags:

  • r sets the max frames per second
  • s sets the frame size (resize)
@oguennec
Copy link

oguennec commented Mar 5, 2017

Excellent. I have easily converted a MKV not recognised by chrome to a GIF with this gist.

avconv -i chrome_console.mkv -r 5 -pix_fmt rgb24 -f gif - | gifsicle --optimize=3 --delay=20 > chrome_console.gif

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment