API

video-to-gif

Runs in your own browser through FFmpeg compiled to WebAssembly, with a palette built for the clip. The first 10 seconds are converted at 12 frames per second.

v1 beta browser · 5 tokens

Price (browser): 5 token(s) per call. The exact figure for your file: POST /v1/tools/video-to-gif/estimate.

Call it

POST https://tembrica.com/v1/tools/video-to-gif/runs
Authorization: Bearer $TIMBRICA_KEY
Idempotency-Key: <your retry-safe key>
Content-Type: application/json

Input

FieldTypeRequiredNotes
width string no GIF width in pixels; the height follows the aspect ratio.
one of: 320, 480, 640
default: 480
quality string no Palette and dithering quality; higher means a larger file.
one of: low, medium, high
default: medium

Input file

Your browser sets the file at the recipe's `upload` step. Do not stage it with /v1/uploads.
accepts: .mp4, .mov, .webm, .mkv, .m4v

Browser recipe

This tool runs in your own browser. The work order you receive carries this recipe with the placeholders filled in; the selectors below are a versioned contract, not implementation detail — they do not change without a version bump.

{
    "engine": "dom",
    "steps": [
        {
            "action": "upload",
            "selector": "[data-tmb-api=\"input-file\"]",
            "accept": [
                ".mp4",
                ".mov",
                ".webm",
                ".mkv",
                ".m4v"
            ]
        },
        {
            "action": "wait",
            "selector": "[data-tmb-api=\"run\"]:not([disabled])",
            "timeout_s": 120,
            "appears": "after_upload"
        },
        {
            "action": "select",
            "selector": "[data-tmb-api=\"width\"]",
            "value": "{{width}}",
            "timeout_s": 120
        },
        {
            "action": "select",
            "selector": "[data-tmb-api=\"quality\"]",
            "value": "{{quality}}",
            "timeout_s": 120
        },
        {
            "action": "click",
            "selector": "[data-tmb-api=\"run\"]",
            "timeout_s": 120
        },
        {
            "action": "wait",
            "selector": "[data-tmb-api=\"download\"]",
            "timeout_s": 600,
            "appears": "after_run"
        },
        {
            "action": "click",
            "selector": "[data-tmb-api=\"download\"]",
            "timeout_s": 60,
            "appears": "after_run"
        },
        {
            "action": "wait",
            "selector": "[data-tmb-api=\"delivered\"]",
            "timeout_s": 60,
            "appears": "after_run"
        }
    ],
    "result": {
        "kind": "download",
        "settles": "automatically"
    }
}

What each action obliges you to do — recipes use nothing else:

uploadPut the input file into the file input matched by `selector` (it may be visually hidden: set it directly, e.g. Playwright setInputFiles). The file must match `accept`.
clickClick the element once it is visible AND enabled. A control that stays disabled means an earlier step did not take effect.
fillReplace the value of a text input with `value`, firing input/change events as typing would.
selectChoose the option whose value is `value` in a <select>.
waitWait until the element is visible, up to `timeout_s` seconds (default 30).

Race every step against the work order’s abort_when selector (html[data-tmb-run="failed"]). If it matches, the tool refused the job — for example a video that would not get any smaller. Stop, and GET the run: error.detail says why. Nothing is charged.

Errors it can return

validation_failed  insufficient_tokens 

History

  • v1 — 2026-11-20 — Initial release (browser lane, generic file recipe).

This contract cannot change without a new version and a line above: a test compares the published schema, pricing and limits against a committed lockfile and fails the build otherwise. Subscribe to /v1/changelog to be told when something moves.