音频流引擎
通过URL参数处理音频文件——实时应用效果、转换格式、切片、反转和流式传输结果。
快速开始
# Default build with filesystem storage
cargo run
# Process audio via URL
curl "http://localhost:8080/unsafe/sample.mp3?reverse=true&fade_in=1&speed=0.8"
# Get audio metadata
curl "http://localhost:8080/meta/unsafe/sample.mp3"MCP集成(连接到LLM)
看 MCP自述文件
运作原理
GET /unsafe/AUDIO_URL?effect1=value&effect2=value服务器获取音频,根据查询参数构建FFmpeg过滤器链,对其进行处理,缓存结果,并将其流式传输回来。
/HASH|unsafe/AUDIO?param1=value1¶m2=value2&...HASH--URL签名哈希,或unsafe为了发展AUDIO--音频URI(本地文件或远程URL)
支持的参数
格式和编码
format--输出格式(mp3、wav等)codec--音频编解码器sample_rate--采样率(Hz)channels--音频通道数量bit_rate--比特率(kbps)bit_depth--钻头深度quality--编码质量(0.0–1.0)compression_level--压缩级别
时间操作
start_time--开始时间(秒)duration--持续时间(秒)speed--播放速度倍增器reverse--反向音频(真/假)
批量操作
volume--音量调节倍数normalize--标准化音频级别(真/假)normalize_level--目标归一化水平(dB)
音频效果
lowpass/highpass/bandpass--滤波器截止频率bass/treble--提高/降低水平echo/chorus/flanger/phaser/tremolo--效果参数compressor--压缩机参数noise_reduction--降噪参数
淡入淡出
fade_in/fade_out--持续时间(秒)cross_fade--交叉淡入淡出持续时间(秒)
高级
custom_filters--自定义FFmpeg滤波器参数custom_options--自定义FFmpeg选项tags--元数据标签(如tag_NAME=VALUE)
端点
预览参数-- /params
curl "http://localhost:8080/params/unsafe/sample.mp3?reverse=true&fade_in=1"音频元数据-- /meta
curl "http://localhost:8080/meta/unsafe/sample.mp3"存储后端
- 本地文件系统 (
filesystem功能--默认) - AWS S3/MinIO (
s3特征) - 谷歌云存储 (
gcs特征)
cargo build --features filesystem # default
cargo build --features gcs
cargo build --features s3
cargo build --features "filesystem,gcs"配置
使用YAML配置文件+环境变量覆盖。
config/base.yml--基础配置config/local.yml--发展config/production.yml--生产
环境变量: APP_SECTION__KEY=value (例如。, APP_APPLICATION__PORT=8080)
看 架构文档 了解详情。
发展
just dev # Run with auto-reload
just test # Run tests
just bench # Run benchmarks
just lint # Clippy
just fmt # Format
just check # Full check: fmt, lint, build, test