# rishijawale/youtube-shorts-clipper architecture

> Architecture diagram of the GitHub repository rishijawale/youtube-shorts-clipper, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rishijawale/youtube-shorts-clipper
- Repository: https://github.com/rishijawale/youtube-shorts-clipper

## Overview

YouTube Shorts Highlight Clipper is a local CLI that turns a YouTube URL into one or more vertical highlight videos. Its main workflow retrieves video metadata and replay heatmap data, selects highlight timestamps (with manual time overrides), downloads segments, optionally prepares captions, then formats and exports clips. Captioning supports YouTube subtitles and local Whisper transcription; framing supports blur, crop, and fit, with hardware-accelerated encoding when available. The source excerpt is partial, so detailed internal call relationships are shown only where the README documents the workflow.

Main entry points: [`scripts/clipper.py`](https://github.com/rishijawale/youtube-shorts-clipper/blob/main/scripts/clipper.py) (CLI orchestration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Clip workflow"]
  node_clipper["CLI orchestration<br/>[clipper.py]"]
  node_metadata["Video metadata<br/>[clipper.py]"]
  node_heatmap["Replay heatmap<br/>[clipper.py]"]
  node_peaks["Peak detection<br/>[clipper.py]"]
  node_audio["Audio fallback<br/>[clipper.py]"]
  node_segments["Segment download<br/>[clipper.py]"]
end

subgraph group_captions["Captioning"]
  node_subtitle_fetch["Subtitle retrieval<br/>[clipper.py]"]
  node_vtt["VTT parsing and chunking<br/>[clipper.py]"]
  node_whisper["Whisper transcription<br/>[clipper.py]"]
  node_ass["ASS caption generation<br/>[clipper.py]"]
end

subgraph group_rendering["Video rendering"]
  node_framing["Vertical framing<br/>[clipper.py]"]
  node_encoding["Video encoding<br/>[clipper.py]"]
  node_output["Exported MP4<br/>[clipper.py]"]
end

node_user(("CLI user"))
node_youtube["YouTube / yt-dlp"]
node_ffmpeg["FFmpeg"]

node_user -->|"provides URL and options"| node_clipper
node_clipper -->|"requests metadata"| node_metadata
node_metadata -->|"retrieves data"| node_youtube
node_metadata -->|"provides heatmap"| node_heatmap
node_clipper -->|"selects highlights"| node_peaks
node_heatmap -->|"supplies replay data"| node_peaks
node_clipper -.->|"uses fallback"| node_audio
node_clipper -->|"downloads segments"| node_segments
node_segments -->|"fetches video"| node_youtube
node_clipper -->|"fetches subtitles"| node_subtitle_fetch
node_subtitle_fetch -->|"retrieves VTT"| node_youtube
node_subtitle_fetch -->|"provides subtitle cues"| node_vtt
node_vtt -->|"writes captions"| node_ass
node_clipper -->|"transcribes when needed"| node_whisper
node_whisper -->|"writes captions"| node_ass
node_clipper -->|"selects framing mode"| node_framing
node_segments -->|"provides video segment"| node_framing
node_framing -->|"sends filtered video"| node_encoding
node_ass -->|"burns in captions"| node_encoding
node_encoding -->|"encodes video"| node_ffmpeg
node_encoding -->|"exports clip"| node_output

click node_clipper "https://github.com/rishijawale/youtube-shorts-clipper/blob/main/scripts/clipper.py"
click node_metadata "https://github.com/rishijawale/youtube-shorts-clipper/blob/main/scripts/clipper.py"
click node_heatmap "https://github.com/rishijawale/youtube-shorts-clipper/blob/main/scripts/clipper.py"
click node_peaks "https://github.com/rishijawale/youtube-shorts-clipper/blob/main/scripts/clipper.py"
click node_audio "https://github.com/rishijawale/youtube-shorts-clipper/blob/main/scripts/clipper.py"
click node_segments "https://github.com/rishijawale/youtube-shorts-clipper/blob/main/scripts/clipper.py"
click node_subtitle_fetch "https://github.com/rishijawale/youtube-shorts-clipper/blob/main/scripts/clipper.py"
click node_vtt "https://github.com/rishijawale/youtube-shorts-clipper/blob/main/scripts/clipper.py"
click node_whisper "https://github.com/rishijawale/youtube-shorts-clipper/blob/main/scripts/clipper.py"
click node_ass "https://github.com/rishijawale/youtube-shorts-clipper/blob/main/scripts/clipper.py"
click node_framing "https://github.com/rishijawale/youtube-shorts-clipper/blob/main/scripts/clipper.py"
click node_encoding "https://github.com/rishijawale/youtube-shorts-clipper/blob/main/scripts/clipper.py"
click node_output "https://github.com/rishijawale/youtube-shorts-clipper/blob/main/scripts/clipper.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_clipper,node_metadata,node_heatmap,node_peaks,node_audio,node_segments,node_user toneBlue
class node_subtitle_fetch,node_vtt,node_whisper,node_ass toneAmber
class node_framing,node_encoding,node_output toneMint
class node_youtube,node_ffmpeg toneIndigo
```

## Components

### Clip workflow

- [CLI orchestration](https://github.com/rishijawale/youtube-shorts-clipper/blob/main/scripts/clipper.py): `scripts/clipper.py`
- [Video metadata](https://github.com/rishijawale/youtube-shorts-clipper/blob/main/scripts/clipper.py): `scripts/clipper.py`
- [Replay heatmap](https://github.com/rishijawale/youtube-shorts-clipper/blob/main/scripts/clipper.py): `scripts/clipper.py`
- [Peak detection](https://github.com/rishijawale/youtube-shorts-clipper/blob/main/scripts/clipper.py): `scripts/clipper.py`
- [Audio fallback](https://github.com/rishijawale/youtube-shorts-clipper/blob/main/scripts/clipper.py): `scripts/clipper.py`
- [Segment download](https://github.com/rishijawale/youtube-shorts-clipper/blob/main/scripts/clipper.py): `scripts/clipper.py`

### Captioning

- [Subtitle retrieval](https://github.com/rishijawale/youtube-shorts-clipper/blob/main/scripts/clipper.py): `scripts/clipper.py`
- [VTT parsing and chunking](https://github.com/rishijawale/youtube-shorts-clipper/blob/main/scripts/clipper.py): `scripts/clipper.py`
- [Whisper transcription](https://github.com/rishijawale/youtube-shorts-clipper/blob/main/scripts/clipper.py): `scripts/clipper.py`
- [ASS caption generation](https://github.com/rishijawale/youtube-shorts-clipper/blob/main/scripts/clipper.py): `scripts/clipper.py`

### Video rendering

- [Vertical framing](https://github.com/rishijawale/youtube-shorts-clipper/blob/main/scripts/clipper.py): `scripts/clipper.py`
- [Video encoding](https://github.com/rishijawale/youtube-shorts-clipper/blob/main/scripts/clipper.py): `scripts/clipper.py`
- [Exported MP4](https://github.com/rishijawale/youtube-shorts-clipper/blob/main/scripts/clipper.py): `scripts/clipper.py`

### Other components

- **CLI user**
- **YouTube / yt-dlp**
- **FFmpeg**

## Connections

- CLI user → CLI orchestration: provides URL and options (evidence: `README.md`)
- CLI orchestration → Video metadata: requests metadata (evidence: `README.md`)
- Video metadata → YouTube / yt-dlp: retrieves data (evidence: `README.md`)
- Video metadata → Replay heatmap: provides heatmap (evidence: `README.md`)
- CLI orchestration → Peak detection: selects highlights (evidence: `README.md`)
- Replay heatmap → Peak detection: supplies replay data (evidence: `README.md`)
- CLI orchestration → Audio fallback: uses fallback (evidence: `scripts/clipper.py`)
- CLI orchestration → Segment download: downloads segments (evidence: `README.md`)
- Segment download → YouTube / yt-dlp: fetches video (evidence: `README.md`)
- CLI orchestration → Subtitle retrieval: fetches subtitles (evidence: `README.md`)
- Subtitle retrieval → YouTube / yt-dlp: retrieves VTT (evidence: `README.md`)
- Subtitle retrieval → VTT parsing and chunking: provides subtitle cues (evidence: `README.md`)
- VTT parsing and chunking → ASS caption generation: writes captions (evidence: `README.md`)
- CLI orchestration → Whisper transcription: transcribes when needed (evidence: `README.md`)
- Whisper transcription → ASS caption generation: writes captions (evidence: `README.md`)
- CLI orchestration → Vertical framing: selects framing mode (evidence: `README.md`)
- Segment download → Vertical framing: provides video segment (evidence: `README.md`)
- Vertical framing → Video encoding: sends filtered video (evidence: `README.md`)
- ASS caption generation → Video encoding: burns in captions (evidence: `README.md`)
- Video encoding → FFmpeg: encodes video (evidence: `README.md`)
- Video encoding → Exported MP4: exports clip (evidence: `README.md`)
