DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

Heddi Nabbisen
Heddi Nabbisen

Posted on

FFmpeg: Convert video to gif

FFmpeg provides simple usage to convert video such as .mkv, .mp3, .mp4, .mov to .gif.

ffmpeg -i <input.video> out.gif
Enter fullscreen mode Exit fullscreen mode

That's it.

Well, the file size of out.gif is sometimes a bit too big. In such a case, it's better to use -r option to specify frame rate.

ffmpeg -i my-sample.mkv -r 10 out.gif
Enter fullscreen mode Exit fullscreen mode

With -r 10, my sample video file got 20% smaller. With -r 5 or less, it would be much smaller.

The official documentation on video options is here.

Top comments (0)

🌚 Browsing with dark mode makes you a better developer.

It's a scientific fact.