# goudatharun30/active-speaker-video-reframing architecture

> Architecture diagram of the GitHub repository goudatharun30/active-speaker-video-reframing, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/goudatharun30/active-speaker-video-reframing
- Repository: https://github.com/goudatharun30/active-speaker-video-reframing

## Overview

This is a local active-speaker detection and smart video-reframing application. A user submits an MP4 and chooses an aspect ratio through the web UI or CLI; orchestration analyzes audio and video, selects speakers, plans and validates crops, then renders a reframed MP4 and an auditable decision timeline. The README also describes strategy comparison, previews, downloads, and job progress. Some internal links reflect documented stages because the relevant source excerpts are incomplete; those edges cite the README.

Main entry points: [`app/pipeline/analyzer.py`](https://github.com/goudatharun30/active-speaker-video-reframing/blob/main/app/pipeline/analyzer.py) (Analysis Pass), [`app/pipeline/orchestrator.py`](https://github.com/goudatharun30/active-speaker-video-reframing/blob/main/app/pipeline/orchestrator.py) (Pipeline Orchestrator), [`app/ui/app.js`](https://github.com/goudatharun30/active-speaker-video-reframing/blob/main/app/ui/app.js) (Web Dashboard), [`app/api.py`](https://github.com/goudatharun30/active-speaker-video-reframing/blob/main/app/api.py) (Web API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User Interface"]
  node_webui["Web Dashboard<br/>[app.js]"]
  node_api["Web API<br/>[api.py]"]
  node_cli["Command Line<br/>[cli.py]"]
end

subgraph group_workflow["Job Workflow"]
  node_config["Pipeline Config<br/>[config.py]"]
  node_jobs["Job Progress<br/>[job_manager.py]"]
  node_orchestrator["Pipeline Orchestrator<br/>[orchestrator.py]"]
end

subgraph group_analysis["Multimodal Analysis"]
  node_analyzer["Analysis Pass<br/>[analyzer.py]"]
  node_audio["Audio VAD Timeline<br/>[vad.py]"]
  node_audioextract["Audio Extraction<br/>[extractor.py]"]
  node_video["Video Frames And Metadata<br/>[decoder.py]"]
  node_faces["Face Detection<br/>[face_detector.py]"]
  node_tracking["Face Tracking<br/>[face_tracker.py]"]
  node_mouth["Mouth Motion<br/>[landmarks.py]"]
  node_scoring["Speaker Scoring<br/>[strategies.py]"]
  node_state["Speaker State Machine<br/>[state_machine.py]"]
end

subgraph group_framing["Crop And Render"]
  node_planner["Crop Planning<br/>[planner.py]"]
  node_cropmath["Crop Geometry<br/>[crop.py]"]
  node_smoother["Crop Smoothing<br/>[smoother.py]"]
  node_validator["Crop Safety Validation<br/>[validator.py]"]
  node_renderpass["Render Pass<br/>[renderer.py]"]
  node_ffmpeg["FFmpeg Renderer<br/>[ffmpeg.py]"]
  node_timeline["Decision Timeline<br/>[renderer.py]"]
  node_output["Reframed MP4<br/>[ffmpeg.py]"]
end

subgraph group_evaluation["Evaluation"]
  node_comparison["Strategy Comparison<br/>[comparison.py]"]
end

node_user(("Video User"))

node_user -->|"submits video"| node_webui
node_webui -->|"starts job"| node_api
node_user -->|"runs process"| node_cli
node_api -->|"creates and updates"| node_jobs
node_api -->|"runs pipeline"| node_orchestrator
node_cli -->|"runs pipeline"| node_orchestrator
node_orchestrator -->|"analyzes video"| node_analyzer
node_orchestrator -->|"renders timeline"| node_renderpass
node_orchestrator -->|"uses settings"| node_config
node_analyzer -->|"extracts audio"| node_audioextract
node_analyzer -->|"analyzes speech"| node_audio
node_analyzer -->|"decodes frames"| node_video
node_analyzer -->|"detects faces"| node_faces
node_analyzer -->|"tracks faces"| node_tracking
node_analyzer -->|"measures motion"| node_mouth
node_analyzer -->|"scores candidates"| node_scoring
node_analyzer -->|"selects speaker"| node_state
node_analyzer -->|"plans crops"| node_planner
node_planner -->|"calculates geometry"| node_cropmath
node_analyzer -->|"smooths crops"| node_smoother
node_analyzer -->|"validates crops"| node_validator
node_renderpass -->|"renders video"| node_ffmpeg
node_renderpass -->|"writes timeline"| node_timeline
node_ffmpeg -->|"produces MP4"| node_output
node_webui -->|"inspects timeline"| node_timeline
node_webui -->|"previews and downloads"| node_output
node_comparison -->|"compares strategies"| node_analyzer

click node_webui "https://github.com/goudatharun30/active-speaker-video-reframing/blob/main/app/ui/app.js"
click node_api "https://github.com/goudatharun30/active-speaker-video-reframing/blob/main/app/api.py"
click node_cli "https://github.com/goudatharun30/active-speaker-video-reframing/blob/main/app/cli.py"
click node_config "https://github.com/goudatharun30/active-speaker-video-reframing/blob/main/app/config.py"
click node_jobs "https://github.com/goudatharun30/active-speaker-video-reframing/blob/main/app/pipeline/job_manager.py"
click node_orchestrator "https://github.com/goudatharun30/active-speaker-video-reframing/blob/main/app/pipeline/orchestrator.py"
click node_analyzer "https://github.com/goudatharun30/active-speaker-video-reframing/blob/main/app/pipeline/analyzer.py"
click node_audio "https://github.com/goudatharun30/active-speaker-video-reframing/blob/main/app/audio/vad.py"
click node_audioextract "https://github.com/goudatharun30/active-speaker-video-reframing/blob/main/app/audio/extractor.py"
click node_video "https://github.com/goudatharun30/active-speaker-video-reframing/blob/main/app/video/decoder.py"
click node_faces "https://github.com/goudatharun30/active-speaker-video-reframing/blob/main/app/video/face_detector.py"
click node_tracking "https://github.com/goudatharun30/active-speaker-video-reframing/blob/main/app/video/face_tracker.py"
click node_mouth "https://github.com/goudatharun30/active-speaker-video-reframing/blob/main/app/video/landmarks.py"
click node_scoring "https://github.com/goudatharun30/active-speaker-video-reframing/blob/main/app/speaker/strategies.py"
click node_state "https://github.com/goudatharun30/active-speaker-video-reframing/blob/main/app/speaker/state_machine.py"
click node_planner "https://github.com/goudatharun30/active-speaker-video-reframing/blob/main/app/rendering/planner.py"
click node_cropmath "https://github.com/goudatharun30/active-speaker-video-reframing/blob/main/app/video/crop.py"
click node_smoother "https://github.com/goudatharun30/active-speaker-video-reframing/blob/main/app/rendering/smoother.py"
click node_validator "https://github.com/goudatharun30/active-speaker-video-reframing/blob/main/app/rendering/validator.py"
click node_renderpass "https://github.com/goudatharun30/active-speaker-video-reframing/blob/main/app/pipeline/renderer.py"
click node_ffmpeg "https://github.com/goudatharun30/active-speaker-video-reframing/blob/main/app/rendering/ffmpeg.py"
click node_timeline "https://github.com/goudatharun30/active-speaker-video-reframing/blob/main/app/pipeline/renderer.py"
click node_output "https://github.com/goudatharun30/active-speaker-video-reframing/blob/main/app/rendering/ffmpeg.py"
click node_comparison "https://github.com/goudatharun30/active-speaker-video-reframing/blob/main/app/evaluation/comparison.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_webui,node_api,node_cli,node_user toneBlue
class node_config,node_jobs,node_orchestrator toneAmber
class node_analyzer,node_audio,node_audioextract,node_video,node_faces,node_tracking,node_mouth,node_scoring,node_state toneMint
class node_planner,node_cropmath,node_smoother,node_validator,node_renderpass,node_ffmpeg,node_timeline,node_output toneRose
class node_comparison toneIndigo
```

## Components

### User Interface

- [Web Dashboard](https://github.com/goudatharun30/active-speaker-video-reframing/blob/main/app/ui/app.js): `app/ui/app.js`
- [Web API](https://github.com/goudatharun30/active-speaker-video-reframing/blob/main/app/api.py): `app/api.py`
- [Command Line](https://github.com/goudatharun30/active-speaker-video-reframing/blob/main/app/cli.py): `app/cli.py`

### Job Workflow

- [Pipeline Config](https://github.com/goudatharun30/active-speaker-video-reframing/blob/main/app/config.py): `app/config.py`
- [Job Progress](https://github.com/goudatharun30/active-speaker-video-reframing/blob/main/app/pipeline/job_manager.py): `app/pipeline/job_manager.py`
- [Pipeline Orchestrator](https://github.com/goudatharun30/active-speaker-video-reframing/blob/main/app/pipeline/orchestrator.py): `app/pipeline/orchestrator.py`

### Multimodal Analysis

- [Analysis Pass](https://github.com/goudatharun30/active-speaker-video-reframing/blob/main/app/pipeline/analyzer.py): `app/pipeline/analyzer.py`
- [Audio VAD Timeline](https://github.com/goudatharun30/active-speaker-video-reframing/blob/main/app/audio/vad.py): `app/audio/vad.py`
- [Audio Extraction](https://github.com/goudatharun30/active-speaker-video-reframing/blob/main/app/audio/extractor.py): `app/audio/extractor.py`
- [Video Frames And Metadata](https://github.com/goudatharun30/active-speaker-video-reframing/blob/main/app/video/decoder.py): `app/video/decoder.py`
- [Face Detection](https://github.com/goudatharun30/active-speaker-video-reframing/blob/main/app/video/face_detector.py): `app/video/face_detector.py`
- [Face Tracking](https://github.com/goudatharun30/active-speaker-video-reframing/blob/main/app/video/face_tracker.py): `app/video/face_tracker.py`
- [Mouth Motion](https://github.com/goudatharun30/active-speaker-video-reframing/blob/main/app/video/landmarks.py): `app/video/landmarks.py`
- [Speaker Scoring](https://github.com/goudatharun30/active-speaker-video-reframing/blob/main/app/speaker/strategies.py): `app/speaker/strategies.py`
- [Speaker State Machine](https://github.com/goudatharun30/active-speaker-video-reframing/blob/main/app/speaker/state_machine.py): `app/speaker/state_machine.py`

### Crop And Render

- [Crop Planning](https://github.com/goudatharun30/active-speaker-video-reframing/blob/main/app/rendering/planner.py): `app/rendering/planner.py`
- [Crop Geometry](https://github.com/goudatharun30/active-speaker-video-reframing/blob/main/app/video/crop.py): `app/video/crop.py`
- [Crop Smoothing](https://github.com/goudatharun30/active-speaker-video-reframing/blob/main/app/rendering/smoother.py): `app/rendering/smoother.py`
- [Crop Safety Validation](https://github.com/goudatharun30/active-speaker-video-reframing/blob/main/app/rendering/validator.py): `app/rendering/validator.py`
- [Render Pass](https://github.com/goudatharun30/active-speaker-video-reframing/blob/main/app/pipeline/renderer.py): `app/pipeline/renderer.py`
- [FFmpeg Renderer](https://github.com/goudatharun30/active-speaker-video-reframing/blob/main/app/rendering/ffmpeg.py): `app/rendering/ffmpeg.py`
- [Decision Timeline](https://github.com/goudatharun30/active-speaker-video-reframing/blob/main/app/pipeline/renderer.py): `app/pipeline/renderer.py`
- [Reframed MP4](https://github.com/goudatharun30/active-speaker-video-reframing/blob/main/app/rendering/ffmpeg.py): `app/rendering/ffmpeg.py`

### Evaluation

- [Strategy Comparison](https://github.com/goudatharun30/active-speaker-video-reframing/blob/main/app/evaluation/comparison.py): `app/evaluation/comparison.py`

### Other components

- **Video User**

## Connections

- Video User → Web Dashboard: submits video (evidence: `README.md`)
- Web Dashboard → Web API: starts job (evidence: `README.md`)
- Video User → Command Line: runs process (evidence: `README.md`)
- Web API → Job Progress: creates and updates (evidence: `app/api.py`)
- Web API → Pipeline Orchestrator: runs pipeline (evidence: `app/api.py`)
- Command Line → Pipeline Orchestrator: runs pipeline (evidence: `app/cli.py`)
- Pipeline Orchestrator → Analysis Pass: analyzes video (evidence: `app/pipeline/orchestrator.py`)
- Pipeline Orchestrator → Render Pass: renders timeline (evidence: `app/pipeline/orchestrator.py`)
- Pipeline Orchestrator → Pipeline Config: uses settings (evidence: `app/pipeline/orchestrator.py`)
- Analysis Pass → Audio Extraction: extracts audio (evidence: `app/pipeline/analyzer.py`)
- Analysis Pass → Audio VAD Timeline: analyzes speech (evidence: `README.md`)
- Analysis Pass → Video Frames And Metadata: decodes frames (evidence: `README.md`)
- Analysis Pass → Face Detection: detects faces (evidence: `README.md`)
- Analysis Pass → Face Tracking: tracks faces (evidence: `README.md`)
- Analysis Pass → Mouth Motion: measures motion (evidence: `README.md`)
- Analysis Pass → Speaker Scoring: scores candidates (evidence: `README.md`)
- Analysis Pass → Speaker State Machine: selects speaker (evidence: `README.md`)
- Analysis Pass → Crop Planning: plans crops (evidence: `app/pipeline/analyzer.py`)
- Crop Planning → Crop Geometry: calculates geometry (evidence: `app/rendering/planner.py`)
- Analysis Pass → Crop Smoothing: smooths crops (evidence: `app/pipeline/analyzer.py`)
- Analysis Pass → Crop Safety Validation: validates crops (evidence: `app/pipeline/analyzer.py`)
- Render Pass → FFmpeg Renderer: renders video (evidence: `app/pipeline/renderer.py`)
- Render Pass → Decision Timeline: writes timeline (evidence: `app/pipeline/renderer.py`)
- FFmpeg Renderer → Reframed MP4: produces MP4 (evidence: `app/rendering/ffmpeg.py`)
- Web Dashboard → Decision Timeline: inspects timeline (evidence: `README.md`)
- Web Dashboard → Reframed MP4: previews and downloads (evidence: `README.md`)
- Strategy Comparison → Analysis Pass: compares strategies (evidence: `app/evaluation/comparison.py`)
