Animated gifs, create them using VLC, FFMPEG and GIMP

about animated gifs with vlc, ffmpeg and gimp

In the next article we are going to take a look at how we can create animated gif files from a video file. For this we will use VLC, FFMPEG and GIMP. I suppose that nowadays it is not necessary to explain what animated gifs are. These are very useful on web pages, they allow us to use a light form of animation to bring our content to life.

Today we can find different programs such as Terminalizer, Peek o gifcurry that allow us to create animated gifs in a simple way. But not everyone knows that with the VLC video player, with the GIMP image editor and with FFMPEG, we can record and convert any video clip into animated GIF.

Create animated gifs with GIMP, FFMPEG and VLC

Install GIMP, FFMPEG and VLC

First of all we will need install in our system VLC, FFMPEG and GIMP. All are easy to install on our Ubuntu system. We will be able to install them through our package manager. If you don't have them installed yet, you just have to open a terminal (Ctrl + Alt + T) and type:

sudo apt install vlc gimp ffmpeg

Create a clip with VLC

Animated gifs are usually not long-lived. For this reason, to start creating the GIF, we will have to reduce our video file to the size we want for the GIF. In VLC we will find a couple of ways to cut a video. We will use the most direct in this example.

Enabling advanced VLC controls

selection of advanced controls in VLC

VLC has built-in recording capabilities that we can use to create our clip from an existing long video. We will start by enabling these controls. To do this, in the main menu located at the top of VLC, we click on 'VIEW'. In the drop-down menu we are going to check the box that appears next to 'Advanced controls'. These controls will appear at the bottom of the VLC window, above the normal VLC controls.

Find the starting point

Open the video you are interested in and use the slider to find the one start point for clip recording.

Record your clip

advanced controls in VLC

Once you have located the starting point, do click on the big red circle in the advanced controls to start recording. When what interests you is recorded, press the 'button againRecord'to stop it.

In Ubuntu, the video should be saved in the folder '~ / Videos'. Sometimes, we will also find it in the user's home.

Separate frames using FFMPEG

GIMP does not work directly with video files. That's where it comes in FFMPEG, we will use it to divide our clip into frames.

Open the file browser and find the location where the video clip is located. Create a new folder called 'frames' in the same directory.

Now, open a terminal window in that directory that stores the video clip. In that window, type something like the following to use FFMPEG and split the clip:

ffmpeg separate frames from video

ffmpeg -i vlc-record-201X-XX-XX-tu-archivo.mp4 -r 15 frames/image-%3d.png

This may take a few minutes. FFMPEG will divide the file into frames at a rate of 15 frames per second. It will place the resulting images in the folder of 'frames'that we created before.

frames for gif creation

Convert frames to GIF with GIMP

At this point, we can already open GIMP and start mounting the GIF.

Import the frames

We open GIMP. We click on 'Archive'→'Open as layers'. Find the folder where you saved the frames. Select all images. When you have them all, confirm using the 'buttonOpen'.

open as layers in GIMP

GIMP will place each of the images as a layer. These layers will be used to recreate the video as an animation when we export to a GIF.

Edit the frames

If you just want to make a GIF of the clip, without alterations, you don't need to do anything. This section only briefly explains what to do when you want to add something as text.

frames gif in GIMP

Think of layers as pages in a flip book. Everything you add to one will appear in that frame of the GIF. To add text or something similar in several frames, you must duplicate that text and combine it in each of those frames. Everything you add must be merged into an existing layer.

Save the gif

indexed colors mode in GIMP

Before exporting the GIF, we will have the opportunity to reduce the size of the resulting file by changing from RGB to Indexed. To do this you have to go to "Image”→“Mode”And change it there. We will establish a maximum color palette at 127.

We can also optimize the images even more by going to 'Filter'and selecting'Animation'. There we will click on the option optimize for GIF.

export as animated gif

Now you are all set to export to GIF. We will do this from 'Archive'→'Export as'. As shown in the previous screenshot, you have to mark the check that says "As animation". We finish by clicking on «Export«.

And with this you can generate all the animated GIFs you want creating them from your video file using VLC, GIMP and FFMPEG.


Be the first to comment

Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.