lib.rs

crates/veilvoice-video/src/lib.rs

veilvoice-video · 180 lines · read the source here · or on GitHub

A watchable version of a veiled conversation: the waveform, a circle per speaker, the title, the subtitles, and a background.

What this produces, and what needs something else

A self-contained page, always. page::player writes one HTML file that plays the veiled audio, draws its waveform, lights each speaker's circle as they talk and shows the subtitles. It needs nothing installed, it contacts nothing, it opens in any browser on any device, and it is what this crate is for.

A video file, only if ffmpeg is there. Turning a few thousand frames into an .mp4 needs a codec, and this project ships none: writing an H.264 encoder is not a sensible thing for a voice de-identifier to do, and pulling one in would put a large C dependency into a graph whose emptiness is a front-page claim. So ffmpeg finds the tool if the machine has it and prepares the exact command; if the machine does not, the page is still there and nothing has failed.

VeilVoice never downloads or runs ffmpeg on your behalf, exactly as it never installs any other companion.

An export, the way a recorder does it

Roadmap item 175. export is the questions a recording tool asks before it writes a file: sound, picture or both; a container and a codec; a quality from a lossless master down to something that fits in a message. motion is the picture it writes: a wave that moves with the sound, in a look chosen from a template for every theme and several more, with a thumbnail of each recording drawn the same way. Whatever the picture is, the sound is lossless: FLAC, ALAC or PCM, never a lossy codec.

The page needs a little JavaScript, and says so

Lighting the right circle means knowing where the audio has got to, and only the audio element knows that. There is a small inline script, with no file, no network and no library, and a <noscript> that says what it does. Without it the audio still plays, the subtitles still appear and the waveform is still drawn; the circles simply do not light up.

A picture is not veiled

A speaker may have a portrait, and it is drawn exactly as supplied. Nothing here anonymises an image: a photograph of somebody's face beside their veiled voice identifies them completely. The default is a plain filled circle for that reason, and SCOPE says it where a user will read it.

In plain words

This draws the picture.

A waveform, a circle for each person in their own colour with their name under it, a title, and a page that plays all of it together in a browser and needs nothing installed.

It does not make a video file. That needs an encoder, and this project ships none -- so it prints the command that would do it with ffmpeg, if you have ffmpeg, and leaves running it to you.

WHAT THIS FILE CONTAINS

180 lines defining 3 functions (0 public), 1 type and 2 constants. Everything below is read out of the source, so it cannot disagree with the code.

The types it owns.

  • enum Error line 99 · Everything that can go wrong in this crate.

WHAT CALLS WHAT

Error::from line 125 Error::fmt line 131 Error::source line 142 helper: private to this file dashed: a call that goes back up, or across a wrapped rank The functions this file defines, and the calls between them. An edge means the callee's name appears, called, inside the caller's body. This is a syntactic reading, not a type-resolved one.

The functions this file defines, and the calls between them. An edge means the callee's name appears, called, inside the caller's body. This is a syntactic reading, not a type-resolved one.

The same graph as Mermaid source
%%{init: {"theme":"base","themeVariables":{"background":"#1a1b26","primaryColor":"#1f2335","primaryTextColor":"#c0caf5","primaryBorderColor":"#7aa2f7","secondaryColor":"#16161e","tertiaryColor":"#16161e","lineColor":"#737aa2","textColor":"#c0caf5","mainBkg":"#1f2335","nodeBorder":"#7aa2f7","clusterBkg":"#16161e","clusterBorder":"#2f3549","fontFamily":"ui-monospace, SFMono-Regular, Consolas, monospace","fontSize":"14px"}}}%%
flowchart TD
    n_from["Error::from<br/>line 125"]
    n_fmt["Error::fmt<br/>line 131"]
    n_source["Error::source<br/>line 142"]
    click n_from href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-video/src/lib.rs#L125" "open the source"
    click n_fmt href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-video/src/lib.rs#L131" "open the source"
    click n_source href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-video/src/lib.rs#L142" "open the source"
    classDef helper fill:#1f2335,stroke:#bb9af7,color:#c0caf5
    class n_from,n_fmt,n_source helper
    subgraph chart_key ["Key"]
        direction LR
        key_helper["helper: private to this file"]
    end
    class key_helper helper

This site loads no third-party script, so it cannot run Mermaid; the diagram above is the same nodes and edges drawn by the generator instead. GitHub renders the source below directly.

ITEMS

ItemLineDocumentation
VERSION pub const81Crate version string, surfaced in the About panel.
SCOPE pub const87What a rendered video is worth, in the words a front end should show.
Error pub enum99Everything that can go wrong in this crate.
Error::from fn125
Error::fmt fn131
Error::source fn142