apyhub
Back
▣ FILE CONVERSION · FILE MANIPULATION

Video to GIF API: Convert Video Clips to Animated GIFs

Hosted on ApyHub

What it does

The Video to GIF API converts MP4, MOV, WebM and other video files into animated GIFs in a single request. Upload a video or send the URL of one hosted elsewhere, and get the GIF back straight away, either as a file download or as a signed link.

It accepts .mp4, .mov, .webm, .mkv, .avi, .flv and .3gp files up to 100 MB. There are four endpoints, so you can pick the input and output that fit your code: upload a file or send a video_url, and choose /download to get the GIF file in the response or /link to get a time-limited signed URL to it.

You control which part of the video becomes the GIF. Set start_time to the second where the clip should begin and duration to its length, from the default of 2 seconds up to 20. Use size to resize the output, for example 480x270, or leave it out to keep the original size. Use speed to slow the clip down with values down to -10 or speed it up with values up to 10.

Common uses include product demo loops for landing pages, social media previews, animated snippets for documentation and emails, and short reactions cut from longer videos.

If you are converting many videos or running inside a background worker, use the Generate GIF from Video Job API, which returns a job ID straight away and lets you fetch the GIF when it is ready. For a still image from a video instead of an animation, use the Video Thumbnail API.

You can try it right here in the playground. Start for free with 5 API calls a day, no card required, and convert your own video before you commit.

The API is also available through ApyHub MCP, so AI agents can turn a video into a GIF directly as part of a larger workflow.

▣ ENDPOINT 01 / 04
POST
Generate GIF from uploaded video and stream download
https://api.eu.apyhub.com/apyhub/generate-gif/multi-part/download

QUICKSTART

GUIDE

Quickstart

Upload a video to generate a GIF from it.

curl -X POST "https://api.eu.apyhub.com/apyhub/generate-gif/multi-part/download" \
  -H "apy-token: $APY_TOKEN" \
  -F "video=@/path/to/video.mp4"

What you'll get back

Returns a binary file (string with format: binary) — the generated GIF content.

TRY ITLIVE · 550 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.
Max 100MB total per request (all files combined). Larger? Use this API's URL-based endpoint instead, if it has one.
body*
Video file (.mp4 .mkv .avi .mov .flv .3gp .webm).
Output dimensions WxH. Omit to keep original size.
Playback speed. 0 = normal; positive = faster (1/n PTS); negative = slower (abs(n) PTS).
Clip length in seconds (capped at 20).

About this endpoint

What it does

Generates a GIF from an uploaded video file and returns the result as a streamed binary response. The request accepts the source video and optional conversion settings such as output size, playback speed, clip duration, and start time.

Request Body

ParameterTypeMandatoryDescription
videoBinaryYesVideo file upload. Accepted formats: .mp4, .mkv, .avi, .mov, .flv, .3gp, .webm.
sizeStringNoOutput dimensions in WxH format. Omit to keep the original size. Example: 320x240.
speedIntegerNoPlayback speed. Default: 0.
Allowed range: -10 to 10.
0 = normal speed; positive values are faster; negative values are slower.
durationIntegerNoClip length in seconds. Default: 2.
Allowed range: 1 to 20.
The length is capped at 20 seconds.
start_timeIntegerNoSeek offset in seconds. Default: 0.
Minimum: 0.

Response

Returns a binary stream containing the generated GIF file.

ParameterTypeMandatoryDescription
binaryStringYesGIF file content returned as a streamed binary response.

Max 100MB total per request (all files combined). Larger? Use this API's URL-based endpoint instead, if it has one.

▣ ENDPOINT 02 / 04
POST
Generate GIF from uploaded video and return signed link
https://api.eu.apyhub.com/apyhub/generate-gif/multi-part/link

QUICKSTART

GUIDE

Quickstart

Convert a video file into a GIF by uploading the video and providing the minimum required multipart fields.

curl -X POST "https://api.eu.apyhub.com/apyhub/generate-gif/multi-part/link" \
  -H "apy-token: $APY_TOKEN" \
  -F "video=@/path/to/video.mp4"

What you'll get back

Returns a JSON object with a data string field containing a time-limited signed download URL.

{
  "data": "https://storage.example.com/gif/output.gif?sig=abc"
}
TRY ITLIVE · 550 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.
Max 100MB total per request (all files combined). Larger? Use this API's URL-based endpoint instead, if it has one.
body*
Video file (.mp4 .mkv .avi .mov .flv .3gp .webm).
Output dimensions WxH. Omit to keep original size.
Playback speed. 0 = normal; positive = faster (1/n PTS); negative = slower (abs(n) PTS).
Clip length in seconds (capped at 20).

About this endpoint

What it does

Creates a GIF from an uploaded video file and returns a time-limited signed URL to download the generated file.

Request Body

ParameterTypeMandatoryDescription
videoBinaryYesVideo file to convert. Binary upload. Supported formats: .mp4, .mkv, .avi, .mov, .flv, .3gp, .webm.
sizeStringNoOutput dimensions in WxH format. Omit to keep the original size.
speedIntegerNoPlayback speed. Default is 0 (normal). Allowed range: -10 to 10. Positive values make playback faster (1/n PTS); negative values make it slower (abs(n) PTS).
durationIntegerNoClip length in seconds. Default is 2. Allowed range: 1 to 20; values are capped at 20.
start_timeIntegerNoSeek offset in seconds. Default is 0. Minimum: 0.

Response

Returns a JSON object with a data string field containing a signed URI for downloading the generated GIF.

ParameterTypeMandatoryDescription
dataStringYesTime-limited signed URL for download.

Max 100MB total per request (all files combined). Larger? Use this API's URL-based endpoint instead, if it has one.

▣ ENDPOINT 03 / 04
POST
Generate GIF from remote video URL and stream download
https://api.eu.apyhub.com/apyhub/generate-gif/url/download

QUICKSTART

GUIDE

Quickstart

Convert a public MP4 URL into a GIF using the source video URL.

curl -X POST "https://api.eu.apyhub.com/apyhub/generate-gif/url/download" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "video_url": "https://assets.apyhub.com/samples/sample.mp4"
  }'

What you'll get back

Returns a binary file (string with format: binary) containing the generated GIF.

TRY ITLIVE · 550 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.
body*
Publicly accessible URL of the source video.
Output dimensions WxH. Omit to keep original size.
Playback speed. 0 = normal; positive = faster; negative = slower.
Clip length in seconds (capped at 20).

About this endpoint

What it does

Generates a GIF from a remotely hosted video file and returns it as a streamed binary download. The request body supplies the source video URL and optional conversion settings such as output size, playback speed, clip duration, and start time.

Request Body

ParameterTypeMandatoryDescription
video_urlStringYesPublicly accessible URL of the source video.
sizeStringNoOutput dimensions in WxH format. Omit to keep the original size.
speedStringNoPlayback speed. 0 = normal; positive values = faster; negative values = slower. Default: 0.
durationStringNoClip length in seconds. Default: 2; capped at 20.
start_timeStringNoSeek offset in seconds. Default: 0.

Response

Returns a streamed binary file containing the generated GIF. The success response body is a binary download, with no JSON wrapper or top-level fields declared in the output schema.

▣ ENDPOINT 04 / 04
POST
Generate GIF from remote video URL and return signed link
https://api.eu.apyhub.com/apyhub/generate-gif/url/link

QUICKSTART

GUIDE

Quickstart

Convert a public video URL into a GIF with the minimum required input.

curl -X POST "https://api.eu.apyhub.com/apyhub/generate-gif/url/link" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"video_url":"https://assets.apyhub.com/samples/sample.mp4"}'

What you'll get back

Returns a JSON object with a data string field containing a time-limited signed URL for the generated GIF.

{
  "data": "https://storage.example.com/gif/output.gif?sig=abc"
}
TRY ITLIVE · 550 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.
body*
Publicly accessible URL of the source video.
Output dimensions WxH. Omit to keep original size.
Playback speed. 0 = normal; positive = faster; negative = slower.
Clip length in seconds (capped at 20).

About this endpoint

What it does

Generates a GIF from a publicly accessible remote video URL and returns a signed download link to the created GIF.

Request Body

ParameterTypeMandatoryDescription
video_urlStringYesPublicly accessible URL of the source video. Must be a URI.
sizeStringNoOutput dimensions in WxH format. Omit to keep the original size.
speedStringNoPlayback speed. Default: 0.
0 = normal
positive values = faster
negative values = slower
durationStringNoClip length in seconds. Default: 2. Capped at 20.
start_timeStringNoSeek offset in seconds. Default: 0.

Response

Returns a JSON object with a data string field containing a time-limited signed URL for downloading the generated GIF.

ParameterTypeMandatoryDescription
dataStringYesTime-limited signed URL for download. Must be a URI.
▣ COMMON ERRORS

Errors any endpoint can return

400bad_request

Required parameter missing or malformed body.

401unauthorized

API key missing, revoked, or not authorized for this service.

429rate_limited

Your plan's per-second rate exceeded. Retry with exponential backoff.

503upstream_busy

Backend temporarily unavailable. Try again in a few seconds.