Expand description
Media processing for Weirdnet clients and nodes, shared by the apps that send audio and video to models and get speech back.
probe: WAV headers read in pure Rust; any other container throughffprobe.pcm: decode WAV, mix to mono, resample (16 kHz for transcribers), crossfade, concatenate and write WAV.vad: silence-aware cut points for long clips (30 ms RMS frames).transcribe: the long-audio transcription plan, the prompt carried between pieces, and the re-alignment of each piece’s segments onto the whole clip.speak:speak::TextPlan, the long-text speech plan (paragraph, sentence, clause; script turns kept whole), and the joins between the synthesized pieces.subtitles: SRT and WebVTT.ffmpeg: the hardenedffmpeg/ffprobeffmpeg::Runner(protocol and demuxer allowlists, no URLs, no shell, time, memory and output limits) behind theffmpeg::Exectrait, withffmpeg::FakeRunnerfor tests without ffmpeg.audio: normalization to 16 kHz mono WAV, soundtrack extraction and encoding through the runner.waveform: an immutablef32waveform::Waveform(shared samples) with gain, fades, normalise, pan, mix and WAV read and write at 8 to 32 bits, converting to and frompcm::Pcmwithout loss.video: video probing, frame planning (uniform, scene, hybrid, keyframes, intervals), frame and thumbnail extraction, and clips, behindvideo::FrameSourcewithvideo::FakeSourcefor tests.
Nothing here fetches anything: inputs are files the caller already chose or bytes it holds. There are no defaults that stand in for a model’s limits; plans take the limits the model reports and refuse, naming the missing setting, when they are absent.
Re-exports§
pub use error::MediaError;pub use error::Result;
Modules§
- audio
- Audio through the hardened runner: normalization to 16 kHz mono WAV (WAV in Rust, anything else through ffmpeg), soundtrack extraction from audio or video files, and encoding.
- error
- The crate’s error type.
- ffmpeg
ffmpegandffprobein child processes, hardened.- pcm
- PCM in memory: decode WAV, mix to mono, resample, crossfade, concatenate, write WAV. Pure Rust.
- probe
- What a file holds: WAV headers read in pure Rust, anything else through
ffprobe(hardened, incrate::ffmpeg). - speak
- Long-text speech:
TextPlansplits narration or a script into pieces that each fit the model’smax_input_chars, and says how to join the synthesized pieces. - subtitles
- SRT and WebVTT from transcript segments.
- transcribe
- Long-audio transcription: the chunking plan, the prompt carried from piece to piece, and the re-alignment of each piece’s segments onto the whole clip.
- vad
- Silence-aware cut points: where to split a long clip so each piece fits a window, cutting at the quietest moment near the end of each window rather than in the middle of a word.
- video
- Video: probing, frame planning (uniform, scene, hybrid, keyframes, fixed intervals), frame, thumbnail and soundtrack extraction, and clips.
- waveform
- An immutable
f32Waveformfor editing and mixing, next to the 16-bitcrate::pcm::Pcmthe speech paths use.