To make an animated GIF from a video clip, use FFmpeg to choose frames, resize them, and encode them as an animation. A palette-generation step improves color compared with a basic conversion because GIF supports only 256 colors per frame.
For an existing camera recording, FFmpeg can convert the clip directly. If you need a narrated explainer video, explainroo can create the MP4 for FFmpeg to convert. explainroo creates videos on your computer through an AI coding agent; it does not edit existing camera footage or export GIFs.
Convert a clip with a custom color palette
A direct conversion works, but colors may look uneven. This command creates a palette from the clip and uses it to encode the GIF:
ffmpeg -ss 00:00:02 -t 00:00:04 -i input.mp4 \
-filter_complex "[0:v]split[a][b];[a]palettegen[p];[b][p]paletteuse" \
-loop 0 output.gif
Replace input.mp4 with your video’s filename. The command starts at two seconds and converts four seconds of footage. To convert the whole video, remove -ss and -t.
The filters create a palette from the clip, then use it to make the GIF. This two-step method generally gives better color than a generic palette, as shown in the FFmpeg conversion examples and Mux’s GIF guide.
The -loop 0 option makes the GIF loop forever. Use -loop -1 to disable looping. GIF’s 256-color limit still applies, so footage with rich colors or smooth gradients can show color shifts or visible bands.
Adjust the frame rate and dimensions
Frame rate controls how many images appear each second. Around 10 to 15 frames per second offers a balance between smooth motion and file size for many clips. Try 8 to 10 fps for simple movement and 15 to 20 fps for fast action. Higher rates encode more frames and make the GIF larger.
Use a scale filter to set the output width and let FFmpeg calculate the height, keeping the original proportions. If the file is too large, lower the width to reduce its size, as described in Mux’s conversion guidance.
If color quality matters less, use this simpler command:
ffmpeg -i input.mp4 -vf "fps=10" output.gif
This command sets the frame rate but does not resize the video or create a custom palette. If the colors look wrong, compare the result with the palette-based command.
Make an explainer video with explainroo, then convert it
If you need a narrated explainer rather than a GIF made from existing footage, explainroo can create a video for FFmpeg to turn into a GIF. This free, open-source kit is licensed under the MIT license and works with coding agents such as Claude Code, Codex, Pi, OpenCode, and Gemini CLI. explainroo creates an MP4; FFmpeg makes a GIF from it.
Paste this prompt into a coding agent that can run shell commands, replacing the bracketed topic:
Make me a short explainer video about [your topic]. Use explainroo for it: clone https://github.com/vincentsch/explainroo, read its AGENTS.md and follow the steps.
The agent sets up explainroo, creates and checks the video, then gives you an MP4. Use that file in the FFmpeg command above instead of input.mp4. explainroo creates narration and animated scenes on your computer, but it does not convert existing camera footage or make a GIF.