# shaweesh/generate-subtitle-gui architecture

> Architecture diagram of the GitHub repository shaweesh/generate-subtitle-gui, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shaweesh/generate-subtitle-gui
- Repository: https://github.com/shaweesh/generate-subtitle-gui

## Overview

##### Project type and purpose
- This is a desktop GUI application (built in Python with tkinter) whose primary purpose is to extract audio from video, generate subtitles via the Whisper model, allow user editing of those subtitles, and merge the final subtitles back into the video file.

##### File structure
- Top-level Python scripts:
- app.py – launches the GUI and orchestrates workflow
- main.py – handles “Extract Audio” and “Generate Subtitles” steps
- merge_srt.py – handles “Merge Subtitles” step
- Configuration and assets:
- config.json – stores user settings (e.g., target language)
- assets/ – contains static files (project-overview.png for README)
- Dependencies and packaging:
- requirements.txt – lists Python packages (ffmpeg-python, faster-whisper, tkinter, etc.)
- PyInstaller build command referenced in README

##### README for additional insights
- Workflow described in four phases: Browse → Prepare (extract & transcribe) → Edit SRT → Complete (merge)
- External tools: FFmpeg (via ffmpeg-python), Whisper model (via faster-whisper), PyInstaller for packaging
- Configuration persists user language selection across sessions

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% GUI Layer
    subgraph "GUI Layer"
        GUI["GUI Layer\n(app.py)"]:::gui
        SubtitleEditor["Subtitle Editor\n(in-GUI)\n(app.py)"]:::gui
    end

    %% Processing Layer
    subgraph "Processing Layer"
        AudioExtraction["Audio Extraction Service\n(main.py)"]:::service
        Transcription["Transcription Service\n(main.py)"]:::service
        SubtitleMerger["Subtitle Merger\n(merge_srt.py)"]:::service
    end

    %% File System / Storage
    subgraph "File System / Storage"
        FS_Video["Video File"]:::datastore
        FS_Audio["Audio File (.wav)"]:::datastore
        FS_SRT["Subtitle File (.srt)"]:::datastore
        FS_FinalVideo["Final Video File"]:::datastore
        ConfigStore["Configuration Store\n(config.json)"]:::datastore
    end

    %% Packaging Layer
    subgraph "Packaging Layer"
        Packaging["PyInstaller Build\n(.exe)"]:::external
    end

    %% External Dependencies & Assets
    Assets["Static Assets\n(assets/)"]:::external
    Requirements["Dependencies\n(requirements.txt)"]:::external
    README["README & PyInstaller\n(readme.md)"]:::external

    %% Workflow Connections
    FS_Video -->|"browse video"| GUI
    GUI -->|"extract audio"| AudioExtraction
    AudioExtraction -->|".wav"| FS_Audio
    FS_Audio -->|"transcribe"| Transcription
    Transcription -->|".srt"| FS_SRT
    FS_SRT -->|"load/edit"| SubtitleEditor
    SubtitleEditor -->|"save .srt"| FS_SRT
    FS_SRT -->|"merge with video"| SubtitleMerger
    FS_Video -->|"source video"| SubtitleMerger
    SubtitleMerger -->|"final video"| FS_FinalVideo
    GUI -->|"read/write prefs"| ConfigStore

    %% Packaging Connections
    GUI -->|"bundled scripts"| Packaging
    AudioExtraction -->|"bundled scripts"| Packaging
    Transcription -->|"bundled scripts"| Packaging
    SubtitleMerger -->|"bundled scripts"| Packaging
    ConfigStore -->|"included config"| Packaging
    Assets -->|"included assets"| Packaging
    Requirements -->|"packaging list"| Packaging
    README -->|"build instructions"| Packaging

    %% Click Events
    click GUI "https://github.com/shaweesh/generate-subtitle-gui/blob/master/app.py"
    click SubtitleEditor "https://github.com/shaweesh/generate-subtitle-gui/blob/master/app.py"
    click AudioExtraction "https://github.com/shaweesh/generate-subtitle-gui/blob/master/main.py"
    click Transcription "https://github.com/shaweesh/generate-subtitle-gui/blob/master/main.py"
    click SubtitleMerger "https://github.com/shaweesh/generate-subtitle-gui/blob/master/merge_srt.py"
    click ConfigStore "https://github.com/shaweesh/generate-subtitle-gui/blob/master/config.json"
    click Assets "https://github.com/shaweesh/generate-subtitle-gui/tree/master/assets/"
    click Requirements "https://github.com/shaweesh/generate-subtitle-gui/blob/master/requirements.txt"
    click README "https://github.com/shaweesh/generate-subtitle-gui/blob/master/readme.md"

    %% Styles
    classDef gui fill:#D0E6FF,stroke:#004C99,stroke-width:2px
    classDef service fill:#DFF2BF,stroke:#4F8A10,stroke-width:2px
    classDef datastore fill:#FFF2CC,stroke:#BF9000,stroke-width:2px
    classDef external fill:#FEEFB3,stroke:#B45F06,stroke-width:2px
```
