> ## Documentation Index
> Fetch the complete documentation index at: https://rendi.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Generate a thumbnail from a video

> Capture a single frame at a specific timestamp and save it as JPG or PNG using Rendi's FFmpeg API. Node.js, Python, and cURL examples.

Capture a single frame from a video at a specific timestamp. Useful for video previews, poster frames, or social card images.

## Code

<Tabs>
  <Tab title="Node.js">
    ```js theme={null}
    const API_KEY = process.env.RENDI_API_KEY;

    const submit = await fetch("https://api.rendi.dev/v1/run-ffmpeg-command", {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
        "X-API-KEY": API_KEY,
      },
      body: JSON.stringify({
        input_files: {
          in_1: "https://storage.rendi.dev/sample/sample.avi",
        },
        output_files: {
          out_1: "thumbnail.jpg",
        },
        ffmpeg_command: "-i {{in_1}} -ss 00:00:17 -vframes 1 {{out_1}}",
      }),
    });
    const { command_id } = await submit.json();

    while (true) {
      const res = await fetch(`https://api.rendi.dev/v1/commands/${command_id}`, {
        headers: { "X-API-KEY": API_KEY },
      });
      const data = await res.json();
      if (data.status === "SUCCESS") {
        console.log("Thumbnail URL:", data.output_files.out_1.storage_url);
        break;
      }
      if (data.status === "FAILED") throw new Error("Command failed");
      await new Promise((r) => setTimeout(r, 2000));
    }
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={null}
    import os
    import time
    import requests

    API_KEY = os.environ["RENDI_API_KEY"]
    BASE = "https://api.rendi.dev/v1"
    headers = {"X-API-KEY": API_KEY}

    submit = requests.post(
        f"{BASE}/run-ffmpeg-command",
        headers=headers,
        json={
            "input_files": {"in_1": "https://storage.rendi.dev/sample/sample.avi"},
            "output_files": {"out_1": "thumbnail.jpg"},
            "ffmpeg_command": "-i {{in_1}} -ss 00:00:17 -vframes 1 {{out_1}}",
        },
    )
    command_id = submit.json()["command_id"]

    while True:
        res = requests.get(f"{BASE}/commands/{command_id}", headers=headers).json()
        if res["status"] == "SUCCESS":
            print("Thumbnail URL:", res["output_files"]["out_1"]["storage_url"])
            break
        if res["status"] == "FAILED":
            raise RuntimeError("Command failed")
        time.sleep(2)
    ```
  </Tab>

  <Tab title="cURL">
    ```bash theme={null}
    curl --request POST \
      --url https://api.rendi.dev/v1/run-ffmpeg-command \
      --header 'Content-Type: application/json' \
      --header 'X-API-KEY: <api-key>' \
      --data '{
        "input_files": {"in_1": "https://storage.rendi.dev/sample/sample.avi"},
        "output_files": {"out_1": "thumbnail.jpg"},
        "ffmpeg_command": "-i {{in_1}} -ss 00:00:17 -vframes 1 {{out_1}}"
      }'

    curl --request GET \
      --url https://api.rendi.dev/v1/commands/<command_id> \
      --header 'X-API-KEY: <api-key>'
    ```
  </Tab>
</Tabs>

## How the FFmpeg command works

* `-i {{in_1}}` — input video URL
* `-ss 00:00:17` — seek to 17 seconds (format: `HH:MM:SS` or raw seconds)
* `-vframes 1` — capture exactly one frame
* `{{out_1}}` — output file (`thumbnail.jpg`). Use `.png` for lossless output.

## Response

```json theme={null}
{
  "output_files": {
    "out_1": {
      "file_id": "5a978607-8c20-4b3b-91db-b67516e7f274",
      "size_mbytes": 0.024,
      "file_type": "image",
      "file_format": "jpg",
      "storage_url": "https://storage.rendi.dev/temp_files/.../thumbnail.jpg",
      "width": 854,
      "height": 480
    }
  },
  "status": "SUCCESS",
  "command_type": "FFMPEG_COMMAND"
}
```

## Related

* [Generate multiple thumbnails](/examples/generate-multiple-thumbnails)
* [Thumbnail + GIF (chained)](/examples/thumbnail-and-gif-chained)
* [Cheatsheet — Create thumbnails from video](https://github.com/rendi-api/ffmpeg-cheatsheet#create-thumbnails-from-video)
