pub fn transcode_to_webm(input: &Path, output: &Path) -> Result<(), EncodeError>Expand description
Transcode an existing video file (the MP4/H.264 recording scratch)
into a VP9 + Opus .webm at output. Drives the Save panel’s
“WebM” export: the recorder always captures to an MP4/H.264 scratch
(the canonical intermediate), and a WebM export re-encodes it here.
Probes input for an audio track via scratch_has_audio and
includes the Opus leg only when one is present — a screen-only
recording’s scratch has no audio track, and wiring an audio branch
to a decodebin pad that never appears would hang webmmux
waiting for EOS on it.
VP9 has no Apple HW encoder, so this uses the vp9enc software
encoder (same as the live WebM encode path) — a short clip takes a
few seconds. Call it off the main thread (the recorder runs it
via spawn_blocking).
§Errors
EncodeError::InvalidConfig—inputdoesn’t exist.EncodeError::Spawn—gst-launch-1.0missing from PATH.EncodeError::PipelineFailed— the transcode exited non-zero.