{
  "name": "audio-convert",
  "summary": "Transcodes an audio file between WAV, MP3, FLAC, AAC and Opus, with an optional bit rate and sample rate.",
  "rationale": "Re-encoding audio needs ffmpeg AND a hardened fetch: an agent that pulls the URL itself walks past every SSRF control, and carrying an ffmpeg per call is not something an agent does inline.",
  "family": "av",
  "price_usd": "0.003",
  "free": false,
  "timeout_ms": 94000,
  "max_timeout_seconds": 115,
  "input_schema": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "url": {
        "type": "string",
        "maxLength": 2048,
        "format": "uri",
        "description": "Absolute http(s) URL of the source file, up to 2048 characters; the first audio stream of a recognised container (MP4/MOV, Matroska/WebM, AVI, Ogg, WAV, FLAC, AIFF or MP3) is converted, and it must last at most 3600 seconds."
      },
      "to": {
        "default": "mp3",
        "description": "Output format: wav (16-bit PCM), mp3 (LAME), flac, aac (ADTS stream) or opus (in an Ogg container); defaults to mp3.",
        "type": "string",
        "enum": [
          "wav",
          "mp3",
          "flac",
          "aac",
          "opus"
        ]
      },
      "bitrate_kbps": {
        "description": "Target bit rate in kbps, lossy formats only (mp3, aac, opus): 8 to 512, and at most 192 for aac.",
        "type": "integer",
        "minimum": 8,
        "maximum": 512
      },
      "sample_rate": {
        "description": "Output sample rate in Hz, one of 8000, 11025, 16000, 22050, 32000, 44100 or 48000; when omitted ffmpeg chooses the rate, normally the source rate.",
        "type": "integer",
        "minimum": -9007199254740991,
        "maximum": 9007199254740991
      }
    },
    "required": [
      "url"
    ],
    "additionalProperties": false
  },
  "input_example": {
    "url": "https://grist.tools/samples/av/convert-beeps.flac",
    "to": "wav"
  },
  "output_example": {
    "source_url": "https://grist.tools/samples/av/convert-beeps.flac",
    "bytes": 32086,
    "source_container": "flac",
    "format": "wav",
    "bitrate_kbps": null,
    "sample_rate": null,
    "audio_bytes": 32044,
    "audio_base64": "UklGRiR9AABXQVZFZm10IBAAAAABAAEAQB8AAIA+AAACABAAZGF0YQB9AAAA4ADo..."
  },
  "errors": [
    "invalid_input",
    "blocked_target",
    "unreachable_target",
    "upstream_timeout",
    "unsupported_content_type",
    "too_large",
    "unprocessable",
    "internal"
  ]
}