Delving into Delusion

Converting mp4 to Animated gif with FFmpeg in Ubuntu

 April 17, 2020      Stardate: 73759.1     Tagged as: Ubuntu FFmpeg

Source is from an excellent answer on SuperUser StackExchange.

ffmpeg input.mp4 -vf "fps=15,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 output.gif

You can define the frames per second via the ”fps” argument. The standard for an animated gif is between 15 and 24, but the more frames the larger the output file.

The split commands splits the video into two streams for generate a color palette and downsampling the incoming video.

The loop argument defines how many times you want the gif to loop. - 1 = no looping - 1 = loop once - n = loop n times - 0 = loop infinite = “forever”

Software Versions

This is an automated list of software versions used during the writing of this article.

OS Ubuntu 20.04 LTS
Bash 5.0.16(1)-release
Python 2.7.4