# zerochocobo/thru3d-media-server architecture

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

- Interactive diagram: https://gitdiagram.com/zerochocobo/thru3d-media-server
- Repository: https://github.com/zerochocobo/thru3d-media-server

## Overview

Thru3D Media Server is a Windows-first VR DLNA media server with a desktop UI and offline video-generation tools. The main workflow is configuring a local library in the UI, discovering and browsing it from a DLNA player, then serving original media or a realtime passthrough stream. Distinct branches cover subtitles and simultaneous-interpretation sidecars, GPU matting and enhancement, offline 2D-to-3D/VR generation, and RTX VSR/TrueHDR. The README documents capabilities not visible in the sampled excerpts; those links are shown only where documented.

Main entry points: [`pipeline/pynv_stream.py`](https://github.com/zerochocobo/thru3d-media-server/blob/master/pipeline/pynv_stream.py) (HEVC passthrough), [`dlna/content_directory.py`](https://github.com/zerochocobo/thru3d-media-server/blob/master/dlna/content_directory.py) (ContentDirectory), [`http_app/routes_media.py`](https://github.com/zerochocobo/thru3d-media-server/blob/master/http_app/routes_media.py) (Media routes), [`http_app/server.py`](https://github.com/zerochocobo/thru3d-media-server/blob/master/http_app/server.py) (HTTP server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop and Settings"]
  node_ui["Desktop UI<br/>[main_window.py]"]
  node_runtime_settings["Live settings"]
end

subgraph group_library["Library and DLNA"]
  node_library_store[("Media library<br/>[media_library.py]")]
  node_content_directory["ContentDirectory"]
  node_ssdp["SSDP discovery<br/>[ssdp.py]"]
  node_http_server["HTTP server<br/>[server.py]"]
  node_dlna_routes["DLNA routes<br/>[routes_dlna.py]"]
end

subgraph group_realtime["Realtime Media"]
  node_media_routes["Media routes<br/>[routes_media.py]"]
  node_stream["HEVC passthrough<br/>[pynv_stream.py]"]
  node_matting["GPU matting<br/>[matting.py]"]
  node_alpha_output["Alpha compositing<br/>[alpha_packer.py]"]
  node_subtitles["Subtitle delivery<br/>[subtitles.py]"]
  node_si_playback["SI sidecar playback<br/>[si_stream.py]"]
  node_demosaic["2D-to-3D generation<br/>[demosaic.py]"]
  node_superres["RTX VSR and HDR<br/>[rtx_vsr.py]"]
  node_dlss5["DLSS 5 support<br/>[dlss5.py]"]
end

subgraph group_offline["Offline Processing"]
  node_offline_tools["Offline tools UI<br/>[offline_page.py]"]
  node_offline_generation["Offline generation<br/>[two_dvr.py]"]
  node_face_beauty["Face Beauty engine"]
end

subgraph group_runtime["Runtime Support"]
  node_config["Server configuration<br/>[config.py]"]
  node_model_manifest["Model manifest<br/>[trt_manifest.py]"]
  node_si_filter["SI audio filtering<br/>[si_filter.py]"]
  node_logger["Logging<br/>[logger.py]"]
  node_vr_naming["VR naming<br/>[vr_naming.py]"]
end

node_user(("Desktop user"))
node_player(("DLNA player"))

node_user -->|"configures"| node_ui
node_ui -->|"updates"| node_runtime_settings
node_ui -->|"launches"| node_offline_tools
node_offline_tools -->|"starts jobs"| node_offline_generation
node_offline_tools -->|"starts jobs"| node_face_beauty
node_player -->|"discovers"| node_ssdp
node_player -->|"requests media"| node_http_server
node_http_server -->|"registers routes"| node_dlna_routes
node_http_server -->|"registers routes"| node_media_routes
node_dlna_routes -->|"serves browsing"| node_content_directory
node_content_directory -->|"resolves library"| node_library_store
node_media_routes -->|"resolves media"| node_library_store
node_content_directory -->|"advertises captions"| node_player
node_media_routes -->|"serves captions"| node_player
node_media_routes -->|"starts streams"| node_stream
node_stream -->|"runs matting"| node_matting
node_stream -.->|"produces alpha"| node_alpha_output
node_stream -->|"embeds subtitles"| node_subtitles
node_media_routes -->|"serves SI"| node_si_playback
node_content_directory -->|"lists SI entries"| node_si_playback
node_stream -.->|"generates 3D"| node_demosaic
node_stream -.->|"applies VSR"| node_superres
node_stream -.->|"uses enhancement"| node_dlss5
node_si_playback -->|"filters audio"| node_si_filter
node_matting -->|"checks models"| node_model_manifest
node_offline_generation -.->|"generates depth"| node_demosaic
node_face_beauty -.->|"loads models"| node_model_manifest
node_config -->|"provides defaults"| node_runtime_settings
node_http_server -->|"logs requests"| node_logger
node_content_directory -->|"formats titles"| node_vr_naming

click node_ui "https://github.com/zerochocobo/thru3d-media-server/blob/master/ui/main_window.py"
click node_runtime_settings "https://github.com/zerochocobo/thru3d-media-server/blob/master/utils/runtime_settings.py"
click node_library_store "https://github.com/zerochocobo/thru3d-media-server/blob/master/media_library.py"
click node_content_directory "https://github.com/zerochocobo/thru3d-media-server/blob/master/dlna/content_directory.py"
click node_ssdp "https://github.com/zerochocobo/thru3d-media-server/blob/master/dlna/ssdp.py"
click node_http_server "https://github.com/zerochocobo/thru3d-media-server/blob/master/http_app/server.py"
click node_dlna_routes "https://github.com/zerochocobo/thru3d-media-server/blob/master/http_app/routes_dlna.py"
click node_media_routes "https://github.com/zerochocobo/thru3d-media-server/blob/master/http_app/routes_media.py"
click node_stream "https://github.com/zerochocobo/thru3d-media-server/blob/master/pipeline/pynv_stream.py"
click node_matting "https://github.com/zerochocobo/thru3d-media-server/blob/master/pipeline/matting.py"
click node_alpha_output "https://github.com/zerochocobo/thru3d-media-server/blob/master/pipeline/alpha_packer.py"
click node_subtitles "https://github.com/zerochocobo/thru3d-media-server/blob/master/pipeline/subtitles.py"
click node_si_playback "https://github.com/zerochocobo/thru3d-media-server/blob/master/http_app/si_stream.py"
click node_demosaic "https://github.com/zerochocobo/thru3d-media-server/blob/master/pipeline/demosaic.py"
click node_superres "https://github.com/zerochocobo/thru3d-media-server/blob/master/utils/rtx_vsr.py"
click node_offline_tools "https://github.com/zerochocobo/thru3d-media-server/blob/master/ui/pages/offline_page.py"
click node_offline_generation "https://github.com/zerochocobo/thru3d-media-server/blob/master/offline/two_dvr.py"
click node_face_beauty "https://github.com/zerochocobo/thru3d-media-server/blob/master/offline/face_beauty_engine.py"
click node_dlss5 "https://github.com/zerochocobo/thru3d-media-server/blob/master/utils/dlss5.py"
click node_config "https://github.com/zerochocobo/thru3d-media-server/blob/master/config.py"
click node_model_manifest "https://github.com/zerochocobo/thru3d-media-server/blob/master/utils/trt_manifest.py"
click node_si_filter "https://github.com/zerochocobo/thru3d-media-server/blob/master/utils/si_filter.py"
click node_logger "https://github.com/zerochocobo/thru3d-media-server/blob/master/utils/logger.py"
click node_vr_naming "https://github.com/zerochocobo/thru3d-media-server/blob/master/utils/vr_naming.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_ui,node_runtime_settings,node_user toneBlue
class node_library_store,node_content_directory,node_ssdp,node_http_server,node_dlna_routes toneAmber
class node_media_routes,node_stream,node_matting,node_alpha_output,node_subtitles,node_si_playback,node_demosaic,node_superres,node_dlss5 toneMint
class node_offline_tools,node_offline_generation,node_face_beauty toneRose
class node_config,node_model_manifest,node_si_filter,node_logger,node_vr_naming,node_player toneIndigo
```

## Components

### Desktop and Settings

- [Desktop UI](https://github.com/zerochocobo/thru3d-media-server/blob/master/ui/main_window.py): `ui/main_window.py`
- [Live settings](https://github.com/zerochocobo/thru3d-media-server/blob/master/utils/runtime_settings.py): `utils/runtime_settings.py`

### Library and DLNA

- [Media library](https://github.com/zerochocobo/thru3d-media-server/blob/master/media_library.py): `media_library.py`
- [ContentDirectory](https://github.com/zerochocobo/thru3d-media-server/blob/master/dlna/content_directory.py): `dlna/content_directory.py`
- [SSDP discovery](https://github.com/zerochocobo/thru3d-media-server/blob/master/dlna/ssdp.py): `dlna/ssdp.py`
- [HTTP server](https://github.com/zerochocobo/thru3d-media-server/blob/master/http_app/server.py): `http_app/server.py`
- [DLNA routes](https://github.com/zerochocobo/thru3d-media-server/blob/master/http_app/routes_dlna.py): `http_app/routes_dlna.py`

### Realtime Media

- [Media routes](https://github.com/zerochocobo/thru3d-media-server/blob/master/http_app/routes_media.py): `http_app/routes_media.py`
- [HEVC passthrough](https://github.com/zerochocobo/thru3d-media-server/blob/master/pipeline/pynv_stream.py): `pipeline/pynv_stream.py`
- [GPU matting](https://github.com/zerochocobo/thru3d-media-server/blob/master/pipeline/matting.py): `pipeline/matting.py`
- [Alpha compositing](https://github.com/zerochocobo/thru3d-media-server/blob/master/pipeline/alpha_packer.py): `pipeline/alpha_packer.py`
- [Subtitle delivery](https://github.com/zerochocobo/thru3d-media-server/blob/master/pipeline/subtitles.py): `pipeline/subtitles.py`
- [SI sidecar playback](https://github.com/zerochocobo/thru3d-media-server/blob/master/http_app/si_stream.py): `http_app/si_stream.py`
- [2D-to-3D generation](https://github.com/zerochocobo/thru3d-media-server/blob/master/pipeline/demosaic.py): `pipeline/demosaic.py`
- [RTX VSR and HDR](https://github.com/zerochocobo/thru3d-media-server/blob/master/utils/rtx_vsr.py): `utils/rtx_vsr.py`
- [DLSS 5 support](https://github.com/zerochocobo/thru3d-media-server/blob/master/utils/dlss5.py): `utils/dlss5.py`

### Offline Processing

- [Offline tools UI](https://github.com/zerochocobo/thru3d-media-server/blob/master/ui/pages/offline_page.py): `ui/pages/offline_page.py`
- [Offline generation](https://github.com/zerochocobo/thru3d-media-server/blob/master/offline/two_dvr.py): `offline/two_dvr.py`
- [Face Beauty engine](https://github.com/zerochocobo/thru3d-media-server/blob/master/offline/face_beauty_engine.py): `offline/face_beauty_engine.py`

### Runtime Support

- [Server configuration](https://github.com/zerochocobo/thru3d-media-server/blob/master/config.py): `config.py`
- [Model manifest](https://github.com/zerochocobo/thru3d-media-server/blob/master/utils/trt_manifest.py): `utils/trt_manifest.py`
- [SI audio filtering](https://github.com/zerochocobo/thru3d-media-server/blob/master/utils/si_filter.py): `utils/si_filter.py`
- [Logging](https://github.com/zerochocobo/thru3d-media-server/blob/master/utils/logger.py): `utils/logger.py`
- [VR naming](https://github.com/zerochocobo/thru3d-media-server/blob/master/utils/vr_naming.py): `utils/vr_naming.py`

### Other components

- **Desktop user**
- **DLNA player**

## Connections

- Desktop user → Desktop UI: configures (evidence: `README.md`)
- Desktop UI → Live settings: updates (evidence: `README.md`)
- Desktop UI → Offline tools UI: launches (evidence: `README.md`)
- Offline tools UI → Offline generation: starts jobs (evidence: `README.md`)
- Offline tools UI → Face Beauty engine: starts jobs (evidence: `README.md`)
- DLNA player → SSDP discovery: discovers (evidence: `README.md`)
- DLNA player → HTTP server: requests media (evidence: `README.md`)
- HTTP server → DLNA routes: registers routes (evidence: `http_app/server.py`)
- HTTP server → Media routes: registers routes (evidence: `http_app/server.py`)
- DLNA routes → ContentDirectory: serves browsing (evidence: `http_app/routes_dlna.py`)
- ContentDirectory → Media library: resolves library (evidence: `dlna/content_directory.py`)
- Media routes → Media library: resolves media (evidence: `http_app/routes_media.py`)
- ContentDirectory → DLNA player: advertises captions (evidence: `README.md`)
- Media routes → DLNA player: serves captions (evidence: `README.md`)
- Media routes → HEVC passthrough: starts streams (evidence: `http_app/routes_media.py`)
- HEVC passthrough → GPU matting: runs matting (evidence: `pipeline/pynv_stream.py`)
- HEVC passthrough → Alpha compositing: produces alpha (evidence: `pipeline/pynv_stream.py`)
- HEVC passthrough → Subtitle delivery: embeds subtitles (evidence: `README.md`)
- Media routes → SI sidecar playback: serves SI (evidence: `http_app/routes_media.py`)
- ContentDirectory → SI sidecar playback: lists SI entries (evidence: `README.md`)
- HEVC passthrough → 2D-to-3D generation: generates 3D (evidence: `pipeline/pynv_stream.py`)
- HEVC passthrough → RTX VSR and HDR: applies VSR (evidence: `pipeline/pynv_stream.py`)
- HEVC passthrough → DLSS 5 support: uses enhancement (evidence: `pipeline/pynv_stream.py`)
- SI sidecar playback → SI audio filtering: filters audio (evidence: `http_app/si_stream.py`)
- GPU matting → Model manifest: checks models (evidence: `pipeline/matting.py`)
- Offline generation → 2D-to-3D generation: generates depth
- Face Beauty engine → Model manifest: loads models
- Server configuration → Live settings: provides defaults (evidence: `utils/runtime_settings.py`)
- HTTP server → Logging: logs requests (evidence: `http_app/server.py`)
- ContentDirectory → VR naming: formats titles (evidence: `dlna/content_directory.py`)
