catalogue / tools / Audio & video / AIFF to AAC

Convert AIFF to AAC

To convert AIFF to AAC, send one POST to /v1/audio-convert with the AIFF source and "to": "aac" in the body. Left out, "to" falls back to its default "mp3", so a AAC 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

01Limits

LimitValue
Largest source file100 MB (104,857,600 bytes)
Longest input60 min (3,600 s)
Timeout94 s
Source formatsAIFF, AVI, FLAC, MKV, MP3, MP4, Ogg, WAV
Output formatsAAC, FLAC, MP3, Opus, WAV

02Example

A real AIFF to AAC run of audio-convert.

Request
POST /v1/audio-convert
content-type: application/json
payment-signature: <base64 x402 payload>

{
  "url": "https://grist.tools/samples/av/pair-tone.aiff",
  "to": "aac"
}
Response
200 OK
payment-response: <base64 settlement receipt>

{
  "source_url": "https://grist.tools/samples/av/pair-tone.aiff",
  "bytes": 48054,
  "source_container": "aiff",
  "format": "aac",
  "bitrate_kbps": null,
  "sample_rate": null,
  "audio_bytes": 6815,
  "audio_base64": "//FsQEcf/AEIVCwkSCWOhseh2GBMWgoSxP/FVWquNyXXqT27fHGt/by8JON5JU//..."
}

Source file: av/pair-tone.aiff, 46.9 KB (48,054 bytes). 3 s mono 8 kHz 16-bit PCM AIFF file written directly by the generator: three 0.5 s 500 Hz triangle beeps at rising level, each followed by 0.5 s of silence. The recorded run returned 6.7 KB (6,815 bytes) of AAC, 14% of the source size, with the source read as the aiff container. Decoded, the AAC in audio_base64 opens with FF F1 6C 40 47 1F FC 01 08 54 2C 24. Recorded with ffmpeg 8.1.2.

In the sample itself, the FORM container is of type AIFF; the COMM chunk declares 1 channel, 24,000 sample frames of 16 bits and a rate of 8,000 Hz stored as an 80-bit extended float, 3 s; the SSND chunk holds 48,008 bytes, big-endian samples behind an 8-byte offset and block size header. In the returned AAC: it opens with an ADTS frame header carrying no CRC: MPEG-4 AAC LC, 8,000 Hz, 1 channel, a first frame of 568 bytes, and buffer fullness 0x7FF, the value that marks a variable bitrate stream.

03Format notes

AIFF as a source

AIFF files start with the IFF marker FORM, and Grist also requires the form type at byte eight to read AIFF or AIFC, the variant that allows compressed audio. Classic AIFF stores its PCM samples big-endian, the opposite byte order to WAV. The format is audio only, so video-thumbnail and subtitle-extract turn it away as a container without a picture or caption stream, and audio-convert is its single reader. That service measures the first audio stream's duration, maps only that stream, and strips metadata and chapters before encoding. AIFF is absent from audio-convert's destination enum, so it can be read here but not written. Converting to WAV rewrites the samples as little-endian PCM through the pinned pcm_s16le codec, which changes byte order without altering the sampled values of a sixteen-bit source.

AAC as a target

AAC output is a raw ADTS stream: ffmpeg's aac encoder writes through the adts muxer, and no MP4 container is built around it. Each ADTS frame carries its own header, and the stream is written straight to a pipe without a seekable file. The bitrate_kbps setting applies, but AAC has its own lower ceiling, because it is the slowest encoder of the set and that ceiling keeps a maximum-length input inside the encode deadline. Only the first audio stream is encoded; video, metadata and chapters are dropped, and bit-exact flags keep output reproducible for the pinned ffmpeg. sample_rate is optional, otherwise ffmpeg normally keeps the source rate. AAC is a destination only: a raw ADTS file would pass the MPEG frame-sync sniff, yet nothing proves ffmpeg would receive the right demuxer, so it is not accepted as a source.

04Errors

CodeHTTP
invalid_input400
blocked_target403
unreachable_target424
upstream_timeout424
unsupported_content_type415
too_large413
unprocessable422
internal500

When each is raised, and what it means for payment: /docs/audio-convert.

05Questions

What does it cost to convert AIFF to AAC?
$0.003 per call, paid in USDC on Base via x402.
How large can the AIFF 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.

06Related