Skip to content

DocsGuides

GIF previews

Turn a few seconds of video into an animated GIF with a palette made for its frames.

POST /v1/gif turns part of a video into an animated GIF with a palette made for its own frames, so the colours hold up.

The request#

bash
curl "$VIDEXO_API_URL/v1/gif" \
  -H "Authorization: Bearer $VIDEXO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "input": "https://example.com/talk.mp4",
  "filename": "preview.gif",
  "trim": {
    "start": 5,
    "duration": 4
  },
  "fps": 12,
  "resize": {
    "width": 480
  }
}'

preview.gif: 4 seconds from 0:05, 480 pixels wide at 12 frames a second, in colours picked from those frames.

The gif-preview preset#

The first 5 seconds at 12 frames a second, at most 480 pixels wide; trim moves it.

bash
curl "$VIDEXO_API_URL/v1/gif" \
  -H "Authorization: Bearer $VIDEXO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "input": "https://example.com/talk.mp4",
  "preset": "gif-preview",
  "trim": {
    "start": 30
  }
}'

Without trim.duration or trim.end a GIF stops at 60 seconds. colors (2 to 256) makes the file smaller with fewer colours, and fps is at most 30.