MP4 to GIF API — Free Tier + Pay-As-You-Go
Convert MP4 video to animated GIF programmatically. Per-job width, fps, palette mode, and start/end trim controls.
What it does
The MP4 to GIF API converts MP4, MOV, MKV, and WebM video into animated GIFs with explicit control over width, frame rate, palette mode, and per-clip trim windows. The pipeline uses FFmpeg's two-pass palette generation — first generating an optimised 256-color palette from the input, then encoding the GIF with dithering controlled by the `dither=` parameter (none, floyd_steinberg, bayer:bayer_scale=5, sierra2). Output GIFs are typically 5-15× larger than the source MP4 at equivalent visual quality — this is a fundamental limit of the GIF format's per-frame palette and indexed-color encoding.
To keep file sizes manageable, the API exposes `maxFileSize=` which iteratively reduces frame rate and dimensions until the output fits. Per-job parameters include `width` (height auto-computed to preserve aspect ratio), `fps` (5-30), `start` / `end` (HH:MM:SS.ms), `palette=optimized` or `palette=full`, `loop=0` (infinite) or specific count, and `boomerang=true` for forward-then-reverse playback. The API does NOT recommend converting more than ~10 seconds of video to GIF — for longer clips, ship WebP or MP4 instead and get 10× better quality at 10× smaller size.
Supported formats
Source formats (6)
- mp4
- mov
- mkv
- webm
- avi
- m4v
Target formats (1)
- gif
Quick start
All three SDK languages show the same conversion: a single POST to /v1/convert with your API key in the X-Api-Key header.
curl -X POST https://api.convertintomp4.com/v1/convert \
-H "X-Api-Key: ck_your_api_key" \
-F "file=@input.mp4" \
-F "target=gif"
-F "width=480" \
-F "fps=15" \
-F "start=00:00:02" \
-F "end=00:00:08"import { ConvertIntoMP4 } from "@convertintomp4/sdk";
import fs from "node:fs";
const client = new ConvertIntoMP4({ apiKey: process.env.CIM4_API_KEY });
const job = await client.convert({
file: fs.createReadStream("input.mp4"),
target: "gif",
});
const result = await client.waitForJob(job.id);
console.log("Output URL:", result.outputUrl);from convertintomp4 import Client
client = Client(api_key="ck_your_api_key")
with open("input.mp4", "rb") as f:
job = client.convert(file=f, target="gif")
result = client.wait_for_job(job.id)
print("Output URL:", result.output_url)Features
- Two-pass palette generation for clean output
- Configurable width, fps, dither algorithm
- Start / end trim with millisecond precision
- Boomerang playback (forward + reverse)
- Iterative size-targeting via maxFileSize
- Loop count: infinite or specific
- Auto-recommends WebP for clips longer than 10s
Pricing
From $9.99/mo (Pro) or $24.99/mo (Business) — or pay-as-you-go on the API plan.
Free tier: 5 conversions/day, 100 MB file size, no API key required (IP-gated). Pro $9.99/mo: 100/day (2,000/month), 2 GB files. Business $24.99/mo: 1,000/day (20,000/month), 10 GB files, GPU encoding, dedicated support.
See full pricing breakdown →Built for production
99.9% uptime SLA
Multi-region failover, transparent status page, 60-second response-time guarantee on Business.
Encryption + auto-delete
TLS 1.2+ in transit, AES-256 at rest. Files deleted after 1h / 24h / 7d depending on plan, or instantly via DELETE endpoint. See the security page.
~7s median latency
Most sub-100 MB jobs complete in 6-9 seconds. Webhook-driven async for heavier workloads; waitForJob for synchronous flows.
Frequently Asked Questions
Why is the GIF so much larger than the MP4?
GIF stores each frame as an indexed-color (max 256 colors per frame) image with no inter-frame compression beyond LZW. MP4 uses H.264 inter-frame prediction — only changes between frames are stored. A 10-second 720p GIF is typically 5-15 MB; the same clip as MP4 is 500 KB to 2 MB.
What FPS should I pick?
15 fps is the sweet spot for animated GIFs — looks smooth, keeps file size manageable. 24-30 fps doubles file size for marginal perceptual improvement. 10 fps is the lowest before motion becomes visibly choppy.
Should I use GIF or WebP for short video loops?
Animated WebP — supported by 96%+ of browsers as of 2026. Animated WebP is 5-10× smaller than equivalent GIF at the same quality. We support GIF for legacy compatibility but recommend animated WebP for any new project where you control the consumer.
How do I trim to just a portion of the video?
Pass `start=00:00:02` and `end=00:00:08` to extract that 6-second window. Format is HH:MM:SS.ms — millisecond precision is supported. Trim runs as part of the palette-generation pass, no separate cut step required.
What does palette=optimized do?
Generates a custom 256-color palette per clip based on the actual pixel data, producing visibly cleaner output than the default GIF web-safe palette. Adds ~20% to encoding time. Required for any video with skin tones, sunsets, or gradients.
Related APIs
- MP4 to MP3 APIExtract MP3 audio from MP4 video programmatically. Per-job bitrate and sample rate, ID3 tag injection, fast remux mode.
- PDF to JPG APIRender PDF pages to JPG images programmatically. Per-page DPI, page-range selection, batch ZIP output, ImageMagick + pdftoppm pipeline.
- JPG to PNG APIConvert JPG to PNG with optional transparency, lossless compression, and EXIF preservation via API. Sharp-backed.
- PDF to DOCX APIConvert PDF to editable Word DOCX via API. Preserves layout, fonts, tables, and images. pdf2docx + OCR fallback.
- DOCX to PDF APIConvert Word DOCX to PDF programmatically. LibreOffice-rendered with font fallback, headers/footers, and PDF/A archival output.
- HEIC to JPG APIConvert iPhone HEIC and HEIF photos to JPG via API. EXIF rotation, ICC profile, Live Photo frame selection.
Or browse the full catalogue of 23 API products →
Get an API key
Start integrating the MP4 to GIF API in five minutes. Read the docs, grab a key, and ship your first conversion before the trial coffee cools.