Docs · Make a video thumbnail
Guides · Make a video thumbnail

Make a video thumbnail

Seek to the moment with -ss on the input and write one frame to a .jpg output. Only the part of the video before that point is read.

The request

Request
curl https://media.logicboostkit.com/ffmpeg/process \
  -H "Authorization: Basic $MEDIA_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "task": {
      "inputs": [
        {
          "file_path": "dir_pi23jgy1yxlmigi873bz/source.mp4",
          "options": [
            "-ss",
            "00:00:05"
          ]
        }
      ],
      "outputs": [
        {
          "file": "thumbnail.jpg",
          "options": [
            "-frames:v",
            "1",
            "-q:v",
            "2"
          ]
        }
      ]
    }
  }'
Response
HTTP/1.1 200 OK
X-Request-Id: job_0mv6img4ztlm392wz8t7f205

{
  "ok": true,
  "result": [
    {
      "file_name": "thumbnail.jpg",
      "size_bytes": 84213,
      "download_url": "https://…"
    }
  ],
  "usage": {
    "time_sec": 1.8,
    "input_size_gb": 2,
    "output_size_gb": 0.000078429,
    "gb_sec": 3.600141173
  },
  "request_id": "job_0mv6img4ztlm392wz8t7f205",
  "amount_usd": 0.04795388
}

The input is a file you uploaded (POST /file). The full reference is POST /ffmpeg/process.

The options, explained

What each option does
-ss 00:00:05On the input: the moment to capture.
-frames:v 1Write one frame.
-q:v 2JPEG quality: 2 is near the best; 31 is the worst.

Variations

A smaller image

Scale it while you capture it; -2 keeps the proportions.

In the output: "options": ["-frames:v", "1", "-vf", "scale=320:-2", "-q:v", "3"]

PNG instead of JPEG

Lossless, and larger.

In the output: "file": "thumbnail.png", "options": ["-frames:v", "1"]

One frame every 10 seconds

A numbered output name returns every file it produces. Leave out the seek on the input.

In the input: "options": []
In the output: "file": "thumb_%03d.jpg", "options": ["-vf", "fps=1/10", "-q:v", "3"]

What it costs

One thumbnail from a 2 GB video: (2 GB + 0.0005 GB) × 2 s = 4.001 GB-seconds, which is USD 0.0533 at USD 0.01332 per GB-second.

The seconds are an example; every response reports the job’s own. Failed jobs are not charged. See Pricing.