How to Convert Video to GIF on Linux

Today we focusing How to Convert Video to GIF on Linux.
How to Convert Video to GIF on Linux

This article is about how to Convert Video to GIF on Linux. GIFs are undoubtedly one of the most popular forms of media shared on the Internet. from tutorials Memes and beyond, humans create and share GIFs for everything. But most of the time, these GIFs are not originally saved as files with the “.gif” extension. Usually, a video is trimmed and a specific part of the media is converted into a GIF.

On Linux, you can quickly create loopable GIFs from your videos using Terminal. For those not too keen on the command line, there is also a graphical approach to achieve similar results. Here’s how to convert video to GIF on Linux.

GIFs are also used in software documentation and media, so that’s part of the fun. Animated GIFs can be found all over the internet. From blog posts to social media, GIFs can be used both humorously and descriptively. Even at It’s FOSS we use GIFs to show a specific action step. It’s better than still images and smaller than loading video. Below, we have mentioned the steps to convert video to GIF on Linux.

How to Convert Video to GIF on Linux

Overview

In this tutorial We will learn how to Convert videos to gifs using FFmpeg command line program. FFmpeg is a free and open source software program that contains a collection of libraries and programs for processing video, audio and other multimedia files. streams. Additionally, the FFmpeg command-line tool helps convert various audio and video formats.

Installs FFmpeg

There are several ways to install FFmpeg. Most importantly, make sure to install the latest stable version of FFmpeg so you can use its newest version features. Snap can be used to install the latest stable version of FFmpeg on a Debian/Ubuntu machine:

See also  Cast Meta Oculus Quest 2 to TV/PC/iOS/Android

$ sudo snap install ffmpeg

$ ffmpeg -version ffmpeg version n4.3.1 Copyright (c) 2000-2020 FFmpeg Developers We have successfully installed the latest stable version of FFmpeg.

Creating a custom palette

By default, FFmpeg uses a common 256-color palette for each gif encoding. As a result, the output after converting the video will be sub-optimal. However, we can use FFmpeg to create a 256-color palette exclusively for our video. You can use custom palette and original video to create high quality gif. Now, let’s create a custom palette:

$ ffmpeg -ss 00:01:30 -t 5 -i video.mkv -filter_complex “[0:v] palettegen” palette.png

Let’s take a look at what each option does:

  • -ss Sets the start point of the video
  • -t sets the duration. So, we end up with a 5-second gif
  • -i specifies the input video file
  • -filter_complex is for applying filters. Here, we’ve added a palettegen filter that takes the first input video file (as shown [0:v]) as an argument

Creating a GIF

Now that we’ve created our custom palette, we can use it to create a gif:

$ ffmpeg -ss 00:01:30 -t 5 -i video.mkv -i palette.png -filter_complex “[0:v] fps=10,scale=720:-1 [new];[new][1:v] paletteuse” output.gif

Let’s take a look at what each new option does:

  • The second -i entry specifies a custom palette
  • The fps output specifies the frame rate of the gif
  • Scale changes the size of the video. To clarify, the first parameter is the width and the second is the height. We set the height to -1, which means we want to keep the aspect ratio. So, it will be set automatically. Also, both fps and scale take video as input
  • paletteuse takes two arguments. The first argument is the output of fps and scale (as shown in [new]), and the second argument is the custom palette we created before FFmpeg generated the gif after running the above command.
See also  How to Bypass Secure Boot and TPM to Install Windows 11

Final Words

We hope you will understand and enjoy this article How to Convert Video to GIF on Linux Animated GIFs are all over the internet. From blog posts to social media, GIFs can be used in humorous and descriptive ways. Even at It’s FOSS, we use GIFs to show a specific step in action. It’s better than static images and smaller than uploading video. If you liked this article, please share it with your family and friends.

Faq

About This Guide?


In this guide, we told you about the How to Convert Video to GIF on Linux; please read all steps above so that you understand How to Convert Video to GIF on Linux in case if you need any assistance from us, then contact us.

How this tutorial or guide assisting you?


So in this guide, we discuss the How to Convert Video to GIF on Linux, which undoubtedly benefits you.



Share this article about How to Convert Video to GIF on Linux

I hope you like the guide How to Convert Video to GIF on Linux. In case if you have any queries regards this article/tutorial you may ask us. Also, share your love by sharing this article with your friends and family.
#Convert #Video #GIF #Linux

Trickbugs: Get the latest Trick and Tips
Logo
Enable registration in settings - general