# dimitris02/subtitler architecture

> Architecture diagram of the GitHub repository dimitris02/subtitler, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-02-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dimitris02/subtitler
- Repository: https://github.com/dimitris02/subtitler

## Overview

##### Main Components

a. Input/Output Layer
- Video Input Component
- Subtitled Video Output Component

b. Processing Components
- Audio Extraction Module
- Speech Recognition Module (Google Speech Recognition)
- Translation Module (DeepL Scraper)
- Subtitle Generation Module

c. External Services
- Google Speech Recognition API
- DeepL.com (via Selenium WebDriver)

##### Processing pipeline with distinct components
- Audio Extraction (using moviepy/pydub)
- Speech Recognition (using speech_recognition)
- Translation (using selenium/deepl_scraper)
- Subtitle Integration

##### Technical Details

- Key Python libraries: speech_recognition, selenium, moviepy, pydub
- Language configuration options (LANG, TRANSLATE_TO)
- Configurable parameters (SILENCE, THRESH)

##### Important Notes

- A note about geckodriver.exe being required for Selenium
- Configuration parameters that can be adjusted
- Supported input/output formats

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Legend
        style Legend fill:#f5f5f5,stroke:#333
        L1[Processing Module]:::process
        L2[(External Service)]:::external
        L3[/Input/Output/]:::io
        L4[Support Component]:::support
    end

    subgraph "Input Layer"
        VideoInput[/Video Input File/]:::io
    end

    subgraph "Processing Pipeline"
        AudioExtraction[Audio Extraction]:::process
        SpeechRecognition[Speech Recognition]:::process
        Translation[Translation Module]:::process
        SubtitleGen[Subtitle Generation]:::process
        click Translation "https://github.com/Dimitris02/subtitler/blob/main/deepl_scraper.py"
    end

    subgraph "External Services"
        GoogleAPI[(Google Speech Recognition API)]:::external
        DeepL[(DeepL.com)]:::external
    end

    subgraph "Support Components"
        GeckoDriver[Selenium WebDriver]:::support
        click GeckoDriver "https://github.com/Dimitris02/subtitler/blob/main/geckodriver.exe"
        Config[Configuration Parameters]:::support
        click Config "https://github.com/Dimitris02/subtitler/blob/main/requirements.txt"
    end

    subgraph "Output Layer"
        FinalOutput[/Subtitled Video Output/]:::io
    end

    %% Connections
    VideoInput --> AudioExtraction
    AudioExtraction --> SpeechRecognition
    SpeechRecognition --> Translation
    Translation --> SubtitleGen
    SubtitleGen --> FinalOutput

    %% External Service Connections
    SpeechRecognition -.-> GoogleAPI
    Translation -.-> DeepL
    Translation -.-> GeckoDriver
    Config -.-> |Configures| Translation

    %% Styling
    classDef process fill:#90EE90,stroke:#333
    classDef external fill:#FFE4B5,stroke:#333
    classDef io fill:#87CEEB,stroke:#333
    classDef support fill:#D3D3D3,stroke:#333

    %% Notes
    note[Note: Requires Python 3.9+<br/>Configurable language settings]
    style note fill:#fff,stroke:#333
```
