API Reference
M4A to MP3 API
REQUEST
m4a2mp3-api
ID 41
Convert a public m4a URL to mp3 for playback, transcription, or editing.
REQUEST
https://xiaoapis.com/api/audio/m4a2mp3
Overview
- m4a→mp3
- 可指定码率
- 返回 mp3 地址
Use cases
- 格式统一
- 转写前预处理
- 播放兼容
Conventions
- Gateway ·
https://xiaoapis.com - Auth · send
key(query or JSON body, as this API specifies) - Response · JSON. Check the business code and the HTTP status, not only HTTP 200
Authentication
Send the platform API key (query parameter key or JSON field key, as this page specifies). Create one in API key management.
REQUEST https://xiaoapis.com/api/audio/m4a2mp3
Content-Type: application/json
{
"key": "YOUR_API_KEY"
}
Request example
/api/audio/m4a2mp3?key=你的密钥&url=https://example.com/audio.m4a&bitrate=128
Details
请求HEADER:
| 名称 | 值 |
|---|---|
| Content-Type | application/x-www-form-urlencoded;charset:utf-8; |
| Content-Type | application/json(JSON 提交时) |
请求参数说明:
| 名称 | 必填 | 类型 | 示例值 | 说明 |
|---|---|---|---|---|
| key | 是 | string | 35kj5jnlj53453kl5j43nj5 | 接口密钥,在控制台->密钥管理查看 |
| url | 是 | string | https://example.com/audio.m4a | 待转换的 m4a 公网地址,必须是 http/https。兼容 audio_url、m4a_url |
| audio_url | 否 | string | https://example.com/audio.m4a | url 的别名,url 为空时生效 |
| m4a_url | 否 | string | https://example.com/audio.m4a | url 的别名,url、audio_url 都为空时生效 |
| bitrate | 否 | int | 128 | 输出 MP3 码率,单位 kbps。仅支持 64 / 96 / 128 / 192 / 256 / 320,默认 128 |
| output_name | 否 | string | voice_001 | 输出文件名(不含扩展名),仅允许字母数字下划线和中划线;不传则自动生成 |
返回参数说明:
| 名称 | 类型 | 说明 |
|---|---|---|
| code | int | 状态码,200 表示转换成功 |
| msg | string | 状态信息 |
| data | object | 转换结果 |
| data.url | string | 转换后的 MP3 公网地址 |
| data.audio_url | string | 与 data.url 相同,方便按音频字段取值 |
| data.bytes | int | MP3 文件大小,单位字节 |
| data.bitrate | int | 实际使用的码率,单位 kbps |
| data.duration | float | 音频时长,单位秒;探测失败时为 0 |
| data.job_id | string | 本次转换任务编号 |
| debug | string/array | 调试数据 |
| exec_time | float | 执行耗时 |
| ip | string | 客户端IP |
使用说明:
| 项目 | 说明 |
|---|---|
| 请求方式 | 同时支持 GET、POST、JSON |
| 转换原理 | 本机 ffmpeg 将 AAC/M4A 解码后用 libmp3lame 重新编码为 MP3,不是改后缀 |
| 文件限制 | 仅接受公网可访问地址,单文件不超过 80MB |
| 计费 | 转换成功后按后台 consume 扣点,失败不扣 |
Response example
{"code":200,"msg":"转换成功","data":{"url":"https://xiaoapis.com/upload/audio_convert/2026/08/31/m4a_20260831100000_abcd1234.mp3","audio_url":"https://xiaoapis.com/upload/audio_convert/2026/08/31/m4a_20260831100000_abcd1234.mp3","bytes":123456,"bitrate":128,"duration":12.5,"job_id":"m4a_20260831100000_abcd1234"},"exec_time":1.234567,"ip":"1.2.3.4"}
Error codes
| 错误码 | 类型 | 说明 |
|---|---|---|
| 200 | int | 转换成功 |
| 400 | int | 参数错误:缺少 url、地址不是 http/https、bitrate 不在允许范围、接口未添加或未开启 |
| 403 | int | 密钥无效或没有权限 |
| 405 | int | 请求方法不支持,仅允许 GET 或 POST |
| 500 | int | 服务器内部错误:音频下载失败、超过 80MB、ffmpeg 不可用或转码失败 |
FAQ
如何转换 m4a?
传入公网 m4a 地址与 API Key,按文档可选 bitrate 等参数。
输出是什么?
转换后的 mp3 可访问地址(字段见文档)。
有大小限制吗?
有,以接口文档限制为准。
为什么要转码?
统一后续 TTS/ASR/剪辑链路的输入格式,提高兼容性。
失败怎么办?
检查 URL 是否可下载、是否为合法 m4a、额度是否充足。
Related APIs
Full console doc (with the debugger):/doc/41