Module transcode

Source
Expand description

Converting audio on the way out, by driving ffmpeg.

ffmpeg is an external program, not a dependency. It is looked for, run, and its absence reported in a sentence rather than as a mysterious failure. The rule in CLAUDE.md about adding crates is not being bent here: nothing is linked, nothing is vendored, and a build without ffmpeg installed is a build where every other command still works.

This is the first thing in the project that writes audio, and the line is worth guarding: it writes new files, under a folder the user named, and it never opens a source file for writing. Writing tags into a file produced here is not the tag-rewriting the project refuses — that refusal protects the user’s own files, whose modification date, integrity verdict and scan state all depend on not being touched. A file that did not exist a second ago has none of those.

Enums§

Quality
How hard the encoder should try, as the user asked for it.
Target
A format a copy can be converted into.

Functions§

convert
Converts one file, and reports what went wrong in words rather than in an exit status.
estimated_size
Roughly what a converted file will weigh, for a report given before the work.
find_ffmpeg
Where ffmpeg is, or None when it is not installed.
missing_ffmpeg
What to tell somebody who has no ffmpeg, worded so they can act on it.
validate_conversion
Refuses lossless conversions that cannot represent the source samples.
verify
Checks a converted file the only way a converted file can be checked.