# saard00/ai-youtube-shorts-generator architecture

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

- Interactive diagram: https://gitdiagram.com/saard00/ai-youtube-shorts-generator
- Repository: https://github.com/saard00/ai-youtube-shorts-generator

## Overview

AutoShorts AI turns a topic into a narrated, edited vertical short. The main workflow is orchestrated by main.py: generate a topic and scene script, add timed voice clips, fetch paired stock footage, render scenes (optionally injecting the avatar), and stitch the final video. The README also describes silence removal and transition-based editing; the sampled composer implements scene transitions and avatar injection, but the active audio module does not show silence trimming. Graph links are limited to calls shown in excerpts or capabilities documented in the README.

Main entry points: [`main.py`](https://github.com/saard00/ai-youtube-shorts-generator/blob/Main/main.py) (Pipeline runner), [`modules/composer.py`](https://github.com/saard00/ai-youtube-shorts-generator/blob/Main/modules/composer.py) (Scene rendering), [`modules/audio.py`](https://github.com/saard00/ai-youtube-shorts-generator/blob/Main/modules/audio.py) (Voice generation), [`modules/asset_manager.py`](https://github.com/saard00/ai-youtube-shorts-generator/blob/Main/modules/asset_manager.py) (Stock video sourcing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_content["Content generation"]
  node_orchestrator["Pipeline runner<br/>[main.py]"]
  node_topic["Topic selection<br/>[brain.py]"]
  node_script["Scene scripting<br/>[brain.py]"]
  node_audio["Voice generation<br/>[audio.py]"]
  node_alternate_audio["Legacy Bark audio<br/>[notneededaudio.py]"]
end

subgraph group_media["Media sourcing"]
  node_assets["Stock video sourcing<br/>[asset_manager.py]"]
  node_avatar["Avatar footage<br/>[avatars.mp4]"]
end

subgraph group_production["Video production"]
  node_scene["Scene rendering<br/>[composer.py]"]
  node_transitions["Transition stitching<br/>[composer.py]"]
end

subgraph group_outputs["Assets and output"]
  node_audio_store[("Audio clips")]
  node_video_store[("Video clips")]
  node_temp_store[("Rendered scenes")]
  node_final_video[("Final short")]
end

node_user(("Topic user"))
node_gemini{{"Google Gemini"}}
node_edge{{"edge-tts"}}
node_pexels{{"Pexels API"}}

node_user -->|"provides topic"| node_orchestrator
node_orchestrator -->|"requests topic"| node_topic
node_orchestrator -->|"requests script"| node_script
node_topic -->|"generates with"| node_gemini
node_script -->|"generates with"| node_gemini
node_orchestrator -->|"processes script"| node_audio
node_audio -->|"generates speech"| node_edge
node_audio -->|"writes clips"| node_audio_store
node_orchestrator -->|"gets footage"| node_assets
node_assets -->|"searches and downloads"| node_pexels
node_assets -->|"writes clips"| node_video_store
node_orchestrator -->|"renders scenes"| node_scene
node_scene -->|"reads narration"| node_audio_store
node_scene -->|"reads footage"| node_video_store
node_scene -->|"injects optionally"| node_avatar
node_scene -->|"writes scenes"| node_temp_store
node_orchestrator -->|"stitches scenes"| node_transitions
node_transitions -->|"reads scenes"| node_temp_store
node_transitions -->|"writes final video"| node_final_video
node_alternate_audio -->|"writes clips"| node_audio_store

click node_orchestrator "https://github.com/saard00/ai-youtube-shorts-generator/blob/Main/main.py"
click node_topic "https://github.com/saard00/ai-youtube-shorts-generator/blob/Main/modules/brain.py"
click node_script "https://github.com/saard00/ai-youtube-shorts-generator/blob/Main/modules/brain.py"
click node_audio "https://github.com/saard00/ai-youtube-shorts-generator/blob/Main/modules/audio.py"
click node_assets "https://github.com/saard00/ai-youtube-shorts-generator/blob/Main/modules/asset_manager.py"
click node_scene "https://github.com/saard00/ai-youtube-shorts-generator/blob/Main/modules/composer.py"
click node_avatar "https://github.com/saard00/ai-youtube-shorts-generator/blob/Main/assets/avatar/avatars.mp4"
click node_transitions "https://github.com/saard00/ai-youtube-shorts-generator/blob/Main/modules/composer.py"
click node_alternate_audio "https://github.com/saard00/ai-youtube-shorts-generator/blob/Main/modules/notneededaudio.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_orchestrator,node_topic,node_script,node_audio,node_alternate_audio,node_user toneBlue
class node_assets,node_avatar toneAmber
class node_scene,node_transitions,node_pexels toneMint
class node_audio_store,node_video_store,node_temp_store,node_final_video toneRose
class node_gemini,node_edge toneIndigo
```

## Components

### Content generation

- [Pipeline runner](https://github.com/saard00/ai-youtube-shorts-generator/blob/Main/main.py): `main.py`
- [Topic selection](https://github.com/saard00/ai-youtube-shorts-generator/blob/Main/modules/brain.py): `modules/brain.py`
- [Scene scripting](https://github.com/saard00/ai-youtube-shorts-generator/blob/Main/modules/brain.py): `modules/brain.py`
- [Voice generation](https://github.com/saard00/ai-youtube-shorts-generator/blob/Main/modules/audio.py): `modules/audio.py`
- [Legacy Bark audio](https://github.com/saard00/ai-youtube-shorts-generator/blob/Main/modules/notneededaudio.py): `modules/notneededaudio.py`

### Media sourcing

- [Stock video sourcing](https://github.com/saard00/ai-youtube-shorts-generator/blob/Main/modules/asset_manager.py): `modules/asset_manager.py`
- [Avatar footage](https://github.com/saard00/ai-youtube-shorts-generator/blob/Main/assets/avatar/avatars.mp4): `assets/avatar/avatars.mp4`

### Video production

- [Scene rendering](https://github.com/saard00/ai-youtube-shorts-generator/blob/Main/modules/composer.py): `modules/composer.py`
- [Transition stitching](https://github.com/saard00/ai-youtube-shorts-generator/blob/Main/modules/composer.py): `modules/composer.py`

### Assets and output

- **Audio clips**
- **Video clips**
- **Rendered scenes**
- **Final short**

### Other components

- **Topic user**
- **Google Gemini**
- **edge-tts**
- **Pexels API**

## Connections

- Topic user → Pipeline runner: provides topic (evidence: `README.md`)
- Pipeline runner → Topic selection: requests topic (evidence: `main.py`)
- Pipeline runner → Scene scripting: requests script (evidence: `main.py`)
- Topic selection → Google Gemini: generates with (evidence: `README.md`)
- Scene scripting → Google Gemini: generates with (evidence: `README.md`)
- Pipeline runner → Voice generation: processes script (evidence: `main.py`)
- Voice generation → edge-tts: generates speech (evidence: `README.md`)
- Voice generation → Audio clips: writes clips (evidence: `modules/audio.py`)
- Pipeline runner → Stock video sourcing: gets footage (evidence: `main.py`)
- Stock video sourcing → Pexels API: searches and downloads (evidence: `README.md`)
- Stock video sourcing → Video clips: writes clips (evidence: `modules/asset_manager.py`)
- Pipeline runner → Scene rendering: renders scenes (evidence: `main.py`)
- Scene rendering → Audio clips: reads narration (evidence: `README.md`)
- Scene rendering → Video clips: reads footage (evidence: `README.md`)
- Scene rendering → Avatar footage: injects optionally (evidence: `README.md`)
- Scene rendering → Rendered scenes: writes scenes (evidence: `modules/composer.py`)
- Pipeline runner → Transition stitching: stitches scenes (evidence: `main.py`)
- Transition stitching → Rendered scenes: reads scenes (evidence: `README.md`)
- Transition stitching → Final short: writes final video (evidence: `modules/composer.py`)
- Legacy Bark audio → Audio clips: writes clips (evidence: `modules/notneededaudio.py`)
