# Hosted media analysis

Ask questions about saved video or images, with timestamps and on-screen text, paid with StillMade credits.

`media.analyze` asks StillMade's media vision a question about saved media and
returns structured evidence. Declare one `video`, `image` or `image[]` (one to
four images) input, one `text` or `json` output and
`permissions.capabilities: ["media.analyze"]`. A video Block may bind two
optional `number` inputs as a time range to look at closely (at most 12 seconds):

```json
{"schemaVersion":1,"operation":"media.analyze","media":{"$input":"clip"},
 "question":"Is the product logo clearly visible, and when?",
 "range":{"start":{"$input":"start"},"end":{"$input":"end"}},"output":"report"}
```

StillMade reads the media from the runner's own library (never from another
account or an arbitrary URL), samples a video into a timestamped contact sheet
or uses the still image, and asks the vision model the Block's question (1 to
2,000 characters). A `json` output receives
`{"schemaVersion":1,"items":[{"kind","summary","timeline","observations","detectedText","issues","confidence","range"?}]}`
with timestamps in seconds; each list holds up to 20 entries. A `text` output
receives the summaries (numbered when there are several images).

Each analyzed image or video is one priced call, paid with StillMade credits;
the quote lists the price for every fixture and the sample. Media that cannot
be read (not saved in the library, too large, or undecodable) is refunded. The
offline SDK includes `packages/block-sdk/media-analysis-example.js`, exporting
`mediaAnalysis`.
