Convert Ogg to JPEG (single frame)
To convert Ogg to JPEG (single frame), send one POST to /v1/video-thumbnail with the Ogg source and "format": "jpeg" in the body. Left out, "format" falls back to its default "png", so a JPEG request has to send it. Each call costs $0.003 in USDC on Base via x402, with no account and no API key. The source file can be up to 200 MB.
- Endpoint
POST /v1/video-thumbnail- Price
- $0.003 per call
- Service
- video-thumbnail
01Limits
| Limit | Value |
|---|---|
| Largest source file | 200 MB (209,715,200 bytes) |
| Timeout | 60 s |
| Source formats | AVI, MKV, MP4, Ogg |
| Output formats | JPEG, PNG |
| Option time_seconds | default 0 |
02Example
A real Ogg to JPEG run of video-thumbnail.
POST /v1/video-thumbnail
content-type: application/json
payment-signature: <base64 x402 payload>
{
"url": "https://grist.tools/samples/av/pair-clip.ogg",
"time_seconds": 1,
"format": "jpeg"
}200 OK
payment-response: <base64 settlement receipt>
{
"source_url": "https://grist.tools/samples/av/pair-clip.ogg",
"bytes": 12553,
"container": "ogg",
"time_seconds": 1,
"format": "jpeg",
"width": 64,
"height": 36,
"image_bytes": 383,
"image_base64": "/9j/4AAQSkZJRgABAgAAAQABAAD/2wBDAAgEBAQEBAUFBQUFBQYGBgYGBgYGBgYG..."
}Source file: av/pair-clip.ogg, 12.3 KB (12,553 bytes). 4 s Ogg file: a 64x36 Theora video stream at 1 fps (a slate field with a small amber square moving right) and a mono 8 kHz FLAC audio track of two 500 Hz triangle beeps, both muxed by ffmpeg, plus a two-cue OGM text subtitle stream added by the generator. The request sets time_seconds to 1. The recorded run returned 383 bytes of JPEG, 3% of the source size, with the source read as the ogg container, an image of 64x36 pixels and the frame taken at 1 s. Decoded, the JPEG in image_base64 opens with FF D8 FF E0 00 10 4A 46 49 46 00 01 (ASCII JFIF). Recorded with ffmpeg 8.1.2.
In the sample itself, 16 Ogg pages carry 3 logical streams: Theora 3.2.1 video of 64 by 36 pixels at 1 frame per second (serial 0), FLAC 1.0 mapping audio at 8,000 Hz with 1 channel (serial 1) and an OGM text stream (serial 2). The end-of-stream pages hold granule positions 2,250 for serial 2, 67 for serial 0 and 32,000 for serial 1. In the returned JPEG: after the start-of-image marker comes a 16-byte JFIF APP0 segment, version 1.02, density 1 by 1 with no unit. The segment after it has marker FF DB.
03Format notes
Ogg as a source
An Ogg file opens with the capture pattern OggS, and the container can carry Vorbis, Opus or Theora streams. Grist sniffs that pattern and hands Ogg to three of the conversion services on these pages. Audio conversion decodes the first audio stream, leaving any Theora picture aside. A thumbnail request seeks before opening the input and decodes a single frame from the first video stream, discarding sound. Caption extraction maps a subtitle stream counted from zero among the subtitle streams and serialises it through ffmpeg. Because audio-convert writes its Opus output inside Ogg, a file produced by that service comes back as an Ogg source, not as a separate Opus format. Theora is a lossy video codec, so a frame taken from it carries compression noise into the thumbnail, unlike a clip whose video stream is itself stored losslessly.
JPEG as a target
image-convert writes JPEG through sharp with options pinned around the caller's quality value. mozjpeg is off, scans are baseline rather than progressive, chroma subsampling is fixed, coding is optimised, and trellis quantisation and overshoot deringing are both disabled. Fixing these settings means the same image, format and quality produce the same bytes on a given build, instead of drifting with a libvips default. The pixel grid is not resized; only codec and container change, and the response reports the width and height of the result. Because withMetadata is never called, EXIF and similar blocks are dropped. An animated input is opened with animation off, so its first frame is the one encoded. Video frames take another road: video-thumbnail decodes one picture and hands it to ffmpeg's mjpeg encoder, which streams it out through image2pipe.
Note: The answer is one frame of the video, taken at the timestamp you choose, not the whole video. The Ogg file must carry a video stream: an audio-only Ogg (Vorbis or Opus) has no frame to grab and fails with unprocessable (no_frame).
04Errors
| Code | HTTP |
|---|---|
invalid_input | 400 |
blocked_target | 403 |
unreachable_target | 424 |
upstream_timeout | 424 |
unsupported_content_type | 415 |
too_large | 413 |
unprocessable | 422 |
internal | 500 |
When each is raised, and what it means for payment: /docs/video-thumbnail.
05Questions
- What does it cost to convert Ogg to JPEG?
- $0.003 per call, paid in USDC on Base via x402.
- How large can the Ogg file be?
- Up to 200 MB (209,715,200 bytes). Past a limit the call answers too_large (413).
- What happens if the conversion fails?
- The tool answers with a typed JSON error from the errors table. Payment is settled only after the tool has produced its result; a call that fails inside the tool is never settled.