Linux Commands

How to convert video to GIF in Linux

While using social media, we always see animated GIFs everywhere. If adding a picture on blogs would tell you 100 words about the story, GIF would come up with 1000 words.

Animated GIFs are used to make the blogs interesting and a great alternative for demo purposes short videos. It is a quick way to display anything that could not be expressed in images, or you don’t need to insert long videos all the time.

GIFs are also used in software documentation and media and make everything a part of the fun.

In this guide, we will see two ways of the conversion of video to GIF in Linux system:

  • Convert video to GIF via command-line
  • Convert video to GIF via GUI

Let’s start:

How to Convert Video to GIF via Command-line:

There is a command-line tool, “ffmpeg,” that is popular for video conversion and an audio convertor and could be used in several scenarios.

Here, we will use the “ffmpeg” tool to convert video to GIF.

Before getting started with the tool, we need to install it on the Ubuntu system. So, to get it, run the mentioned command:

$ sudo apt install ffmpeg

Once it is installed, select the video you want to convert and use the following syntax to find the required results:

ffmpeg -i [video_file_name.mp4] [output_name.gif

Keep in mind that your output name could be different from the input name. It’s totally up to you!

Suppose I have a testing video at the “Downloads” directory:

To convert it, the command would be:

ffmpeg -i test_dubai.mp4 test_dubai.gif

After the process has been completed, visit that directory again from where you selected the video, and you will find the GIF file there:

How to Convert Video to GIF Via GUI:

The “Gifcurry” is an amazing open-source tool specifically for GIF-making. It is very easy to convert videos using this application.

What you need to do is follow the steps carefully.

To get this application on the system, download it by copying the given command:

$ wget -O gifcurry.AppImage https://github.com/lettier/gifcurry/release/download/6.0.1.0/gifcurry-6.0.1.0-x86_64.AppImage

To make AppImage dependencies executable, use the following command to install it:

$ sudo apt install imagemagick

To give access to the tool, type in terminal:

$ sudo chmod +x ./*.AppImage

Now, run the “gifcurry” application by searching it from applications, or you can type the following in a terminal:

$ ./gifcurry.AppImage

You will the following window on the screen, click on “Open” to get the interface:

Now, select the video you want to convert from the directory and select the “Open” button from the right bottom of the interface:

Within few seconds, your video will be converted into GIF. Select the “file” to save GIF file in the system:

From the file, select the directory to save the converted GIF file, set the name of the output file text field, and click on the “save” button at the bottom right corner of the interface:

Close the application, and navigate to the directory where you saved the GIF file; you will get your converted video there:

Conclusion:

This write-up shows how to convert video to GIF in Linux using command-line and GUI.

The “ffmpeg” command tool is a quite simple and straightforward way to convert video to GIF files. While using the “Gifcurry” application seems interesting approach.

About the author

Wardah Batool

I am a Software Engineer Graduate and Self Motivated Linux writer. I also love to read latest Linux books. Moreover, in my free time, i love to read books on Personal development.