# kde/kdenlive architecture

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

- Interactive diagram: https://gitdiagram.com/kde/kdenlive
- Repository: https://github.com/kde/kdenlive

## Overview

##### Project type and purpose
- Kdenlive is a native desktop video-editing application (C++/Qt/KDE6)
- It integrates with the MLT video-editing framework, plus frei0r, LADSPA, Python speech/SAM services

##### File structure
- Top-level “src” folder is subdivided into UI, controllers, core, jobs, render, capture, effects, monitors, timelines, pythoninterfaces
- “renderer” implements a separate render server process
- “deps” and “packaging” handle build and deployment (Flatpak, Snap)
- “tests” and “fuzzer” provide unit and fuzz testing

##### Main components
A. UI Layer
– Qt Widgets (src/uiresources, src/dialogs, src/widgets)
– QML modules (src/qml, src/monitor/view, src/timeline2/view/qml)
B. Application Core
– Controllers & Models (src/bin, src/project, src/assets, src/effects, src/transitions, src/profile, src/library)
– Job Manager (src/jobs + taskmanager)
– Timeline engine (src/timeline2/model & view)
C. Rendering Subsystem
– Renderserver (src/render/renderserver.cpp), RenderRequest/Job (renderer/)
– MLT connection (src/mltconnection.cpp, src/mltcontroller/)
– External libraries: MLT core, frei0r, LADSPA
D. Capture Subsystem
– MediaCapture (src/capture), v4l, MLT device capture
E. Monitor Subsystem
– Video/Audio scopes (src/monitor + src/scopes), OpenGL/Metal/D3D widgets
F. Python & Online Services
– Python interfaces (src/pythoninterfaces) for Whisper, Vosk, SAM
– Online resource providers (src/onlineresources)
G. Static Data & Configuration
– Build scripts & packaging (CMakeLists.txt, packaging/)

##### Relationships and data flow
- UI Layer → Core Controllers (user actions trigger controller APIs)
- Core → Job Manager → Render Subsystem (tasks queued, processed)
- Render Subsystem ↔ MLT Library (via mltconnection)
- Core ↔ Assets Repository (loading effect XML, LUTs)
- Timeline Engine ↔ Core (model builds timeline composition)
- Subsystem → Core (incoming video frames)
- Monitor Subsystem ← Core Frames (preview)
- Python Services → Core (speech-to-text, SAM masks)
- Online Providers → Core (download assets)
- File I/O: Core reads/writes .kdenlive project files, proxies, exports

##### Architectural patterns and principles
- MVC/MVVM: UI (View) ↔ Controller ↔ Model
- Producer/Consumer: Job Manager queues tasks consumed by RenderServer
- Plugin-style repositories: EffectsRepository, TransitionsRepository, AssetRepository load XML definitions at runtime
- Layered separation: UI, core, external systems

##### Detail level
- Repositories (Effects, Transitions, Profiles) feeding into controllers

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% UI Layer
    subgraph "UI Layer"
        direction TB
        UI_Dialogs["Qt Widget Dialogs"]:::ui
        UI_Widgets["Custom Qt Widgets"]:::ui
        UI_UIFiles["UI Files & Resources"]:::ui
        UI_QML["QML UI Components"]:::ui
        UI_MonitorQML["Monitor QML Views"]:::ui
        UI_TimelineQML["Timeline QML Views"]:::ui
    end

    %% Application Core
    subgraph "Application Core"
        direction TB
        Core_Bin["Controllers & Models"]:::core
        Core_Project["Project Management"]:::core
        Core_Assets["Assets Repository"]:::core
        Core_Effects["Effects Repository"]:::core
        Core_Transitions["Transitions Repository"]:::core
        Core_Profiles["Profile Repository"]:::core
        Core_Library["Media Library"]:::core
        Core_Jobs["Job Manager"]:::core
    end

    %% Timeline Engine
    subgraph "Timeline Engine"
        direction TB
        Timeline_Model["Timeline Models"]:::core
        Timeline_View["Timeline View & Controllers"]:::core
    end

    %% Rendering Subsystem
    subgraph "Rendering Subsystem"
        direction TB
        RS_Server["RenderServer Process"]:::render
        RS_Request["RenderRequest API"]:::render
        RS_Renderer["RenderJob (renderer/)"]:::render
        RS_MLTConn["MLT Connection"]:::render
        RS_MLTController["MLT Controllers"]:::render
        MLT_Lib(("MLT Library")):::external
        Ext_Frei0r(("frei0r")):::external
        Ext_LADSPA(("LADSPA")):::external
    end

    %% Capture Subsystem
    subgraph "Capture Subsystem"
        direction TB
        Capture["MediaCapture & v4l"]:::capture
    end

    %% Monitor Subsystem
    subgraph "Monitor Subsystem"
        direction TB
        Monitor_Manager["Monitor Manager"]:::monitor
        Monitor_Scopes["Monitor Scopes"]:::monitor
        Scope_Widgets["Scope Widgets"]:::monitor
    end

    %% Python & Online Services
    subgraph "Python & Online Services"
        direction TB
        Python_IFace["Python Interfaces"]:::python
        Online_Resources["Online Resource Providers"]:::python
        Script_Whisper["Whisper Scripts"]:::python
        Script_Vosk["Vosk Scripts"]:::python
        Script_AutoMask["SAM Automask Scripts"]:::python
    end

    %% Static Data & Configuration
    subgraph "Static Data & Configuration"
        direction TB
        Data_Assets["Data Assets (XML, LUTs)"]:::data
        Build_Scripts["CMakeLists.txt"]:::data
        Packaging["Packaging Scripts"]:::data
        Deps["Dependencies Modules"]:::data
    end

    %% Relationships
    UI_Dialogs -->|uses| Core_Bin
    UI_Widgets -->|uses| Core_Bin
    UI_UIFiles -->|triggers| Core_Bin
    UI_QML -->|binds_to| Core_Bin
    UI_MonitorQML -->|views| Monitor_Manager
    UI_TimelineQML -->|views| Timeline_View

    Core_Bin -->|manages| Core_Assets
    Core_Bin -->|manages| Core_Effects
    Core_Bin -->|manages| Core_Transitions
    Core_Bin -->|manages| Core_Profiles
    Core_Bin -->|uses| Core_Library

    Core_Bin -->|queues_tasks| Core_Jobs
    Core_Jobs -->|dispatches| RS_Server
    RS_Server -->|executes| RS_Request
    RS_Request -->|spawns| RS_Renderer

    RS_Server -->|links| MLT_Lib
    RS_MLTConn -->|connects| MLT_Lib
    RS_MLTController -->|controls| MLT_Lib
    MLT_Lib -->|provides| Ext_Frei0r
    MLT_Lib -->|provides| Ext_LADSPA

    Core_Bin -->|loads| Data_Assets
    RS_Server -->|reads| Data_Assets

    Capture -->|feeds_frames| Core_Bin
    Core_Bin -->|sends_preview| Monitor_Manager
    Monitor_Manager -->|renders| Scope_Widgets
    Monitor_Scopes -->|generates| Scope_Widgets

    Python_IFace -->|services| Core_Bin
    Online_Resources -->|downloads| Core_Bin
    Script_Whisper -->|integrates| Python_IFace
    Script_Vosk -->|integrates| Python_IFace
    Script_AutoMask -->|integrates| Python_IFace

    Core_Bin -->|reads| Build_Scripts
    Core_Bin -->|uses| Packaging
    Core_Bin -->|includes| Deps

    Timeline_Model -->|composes| Core_Bin
    Timeline_View -->|controls| Timeline_Model

    %% Click Events
    click UI_Dialogs "https://github.com/kde/kdenlive/tree/master/src/dialogs/"
    click UI_Widgets "https://github.com/kde/kdenlive/tree/master/src/widgets/"
    click UI_UIFiles "https://github.com/kde/kdenlive/tree/master/src/ui/"
    click UI_QML "https://github.com/kde/kdenlive/tree/master/src/qml/"
    click UI_MonitorQML "https://github.com/kde/kdenlive/tree/master/src/monitor/view/"
    click UI_TimelineQML "https://github.com/kde/kdenlive/tree/master/src/timeline2/view/qml/"

    click Core_Bin "https://github.com/kde/kdenlive/tree/master/src/bin/"
    click Core_Project "https://github.com/kde/kdenlive/tree/master/src/project/"
    click Core_Assets "https://github.com/kde/kdenlive/tree/master/src/assets/"
    click Core_Effects "https://github.com/kde/kdenlive/tree/master/src/effects/"
    click Core_Transitions "https://github.com/kde/kdenlive/tree/master/src/transitions/"
    click Core_Profiles "https://github.com/kde/kdenlive/tree/master/src/profiles/"
    click Core_Library "https://github.com/kde/kdenlive/tree/master/src/library/"
    click Core_Jobs "https://github.com/kde/kdenlive/tree/master/src/jobs/"

    click Timeline_Model "https://github.com/kde/kdenlive/tree/master/src/timeline2/model/"
    click Timeline_View "https://github.com/kde/kdenlive/tree/master/src/timeline2/view/"

    click RS_Server "https://github.com/kde/kdenlive/blob/master/src/render/renderserver.cpp"
    click RS_Request "https://github.com/kde/kdenlive/blob/master/src/render/renderrequest.cpp"
    click RS_Renderer "https://github.com/kde/kdenlive/tree/master/renderer/"
    click RS_MLTConn "https://github.com/kde/kdenlive/blob/master/src/mltconnection.cpp"
    click RS_MLTController "https://github.com/kde/kdenlive/tree/master/src/mltcontroller/"

    click Capture "https://github.com/kde/kdenlive/tree/master/src/capture/"

    click Monitor_Manager "https://github.com/kde/kdenlive/tree/master/src/monitor/"
    click Monitor_Scopes "https://github.com/kde/kdenlive/tree/master/src/monitor/scopes/"
    click Scope_Widgets "https://github.com/kde/kdenlive/tree/master/src/scopes/"

    click Python_IFace "https://github.com/kde/kdenlive/tree/master/src/pythoninterfaces/"
    click Online_Resources "https://github.com/kde/kdenlive/tree/master/src/onlineresources/"
    click Script_Whisper "https://github.com/kde/kdenlive/tree/master/data/scripts/whisper/"
    click Script_Vosk "https://github.com/kde/kdenlive/tree/master/data/scripts/vosk/"
    click Script_AutoMask "https://github.com/kde/kdenlive/tree/master/data/scripts/automask/"

    click Data_Assets "https://github.com/kde/kdenlive/tree/master/data/"
    click Build_Scripts "https://github.com/kde/kdenlive/blob/master/CMakeLists.txt"
    click Packaging "https://github.com/kde/kdenlive/tree/master/packaging/"
    click Deps "https://github.com/kde/kdenlive/tree/master/deps/"

    %% Styles
    classDef ui fill:#add8e6,stroke:#000,stroke-width:1px
    classDef core fill:#98fb98,stroke:#000,stroke-width:1px
    classDef render fill:#ffa500,stroke:#000,stroke-width:1px
    classDef capture fill:#dda0dd,stroke:#000,stroke-width:1px
    classDef monitor fill:#ffc0cb,stroke:#000,stroke-width:1px
    classDef python fill:#ffff99,stroke:#000,stroke-width:1px
    classDef data fill:#d3d3d3,stroke:#000,stroke-width:1px
    classDef external fill:#f0f0f0,stroke:#000,stroke-width:1px,stroke-dasharray: 5 5
```
