Skip to Content
agentic-yt

Frames

Extract still images from a video at exact timestamps, as JPG or PNG.

Frames let a model with vision look at a video: the slide on screen at 12:40, the chart being described, the product being held up. One request takes up to 50 timestamps and returns one image for each.

From the CLI

ayt frames dQw4w9WgXcQ --at 0:42                          # one JPG, into the current directory
ayt frames dQw4w9WgXcQ --at 10 1:30 2:45 -o shots/        # three frames into shots/
ayt frames dQw4w9WgXcQ --at 0:42,1:05 --format png --width 1280
ayt frames dQw4w9WgXcQ --at 0:42 --url-only --json        # URLs only

--at takes one or more timestamps, separated by spaces or commas.

Over HTTP

curl -X POST "https://api.agentic-yt.crafter.run/v1/videos/dQw4w9WgXcQ/frames?wait=60" \
  -H "Authorization: Bearer $AGENTIC_YT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"timestamps":["0:42", 65, "2m45s"], "width": 1280}'

Body

FieldDefaultNotes
timestamps—Required. 1 to 50 time offsets, in any of the accepted time forms.
formatjpgjpg or png.
widthsource size16–1920 pixels. Height follows, preserving the aspect ratio.
use_accountomittedAs for downloads.

Response

A job with type: "frames". result.assets has one entry per timestamp, in the order you asked, each tagged with the timestamp (in seconds) it was taken at:

{
  "type": "frames",
  "status": "succeeded",
  "result": {
    "assets": [
      { "timestamp": 42, "filename": "dQw4w9WgXcQ_42.000_w1280.jpg", "mime": "image/jpeg", "bytes": 148211, "url": "https://…", "cache_hit": true },
      { "timestamp": 65, "filename": "dQw4w9WgXcQ_65.000_w1280.jpg", "mime": "image/jpeg", "bytes": 151004, "url": "https://…", "cache_hit": false }
    ]
  }
}

Each frame is cached on its own, by video, timestamp, format and width. That is why one response can mix cache_hit: true and false: asking for ten frames when eight already exist only extracts two. The job-level cache_hit is true only when every frame was already there.

Choosing well

  • JPG unless you need PNG. PNG is lossless and several times larger; it is worth it for screenshots of text or code that a model must read exactly.
  • Set width for vision models. Most downscale large images anyway. --width 1280 is usually enough to read a slide and a fraction of the bytes of a 1080p frame.
  • Sample, then zoom in. To find a moment, take a frame every 30 or 60 seconds first, look, then request tightly spaced frames around the one that matters.
  • Pair with the transcript. The segment that says "as you can see here" has a start; that is your timestamp.

A timestamp past the end of the video cannot produce an image: the job ends failed with validation_failed naming the timestamp and the video's length. Check duration_seconds from metadata when timestamps are computed.

Errors to expect

On this page