1. Home
  2. Windows

How To Create GIFs With FFMpeg On Windows 10

Creating a GIF is pretty simple. There are tons of free apps that let you do create GIFs from images, or create one from a video file. It’s not until you want to control the resolution and the frame rate that you run into trouble. Creating an HD isn’t always easy or free when you need that much control. You can try Giphy and it might output a large 1920×1080 GIF but that’s on chance. You can’t force it to match the video size. That said, if you can bear to use FFMpeg, creating the GIF should be easy.

FFMpeg is a great tool. It’s only downside is that it’s a command line tool which means not a lot of people are comfortable using it. As far as creating a GIF with FFMpeg is concerned, we’re going to simplify it for you so that you only need to edit the command to include your file names.

GIFs With FFMpeg

FFMpeg can trim videos however, it’s better if you just use the TV & Movies app to do it. It has a GUI that lets you trim videos and if you have a GUI that can do that, you don’t want to go through FFMpeg.

Download FFMpeg and extract the file. Inside, open the Bin folder. Click inside the location bar and copy the path to the folder. Open Command Prompt and use the following command to move to the extracted folder.

Syntax

cd path-to-folder

Example

cd C:\Users\fatiw\Desktop\ffmpeg-20180821-7e0df59-win64-static\ffmpeg-20180821-7e0df59-win64-static\bin

Take the video (trimmed to the exact portion), and put it inside the bin folder. Run the following command to convert the video to GIF.

Syntax

ffmpeg -i video.mp4 my_gif.gif

You should edit the name of the video file, and the name of the GIF file you want to save the GIF to. You can also use almost any video file format to convert to GIF. It can be AVI, or it can be MP4.

Examples

ffmpeg -i my_video.mp4 gif_file.gif

ffmpeg -i my_video.avi gif_file.gif

This will convert it to a GIF with a 20 frame rate and the exact same resolution as the video. For example, if the video is 1920×1080, the GIF will be the same size.

You can use this command to change the frame rate and the resolution.

Syntax

ffmpeg -i video.mp4 -r 20 -vf scale=240:-1 my_gif.gif

The -r 20 determines the frame rate. If you want to set it to 60, you should make it -r 60. The -vf scale=240:-1 sets the width to 240, and the height is resized proportionally. If you want to set the width to 1920, you have to edit it to -vf scale=1920:-1.

Example

ffmpeg -i my_video.mp4 -r 60 -vf scale=1920:-1 my-gif.gif

Leave a comment