xtract.bot

Video extract frames

Try it interactively →

POST /api/video-extract-frames12 quota units per call · cache hits free

Pull several still frames out of an MP4, MOV, WebM, or MKV video — evenly spaced across the clip or at a fixed interval — and download them as a ZIP. Powered by a WebAssembly ffmpeg build.

Decodes a video and returns several frames as a ZIP of images. Two sampling modes: - `count` — that many frames spread evenly across the clip (default 9). Each frame is taken at the midpoint of its slice, so the first/last aren't exactly at 0s / the very end. - `everySeconds` — one frame every N seconds from the start. When set, it overrides `count`. Either way the result is capped at 24 frames to stay inside the Workers CPU budget. `format` (webp/png/jpeg) and `quality` apply to every frame. The ZIP holds `frame-0001.<ext>`, `frame-0002.<ext>`, … and the JSON response also lists each frame's timestamp. For a single frame at a precise time, use video-extract-frame. Accepts MP4, MOV, WebM, and MKV (same containers as video-info). `count` mode needs a video whose duration is known from its header (true for normal files); otherwise pass `everySeconds`.

Inputs

NameTypeDefaultDescription
video*fileMP4, MOV, WebM, or MKV file.
countnumber (1…24)9Number of frames, spread evenly across the clip. Ignored when everySeconds is set.
everySecondsnumber (0.1…3600)Sample one frame every N seconds from the start (overrides count). Capped at 24 frames.
formatenum (webp | png | jpeg)"webp"Output image format for every frame.
qualitynumber (1…100)80Encoder quality for webp / jpeg (1–100). Ignored for png.

Response

Modes: json, binary. Cache: yes (24h TTL).

Every response carries x-cache (HIT / MISS / BYPASS), x-cache-signature (stable across identical inputs), and the rate-limit headers listed below.

Quota & limits

Cost per call12 units against the 10,000-unit monthly quota. Cache hits are free — only cache misses decrement.
Burst limit200 requests per rolling minute, shared across all tools.
Max request size100 MiB (base64 inflates file payloads ~33% — the limit applies to the decoded bytes).
Max response size50 MiB
Timeout120s wall clock.
Rate-limit headersX-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Burst-Limit on every response; X-Quota-Warning once 80% of the monthly quota is spent; Retry-After on 429s.

Errors

Errors are JSON with an error string; schema failures add a details object (Zod's flattened field errors).

StatusWhenBody
400Input fails the tool's schema (wrong type, missing required field, malformed base64) or the file bytes can't be parsed as the expected format.{ "error": "invalid inputs", "details": { "fieldErrors": { … } } }
401Missing or invalid X-Api-Key / X-Account-Id headers (or no session when called from the browser).{ "error": "unauthorized" }
404Unknown tool id, or calling /api/* on the website hostname instead of api.xtract.bot.{ "error": "not found" }
413Request body over the tool's max request size, or an image header declaring more megapixels than the tool's pixel budget.{ "error": "…exceeds maxRequestBytes…" }
415Content-Type isn't application/json on the json-body transport.{ "error": "unsupported content-type; expected application/json" }
429Monthly quota or the 200/min burst limit exhausted. Check Retry-After and the X-RateLimit-* headers.{ "error": "monthly quota exceeded", "monthRemaining": 0, … }
5xxConversion engine failure. Safe to retry; if it persists, the input is hitting a bug — please report it.{ "error": "…" }

Code samples

Built from the mp4-4-frames example.

# Download or substitute the example input:
#   curl -O https://xtract.bot/examples/video-extract-frames/sample.mp4
VIDEO=$(base64 -w0 < sample.mp4)

curl -X POST https://api.xtract.bot/api/video-extract-frames \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -H "X-Account-Id: $XTRACT_ACCOUNT_ID" \
  -H "X-Api-Key: $XTRACT_API_KEY" \
  -d '{
  "count": 4,
  "format": "webp",
  "quality": 80,
  "video": "'"$VIDEO"'"
}'