Convert MKV to WAV
To convert MKV to WAV, send one POST to /v1/audio-convert with the MKV source and "to": "wav" in the body. Left out, "to" falls back to its default "mp3", so a WAV 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 100 MB and 60 min (3,600 s) long.
Agents read this page asGET /v1/audio-convert/schemafree: schema, examples, errors, price
- Endpoint
- POST /v1/audio-convert
- Price
- $0.003 per call
- Selects the target
- "to": "wav"
Limits
| Limit | Value |
|---|---|
| Largest source file | 100 MB (104,857,600 bytes) |
| Longest input | 60 min (3,600 s) |
| Timeout | 94 s |
| Source formats | AIFF, AVI, FLAC, MKV, MP3, MP4, Ogg, WAV |
| Output formats | AAC, FLAC, MP3, Opus, WAV |
Example
A real MKV to WAV run of audio-convert.
POST /v1/audio-convert
content-type: application/json
payment-signature: <base64 x402 payload>
{
"url": "https://grist.tools/samples/av/pair-clip.mkv",
"to": "wav"
}200 OK
payment-response: <base64 settlement receipt>
{
"source_url": "https://grist.tools/samples/av/pair-clip.mkv",
"bytes": 10531,
"source_container": "matroska",
"format": "wav",
"bitrate_kbps": null,
"sample_rate": null,
"audio_bytes": 64044,
"audio_base64": "UklGRiT6AABXQVZFZm10IBAAAAABAAEAQB8AAIA+AAACABAAZGF0YQD6AAAA0ADc..."
}Source file: av/pair-clip.mkv, 10.3 KB (10,531 bytes). 4 s Matroska file made by ffmpeg: a 64x36 PNG video stream at 1 fps (a slate field with a small amber square moving right), a mono 8 kHz FLAC audio track of two 500 Hz triangle beeps, and an English SubRip subtitle stream with two cues. The recorded run returned 62.5 KB (64,044 bytes) of WAV, 6.1 times the source size, with the source read as the matroska container. Decoded, the WAV in audio_base64 opens with 52 49 46 46 24 FA 00 00 57 41 56 45 (ASCII RIFF and WAVE). Recorded with ffmpeg 8.1.2.
In the sample itself, the EBML header names DocType matroska, version 4, readable by a version 2 parser; Segment Info sets a timestamp scale of 1,000,000 ns and a duration of 4,000 ticks, 4 s, with Lavf as the muxing application; the Tracks element lists codec IDs V_MS/VFW/FOURCC (video, language und), A_FLAC (audio, language und) and S_TEXT/UTF8 (subtitle, language eng). In the returned WAV: the RIFF header counts 64,036 bytes after itself, and the fmt chunk, in its own field order, declares audio format 1 (integer PCM), 1 channel, 8,000 Hz, 16,000 bytes per second, a block align of 2 bytes and 16 bits per sample. The data chunk right after it holds 64,000 bytes of samples, 4 s at that rate.
Format notes
MKV as a source
Matroska files begin with the EBML magic 1A 45 DF A3, and WebM uses the same signature, so the sniffer treats both as a single container and reports it as matroska in the container field of each response. Matroska is built from tracks that ffmpeg can address independently. When audio is the target, the first audio track is decoded and any picture is ignored. For a still frame, the requested timestamp is sought at the demuxer level before one picture is decoded, with sound excluded. A subtitle track is chosen by its index counted among subtitle tracks only, starting from zero, and an index that matches nothing is refused rather than answered with an empty file. SubRip or WebVTT text written by ffmpeg comes back together with a cue count taken from the timing arrows in that text.
WAV as a target
Every WAV that audio-convert writes holds signed little-endian PCM from the pinned pcm_s16le codec, whatever encoding the source used. The RIFF header records chunk sizes that are only known once the last sample is written, and the WAV muxer fills them in when the file closes, so ffmpeg cannot stream this format to a pipe: it writes a seekable temporary file inside the per-call directory and Grist reads that file back. Sending bitrate_kbps for this lossless destination is rejected instead of being ignored. sample_rate is optional and limited to the closed set the service lists; without it ffmpeg chooses, normally keeping the source rate. Video, metadata and chapters are left behind, and only the first audio stream is mapped. With the pinned ffmpeg and bit-exact flags, the same input yields the same bytes. When the source was lossy, the WAV is the decoded result at full size: uncompressed, yet no detail the earlier codec discarded comes back.
Errors
When each is raised, and what it means for payment: /docs/audio-convert.
Questions
What does it cost to convert MKV to WAV?
$0.003 per call, paid in USDC on Base via x402.
How large can the MKV file be?
Up to 100 MB (104,857,600 bytes), and at most 60 min (3,600 s) of media. 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.