Files
audio2text/config.example.yaml
zikai 00e2a95fb7 Initial commit: audio2text 双语字幕生成服务
- 音频/视频转双语(英/中)SRT 字幕,Docker 容器化,CPU 开发/GPU 生产同一份代码
- faster-whisper ASR(词级时间戳) + 断句时间戳重算 + NLLB 翻译(模型不共驻)
- 分片上传(断点续传) + SQLite 持久化 + 主页/历史/日志页面
- 历史页文件名搜索;缓存定时清理(默认保留7天,可配置)
- 双 Dockerfile(cpu/gpu) + setup/start/stop 脚本
2026-07-06 06:54:19 +00:00

56 lines
2.6 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# audio2text 运行时配置。复制为 config.yaml 后填值。所有路径相对容器内 /app。
# CPU dev / GPU prod 仅靠 device + model + compute_type 三项切换,代码不变。
server:
host: 0.0.0.0 # 容器内对外监听(由 docker -p 映射到宿主)
port: 8000
workers: 1 # ML 推理为重,固定单 worker 避免显存重复占用
storage:
upload_dir: /data/uploads # 上传视频落盘根目录
work_dir: /data/.work # 分片会话暂存 + 中间音频
output_dir: /data/outputs # 生成的 SRT 字幕输出
chunk_bytes: 1048576 # 1 MiB 流式分片
chunk_session_ttl_seconds: 300 # 被放弃会话的存活秒数(后台 reaper 据此清理)
cache_retention_days: 7 # 任务产物保留天数,超期清理(字幕/中间音频/保留的原始视频+DB记录
cache_cleanup_interval_hours: 24 # 定时清理间隔(启动时跑一次,之后循环)
processing:
delete_original_after_extract: true # 提取音频成功后删除原始视频,省空间
keep_audio: false # 完成后是否保留中间 wav默认删只留字幕
asr:
# CPU devtiny.en + int8Whisper 同系列最小,英文专用)
# GPU prodlarge-v3-turbo + float163090 上几 GB 视频几分钟出字幕
model: tiny.en
device: cpu # cpu | cuda
compute_type: int8 # cpu: int8gpu: float16
language: en # 仅英语
word_timestamps: true # 词级时间戳:让断句精确而非纯匀速估算
vad_filter: true # 过滤静音段,提升质量与速度
translation:
model: facebook/nllb-200-distilled-1.3B
device: cpu # cpu | cuda
src_lang: eng_Latn # NLLB 语言码:英语
tgt_lang: zho_Hans # NLLB 语言码:简体中文
batch_size: 16 # 不与 ASR 共驻:翻译时显存独占,可用大 batch
max_length: 256 # 单条翻译最大 token
segmentation:
max_words_per_line: 14 # 单行最多词数,超出按逗号拆
max_duration_seconds: 7.0 # 单条字幕最长 7 秒
min_duration_seconds: 1.0 # 单条字幕最短 1 秒(太短则合并)
max_chars_per_line: 42 # SRT 规范:每行 ≤42 字符
logging:
level: info # debug | info | warning | error控制台 + 内存缓冲最低级别)
buffer_size: 2000 # /logs 页面内存缓冲条数
docs:
enabled: true
username: admin
password: "CHANGE_ME" # /docs Basic Auth明文root 持有,常量时间比较)
realm: "audio2text docs"