How to convert a video to a GIF with an API
A good GIF needs a generated colour palette, or it looks banded and huge. In FFmpeg that is a two-pass palette dance. With an API you set an fps and a width and get a clean GIF back.
The manual FFmpeg way
Two passes, a temporary palette file and matching filters on each pass. A typed tool takes fps and width and produces the optimised GIF in one job.
ffmpeg -ss 3 -t 5 -i input.mp4 -vf "fps=15,scale=640:-1:flags=lanczos,palettegen" palette.png && ffmpeg -ss 3 -t 5 -i input.mp4 -i palette.png -lavfi "fps=15,scale=640:-1:flags=lanczos[x];[x][1:v]paletteuse" out.gif
Do it with one API call
- 1
Provide the source clip
Give a public URL or upload the file and use the returned media URL as "main".
- 2
Call the GIF tool
Set fps and width, and optionally a start time, to control size and smoothness.
- 3
Download the GIF
Poll the job and download the finished GIF from the signed output URL.
curl https://kinopipe.com/api/v1/tools/convert-video-to-gif \
-H "Authorization: Bearer kp_live_..." \
-H "Content-Type: application/json" \
-d '{
"inputs": [ { "id": "main", "url": "https://example.com/input.mp4" } ],
"options": { "start": 3, "fps": 15, "width": 640 }
}'FAQ
Does the GIF use an optimised palette?
Yes. KinoPipe generates a per-clip palette so the GIF looks clean without banding, and keeps the file reasonable.
How do I keep the file small?
Lower the fps and width, and trim to a short start range. Both options are set on the request.