Extract thumbnails from video

Every video needs a poster image. Thumbnails drive click-through rates in feeds, search results, and video players.

API

ittybit image \
  -i https://example.com/video.mp4 \
  --cloud
const task = {
  input: "https://example.com/video.mp4",
  kind: "image",
};

const res = await fetch("https://api.ittybit.com/tasks", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.ITTYBIT_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify(task),
});
const data = await res.json();
import requests

task = {
    "input": "https://example.com/video.mp4",
    "kind": "image",
}

res = requests.post(
    "https://api.ittybit.com/tasks",
    headers={"Authorization": f"Bearer {api_key}"},
    json=task,
)
data = res.json()
TASK='{
  "input": "https://example.com/video.mp4",
  "kind": "image"
}'

curl -X POST https://api.ittybit.com/tasks \
  -H "Authorization: Bearer $ITTYBIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d "$TASK"

At 5 seconds, resized:

{"input": "https://...", "kind": "image", "options": {"start": 5, "format": "webp", "width": 640}}

CLI

ittybit image \
  -i video.mp4 \
  -o poster.jpg

ittybit image \
  -i video.mp4 \
  -o poster.webp \
  --start 5 \
  --width 640

Multiple sizes

ittybit image \
  -i video.mp4 \
  -o large.webp \
  --width 1280

ittybit image \
  -i video.mp4 \
  -o medium.webp \
  --width 640

ittybit image \
  -i video.mp4 \
  -o small.webp \
  --width 320

Format choice

FormatBest for
jpegBroadest compatibility
webp25-35% smaller than JPEG
avifSmallest files, slower decode
pngLossless

S3 input/output

Extract thumbnails from S3-hosted video using connections:

ittybit image \
  -i s3://uploads/video.mp4 \
  -o s3://media/poster.webp \
  --connection my-s3 \
  --start 5 \
  --width 640

See also