weirdnet_media/lib.rs
1//! Media processing for Weirdnet clients and nodes, shared by the apps that send audio and video to
2//! models and get speech back.
3//!
4//! - [`probe`]: WAV headers read in pure Rust; any other container through `ffprobe`.
5//! - [`pcm`]: decode WAV, mix to mono, resample (16 kHz for transcribers), crossfade, concatenate
6//! and write WAV.
7//! - [`vad`]: silence-aware cut points for long clips (30 ms RMS frames).
8//! - [`transcribe`]: the long-audio transcription plan, the prompt carried between pieces, and the
9//! re-alignment of each piece's segments onto the whole clip.
10//! - [`speak`]: [`speak::TextPlan`], the long-text speech plan (paragraph, sentence, clause; script
11//! turns kept whole), and the joins between the synthesized pieces.
12//! - [`subtitles`]: SRT and WebVTT.
13//! - [`ffmpeg`]: the hardened `ffmpeg` / `ffprobe` [`ffmpeg::Runner`] (protocol and demuxer
14//! allowlists, no URLs, no shell, time, memory and output limits) behind the [`ffmpeg::Exec`]
15//! trait, with [`ffmpeg::FakeRunner`] for tests without ffmpeg.
16//! - [`audio`]: normalization to 16 kHz mono WAV, soundtrack extraction and encoding through the
17//! runner.
18//! - [`waveform`]: an immutable `f32` [`waveform::Waveform`] (shared samples) with gain, fades, normalise, pan, mix and WAV
19//! read and write at 8 to 32 bits, converting to and from [`pcm::Pcm`] without loss.
20//! - [`video`]: video probing, frame planning (uniform, scene, hybrid, keyframes, intervals),
21//! frame and thumbnail extraction, and clips, behind [`video::FrameSource`] with
22//! [`video::FakeSource`] for tests.
23//!
24//! Nothing here fetches anything: inputs are files the caller already chose or bytes it holds.
25//! There are no defaults that stand in for a model's limits; plans take the limits the model
26//! reports and refuse, naming the missing setting, when they are absent.
27
28pub mod audio;
29pub mod error;
30pub mod ffmpeg;
31pub mod pcm;
32pub mod probe;
33pub mod speak;
34pub mod subtitles;
35pub mod transcribe;
36pub mod vad;
37pub mod video;
38pub mod waveform;
39
40pub use error::{MediaError, Result};