Files
shinyobjectz 04adefa570 L1 for every branch landing at once: crates and files back under their limits, copies folded, the Solari fix marked
- raea-sys-shots: raea-sys-frame's cuts between cameras as a crate of their own (frame re-exports it as shots), so
  frame's new Cut fits under the crate limit; runtime/scene's paint_cut joins cam_keyed's prefixes.
- sdk/video controls.ts: a composition's controls out of registry.tsx (under 500 lines), each kind documented.
- raea-runtime-segments in tools/layers.toml; vendor/bevy_solari's compaction-queue fix marked raea:.
- sdk/cloud: a farm job's GPU kind is `card` (a prop names what it picks, not the processor); the farm's query is
  unchanged.
- Copies folded: io-media's backend() is backend_unsigned wrapped by the signer; paint's cut colours read by one
  closure; foliage's one smoothstep, a triangle's bounds in one pass, a cell's pixels as one range; segments' video
  track found once in its tests and its shortest segment set where it's used; the Solari switch through
  raea_io_home::env_on; kimodo's package record a path like its others; a few one-liners written directly.
  tools/dupes.max names the six left, which match by shape only (trait forwards, foliage's own FNV and stream).
2026-11-17 19:52:34 -08:00

38 lines
1.8 KiB
Rust

//! A render's video as shot segments (docs/rerender.feature RR3): split at every cut the timeline knows (split.rs), each
//! segment its own encoder run starting on a keyframe (encode.rs), joined into one MP4 by stream copy with the sound
//! laid under once (join.rs). So a changed shot can be drawn again alone and the film joined around it (RR4), and
//! segments drawn by several workers at once (RR5).
use std::path::Path;
use raea_io_media::{EncodeOpts, R, VideoEncoder};
mod encode;
mod join;
mod split;
pub use join::join;
pub use split::{Cuts, segments};
/// The backends whose encoders write segments the join reads (muxide's MP4s: H.264, HEVC, AV1) and lay a sound under
/// a joined video (Backend::sound). The ffmpeg CLI, the baseline, encodes in one run.
pub fn segmentable(codec: &str) -> bool {
matches!(codec, "apple" | "soft" | "av1")
}
/// Whether renders make their videos as segments: with RAEA_SEGMENTS=1, until RR3's gates are measured
pub fn on() -> bool {
std::env::var("RAEA_SEGMENTS").as_deref() == Ok("1")
}
/// The encoder for a whole video (frame 0 first, every frame in order) to `out`: `codec`'s, a new segment at each of
/// `cuts` once the one before holds a second of frames, the whole wrapped by the signer when one is installed (one export, one
/// watermark id, the joined file signed). The ffmpeg baseline's, or with segments off: one run, as before.
pub fn encoder(codec: &str, out: &Path, opts: &EncodeOpts, ten: bool, cuts: &Cuts) -> R<Box<dyn VideoEncoder>> {
let b = if segmentable(codec) && on() {
raea_io_media::sign::wrap(Box::new(encode::Segs { name: codec.into(), cuts: cuts.clone(), min: (opts.fps.round() as usize).max(1) }))
} else {
raea_io_media::backend(codec)?
};
if ten { b.encoder_10bit(out, opts) } else { b.encoder(out, opts) }
}