Skip to main content

Crate ffcine_text

Crate ffcine_text 

Source
Expand description

ffcine.text generator clips (place cards, time cards, subtitles, titles) rendered as GPU overlays, only over their own time ranges: see docs/text.md.

TextLayer collects a timeline’s text clips with their resolved styles (metadata.ffcine.project.styles); TextLayer::overlays lays out the ones overlapping a segment with cosmic-text and returns Overlays that the render pipeline composites in its libplacebo pass (ffcine_render::Pipeline::overlays). Segment renderers split at TextLayer::cuts and key their cache on TextLayer::fingerprint, so a card edit re-renders only the seconds it covers. ass imports .ass subtitles as text clips; anim animates text (slide, pop, typewriter, wipe, keyframes) and title expands ffcine.title clips (title sequences, end screens) into text pieces.

use ffcine_render::{Pipeline, Size};
use ffcine_text::TextLayer;
use ffcine_timeline::Timeline;

let t = Timeline::from_file("edit.otio")?;
let mut text = TextLayer::from_timeline(&t, ".")?;
// A segment of 96 frames starting 12.5 s into the timeline, rendered at 4K.
let size = Size { width: 3840, height: 2160 };
let overlays = text.overlays(12.5, 96, 24000.0 / 1001.0, size)?;
let p = Pipeline::new("shot.mov", "seg.mkv").overlays(overlays);

Re-exports§

pub use anim::Animation;
pub use layout::Layer;
pub use layout::Rendered;
pub use layout::Role;
pub use layout::Typesetter;
pub use style::Align;
pub use style::TextStyle;

Modules§

anim
Text animations (animation.in / animation.out: fade, slide, pop, typewriter, wipe, by word, line or character with a stagger) and keyframed parameters (keyframes.position, scale, opacity, colour), baked into per-frame overlay placements (Motion).
ass
.ass / .ssa subtitles -> ffcine.text clips, so existing subtitle files render through the same GPU text path as cards.
layout
Laying out and rasterising text with cosmic-text: one coverage mask per text, plus derived masks for the shadow (blurred) and outline (dilated), as Layers ready to be overlays.
style
Resolving an ffcine.text clip’s look: project.styles.base <- its style (and that style’s based_on chain) <- the clip’s own parameters, then read into a TextStyle.
title
ffcine.title generator clips: a designed title sequence or end screen (title words staggering in, a rule drawing out from the middle, subtitle and credit lines after them, an optional backdrop), expanded into ffcine.text pieces that render like any text clip.

Structs§

TextClip
One ffcine.text clip on the timeline.
TextLayer
A timeline’s text clips, ready to render per segment.

Constants§

GENERATOR
generator_kind of text clips.