Once thought of as outdated art forms, animated GIF images have now come back. If you haven't noticed, quite a few online sharing and social networking sites are now supporting animated GIF images, for example, on [Tumblr][1], [Flickr][2], [Google+][3], and [partly on Facebook][4]. Due to their ease of consumption and sharing, GIF-ed animations are now part of mainstream Internet culture.
So some of you may wonder how you can create such animated GIF images. There are various online or offline tools dedicated to create animated GIF images. Another option is to create an animated GIF image off of an existing video clip. In this tutorial, I will describe **how to convert a video file to an animated GIF image on Linux**.
As a more useful example, let me demonstrate how to **convert a YouTube video to an animated GIF image**.
### Step 1: Download a YouTube Video ###
First, download a YouTube video that you would like to convert. You can use [youtube-dl][5] tool to save a YouTube video as an MP3 file. Suppose you saved your favorite YouTube video as "funny.mp3".
### Step 2: Extract Video Frames from a Video ###
Next, [install FFmpeg][5] on your Linux system, which I will use to extract video frames from the video.
The following command will extract individual video frames, and save them as GIF images. Make sure to use the output file format ("out%04d.gif") as is. That way, individual frames will be named and saved properly.
For example, if you want to extract the video frames of input video, for 5 seconds, starting at 10 seconds from the beginning, run the following command.
In the command, "-delay" is an option that controls the animation speed. This option indicates that [ticks/ticks-per-second] seconds must elapse before the display of the next frame. The "-loop 0" option indicates infinite loops of animation. If you want, you can specify "-loop N", in which case the animation will repeat itself N times.
For example, to create an animated GIF image with 20 frames-per-second and infinite loop, use the following command.