Convert AVI to WAV
To convert AVI to WAV, send one POST to /v1/audio-convert with the AVI 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.
- Endpoint
POST /v1/audio-convert- Price
- $0.003 per call
- Service
- audio-convert
01Limits
| 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 |
02Example
A real AVI 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.avi",
"to": "wav"
}200 OK
payment-response: <base64 settlement receipt>
{
"source_url": "https://grist.tools/samples/av/pair-clip.avi",
"bytes": 76302,
"source_container": "avi",
"format": "wav",
"bitrate_kbps": null,
"sample_rate": null,
"audio_bytes": 64044,
"audio_base64": "UklGRiT6AABXQVZFZm10IBAAAAABAAEAQB8AAIA+AAACABAAZGF0YQD6AAAA0ADc..."
}Source file: av/pair-clip.avi, 74.5 KB (76,302 bytes). 4 s AVI file made by ffmpeg: a 64x36 PNG video stream at 1 fps (a slate field with a small amber square moving right) and a mono 8 kHz 16-bit PCM audio track of two 500 Hz triangle beeps; no subtitle stream. The recorded run returned 62.5 KB (64,044 bytes) of WAV, 84% of the source size, with the source read as the avi 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 avih main header sets 1,000,000 microseconds per frame, 4 frames, 2 streams and a 64 by 36 frame; the stream headers are vids with handler MPNG, rate 1 over scale 1 and auds, rate 8,000 over scale 1, format tag 0x0001 at 8,000 Hz and 16 bits; an idx1 chunk indexes the frames at the end of the file. 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.
03Format notes
AVI as a source
AVI is a RIFF container whose form type at byte eight is the four characters AVI followed by a space. Grist checks that form type, not the extension, before ffmpeg sees the file. Three of the conversion services on these pages accept it. audio-convert reads the first audio stream and ignores video; video-thumbnail seeks at the demuxer and decodes exactly one frame with audio disabled; subtitle-extract maps a subtitle stream by its zero-based index. That last route has a practical gap: ffmpeg's AVI muxer writes no text subtitle stream, only DivX XSUB bitmaps, so no real AVI with text captions could be produced for an example, and the AVI subtitle pages carry none. An AVI whose subtitle index matches nothing is refused rather than answered with an empty result. Each response reports the sniffed container as avi alongside the size of the fetched file.
WAV as a target
WAV output is written with the pinned pcm_s16le codec, so every result holds signed little-endian PCM regardless of the source encoding. The WAV muxer fills in its RIFF chunk sizes when the file closes, so Grist points ffmpeg at a seekable temporary file inside the per-call directory and reads it back, rather than streaming to a pipe. A bitrate_kbps value is rejected for this lossless destination instead of being ignored. The optional sample_rate must come from the service's closed set; left out, ffmpeg chooses, normally keeping the source rate. Only the first audio stream is mapped, with video, metadata and chapters removed, and bit-exact flags make the bytes reproducible for the pinned ffmpeg. PCM from a lossy source contains the decoded samples at full size, without restoring detail the earlier codec discarded.
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/audio-convert.
05Questions
- What does it cost to convert AVI to WAV?
- $0.003 per call, paid in USDC on Base via x402.
- How large can the AVI 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.