How to Convert Video to GIF in Linux [Terminal and GUI Methods]

Animated GIFs are everywhere on the internet. From blog posts to social media, GIFs can be used in a humorous as well as explanatory way.

Even on It’s FOSS, we use GIFs to show a certain step in action. It is better than still images and shorter than loading a video.

In this tutorial, I will show you how to convert a video clip to GIF. I’ll discuss both:

  • Command line way to convert video to GIF
  • GUI tool for converting video to GIF

Method 1: Create GIF from Video using ffmpeg in command line

Convert Video To Gif In Linux

FFmpeg is a video and audio converter that can also grab from a live audio/video source. It can also resize video on the fly without compromising the quality.

FFmpeg is a powerful tool and can be used for various scenarios, if you are curious here is the official documentation. We also have a good collection of ffmpge usage examples.

In this example, I will use the Linux Mint 20 new feature presentation video. I downloaded the video from YouTube using youtube-dl and then I trimmed the video to get the first 5 seconds.

Make sure to install ffmpeg using your distribution’s package manager:

sudo apt install ffmpeg

Once you have selected the video that you want to convert, open your terminal and change directory where your video is saved. Below is a general principle, where input is the actual name of the video, following by the video format and the name that you want your gif to be.

The output name can be something totally different to the input name, but I tend to use something similar, as it helps to identify it when you have a folder full of files.

ffmpeg -i input_video_file output.gif
use ffmpeg to convert videos to gif

Press the enter key to execute the command and your gif will be ready shortly.

Converting video to gif using ffmpeg command line tool in Linux

You should find the GIF file in the same folder as your video file unless you specified some other path for the output file).

Video converted to GIF

Method 2: Converting video to GIF using Gifcurry GUI application

Gifcurry is an open-source, easy-to-use app GIF maker app.

It uses ffmpeg and imagemagick to process video and convert to GIF. It can be used both in command-line and the graphical user interface, although this tutorial will only cover the GUI part.

It can be installed using snap and other package managers, but I recommend using the AppImage because I found some issue with other packages.

Before you attempt to open gifcurry, you need to make sure that the required dependencies are already installed.

Open and use gifcurry

To make an Appimage executable is very straight forward and you grant the permission at the file properties as following:

Run Gifcurry tool

When you open Gifcurry you will be prompted to navigate to the file that you want to convert and at this example I will use again the initial video. As ffmpeg, Gifcurry is not limited to purely converting videos to gif and vice versa. Some of the features are listed.

A few other Gifcurry Features

  • Add text to gif
  • Choose starting time
  • Set duration
  • Adjust gif width 
  • Adjust Quality
Using Gifcurry to convert video to Gif in Linux

At the last step, you have to choose the file name, the file format and click save.

Using Gifcurry to convert video to Gif in Linux

The final result is here:

Gifcurry

Conclusion

If you are recording your screen in Linux, you may use Peek to record it a gif instead of a video instead of converting the video to gif later.

Either you choose the command line or the graphical user interface, your job will get done lightning fast both ways.

Let me know which way you prefer and feel free to request any further explanation at the comments section.

About the author
Dimitrios

Dimitrios

Dimitrios is an MSc Mechanical Engineer but a Linux enthusiast in heart. His machines are powered by Arch Linux but curiosity drives him to constantly test other distros. Challenge is part of his per

Become a Better Linux User

With the FOSS Weekly Newsletter, you learn useful Linux tips, discover applications, explore new distros and stay updated with the latest from Linux world

It's FOSS

Great! You’ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to It's FOSS.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.