video_subtitle/lib.rs
1//! # video-subtitle
2//!
3//! 视频自动字幕库:串联 FFmpeg 与 Whisper,完成「提取音频 → 语音识别 → 生成 SRT → 烧录字幕」全流程。
4//!
5//! ## 流水线
6//!
7//! ```text
8//! 输入视频
9//! → ffmpeg::extract_audio (16 kHz 单声道 WAV)
10//! → whisper::transcribe (带时间轴的 [`Caption`])
11//! → srt::write_srt (SubRip `.srt`)
12//! → ffmpeg::burn_subtitles (可选,硬字幕输出)
13//! ```
14//!
15//! ## 作为库使用
16//!
17//! ```no_run
18//! use clap::Parser;
19//! use video_subtitle::cli::Cli;
20//! use video_subtitle::pipeline::run;
21//!
22//! let cli = Cli::parse();
23//! let output = run(&cli)?;
24//! # Ok::<(), video_subtitle::AppError>(())
25//! ```
26//!
27//! 命令行入口见 `src/main.rs`。
28
29pub mod cli;
30pub mod error;
31pub mod ffmpeg;
32pub mod pipeline;
33pub mod srt;
34pub mod types;
35pub mod whisper;
36
37pub use error::{AppError, Result};
38pub use pipeline::{run, PipelineOutput};
39pub use types::Caption;