crates/veilvoice-video/src/ffmpeg.rs
veilvoice-video · 718 lines · read the source here · or on GitHub
The video file, which needs a codec this project does not ship.
Why there is no encoder here
A conversation an hour long is about 108,000 frames at 30 per second. Turning those into something a phone will play means H.264 or AV1, and writing either is not a sensible thing for a voice de-identifier to do. Pulling one in is worse: every usable encoder is a large C library, and this project's dependency graph containing no such thing is a claim on its front page that a reader can check with cargo tree in ten seconds.
So the honest arrangement is the one the rest of the project already uses for exactly this kind of problem: the download in veilvoice-verify, the registry in veilvoice-watch, the driver list in veilvoice_watch::drivers. Find the tool the machine already has, prepare the exact command, and let the person decide.
And VeilVoice will not run it for you
command builds the argument list. Running it is the caller's, and a front end should print it rather than execute it silently, the same rule the companion installer follows, for the same reason.
If the machine has no ffmpeg, nothing has failed
crate::page::player has already written a file that plays everywhere and needs nothing installed. The video file is the extra, not the product.
In plain words
This works out the command that would turn the pictures and the veiled audio into a video file, and prints it for you to run.
It does not run it, and VeilVoice does not contain a video encoder. Every usable one is a large piece of C code, and adding one would mean this project no longer being something you can read the whole of. So it writes out the command for ffmpeg, which many people already have, and leaves running it to you.
WHAT THIS FILE CONTAINS
718 lines defining 9 functions (8 public), 1 type and 1 constant. Everything below is read out of the source, so it cannot disagree with the code.
The types it owns.
struct Encodingline 70 · How to render the file.
What happens when it runs. These are the ways in: public, and nothing else in this file calls them, so they are what an outside caller reaches first.
commandline 127 · The command that turns a directory of numbered frames and a WAV into a video file.concat_commandline 211 · The command that turns a concat list of held pictures and a WAV into a video file.black_commandline 275 · The command that turns a veiled recording into a video with a black frame.extract_commandline 330 · The command that takes the sound out of a recording made somewhere else.is_containerline 361 · Whether a file looks like something extract_command should be offered for.command_lineline 372 · The command as one line, for printing.describeline 386 · What to tell the user about their machine's ffmpeg.
reachesfound
WHAT CALLS WHAT
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_found["found<br/>line 50"]
n_default["Encoding::default<br/>line 98"]
n_command(["command<br/>line 127"])
n_concat_command(["concat_command<br/>line 211"])
n_black_command(["black_command<br/>line 275"])
n_extract_command(["extract_command<br/>line 330"])
n_is_container(["is_container<br/>line 361"])
n_command_line(["command_line<br/>line 372"])
n_describe(["describe<br/>line 386"])
n_describe --> n_found
click n_found href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-video/src/ffmpeg.rs#L50" "open the source"
click n_default href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-video/src/ffmpeg.rs#L98" "open the source"
click n_command href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-video/src/ffmpeg.rs#L127" "open the source"
click n_concat_command href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-video/src/ffmpeg.rs#L211" "open the source"
click n_black_command href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-video/src/ffmpeg.rs#L275" "open the source"
click n_extract_command href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-video/src/ffmpeg.rs#L330" "open the source"
click n_is_container href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-video/src/ffmpeg.rs#L361" "open the source"
click n_command_line href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-video/src/ffmpeg.rs#L372" "open the source"
click n_describe href "https://github.com/tilas01/veilvoice/blob/main/crates/veilvoice-video/src/ffmpeg.rs#L386" "open the source"
classDef entry fill:#1f2335,stroke:#7aa2f7,color:#c0caf5
class n_command,n_concat_command,n_black_command,n_extract_command,n_is_container,n_command_line,n_describe entry
classDef api fill:#1f2335,stroke:#7dcfff,color:#c0caf5
class n_found api
classDef helper fill:#1f2335,stroke:#bb9af7,color:#c0caf5
class n_default 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
| Item | Line | Documentation |
|---|---|---|
found pub fn | 50 | Where ffmpeg is, if this machine has one. |
Encoding pub struct | 70 | How to render the file. |
Encoding::default fn | 98 | |
command pub fn | 127 | The command that turns a directory of numbered frames and a WAV into a video file. |
concat_command pub fn | 211 | The command that turns a concat list of held pictures and a WAV into a video file. |
black_command pub fn | 275 | The command that turns a veiled recording into a video with a black frame. |
extract_command pub fn | 330 | The command that takes the sound out of a recording made somewhere else. |
OBS_CONTAINERS pub const | 354 | Containers OBS writes, which extract_command can take the sound out of. |
is_container pub fn | 361 | Whether a file looks like something extract_command should be offered for. |
command_line pub fn | 372 | The command as one line, for printing. |
describe pub fn | 386 | What to tell the user about their machine's ffmpeg. |