How pipelines are structured, their shared steps, and orchestration patterns.
Source: screencastgen/pipelines/
The three document pipelines share a common extraction-to-synthesis flow, then diverge for their specific output format. The visualization pipeline is prompt-driven and bypasses document extraction/TTS.
flowchart LR
Extract --> Preprocess --> Split --> Chunk --> Validate --> Synthesize
Synthesize --> Audio[Concatenate audio]
Synthesize --> Highlight[Align and render highlights]
Synthesize --> LipSync[Align, animate face, and compose]
Prompt[Prompt] --> Generate[Generate Manim source] --> Render[Render visualization]
These are implemented in Pipeline Common and used by the document pipelines:
| Step | Function | Module |
|---|---|---|
| 1. Extract | extract_and_chunk() |
Extractor |
| 2. Preprocess | (within extract_and_chunk) | Text Processing |
| 3. Split | (within extract_and_chunk) | Text Processing |
| 4. Chunk | (within extract_and_chunk) | Text Processing |
| 5. Validate | validate_and_collect() |
Text Processing |
| 6. Synthesize | synthesize_chunks() |
TTS Registry |
Each pipeline accepts a typed request dataclass and returns a PipelineRunResult:
def run_audio_pipeline(request: AudioPipelineRequest, reporter, backend_factory) -> PipelineRunResult
def run_highlight_pipeline(request: HighlightPipelineRequest, reporter, backend_factory) -> PipelineRunResult
def run_lipsync_pipeline(request: LipsyncPipelineRequest, reporter, backend_factory) -> PipelineRunResult
def run_visualization_pipeline(request: VisualizationPipelineRequest, reporter, renderer) -> PipelineRunResult
See Pipeline Types for the request hierarchy.
All pipelines use PipelineReporter for progress output:
reporter.line(message) — Human-readable console outputreporter.emit(phase, current, total, message) — Structured eventreporter.phase_start(phase, message) — Phase transitionreporter.cancelled() — Host-requested early stop check used by long-running lip-sync workThe web app’s Progress Reporter subscribes to these events.
screencastgen/pipelines/
├── __init__.py (public exports)
├── types.py Pipeline Types
├── events.py Pipeline Events
├── common.py Pipeline Common
├── audio.py Audio Pipeline
├── highlight.py Highlight Pipeline
├── lipsync.py Lipsync Pipeline
└── visualization.py Visualization Pipeline