# xingchennnnn/fh8862-multi-cam architecture

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

- Interactive diagram: https://gitdiagram.com/xingchennnnn/fh8862-multi-cam
- Repository: https://github.com/xingchennnnn/fh8862-multi-cam

## Overview

FH8862 Multi-Channel Video Surveillance is a four-camera system with separate video and device-control paths. The video path runs from board-side capture and H.264 encoding through RTSP, a MediaMTX relay, and browser WebRTC playback; the control path routes browser HTTP requests through Node.js to each board’s TCP command server. README-described features are retained, but some unsampled subsystem wiring is shown only where documented.

Main entry points: [`src/control_server.c`](https://github.com/xingchennnnn/fh8862-multi-cam/blob/main/src/control_server.c) (TCP command server), [`web/index.html`](https://github.com/xingchennnnn/fh8862-multi-cam/blob/main/web/index.html) (Video wall and controls), [`web/server.js`](https://github.com/xingchennnnn/fh8862-multi-cam/blob/main/web/server.js) (HTTP control API), [`src/rtsp_live555.cpp`](https://github.com/xingchennnnn/fh8862-multi-cam/blob/main/src/rtsp_live555.cpp) (RTSP server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_board_video["Board video"]
  node_sensor["IMX415 sensor<br/>[sensor.c]"]
  node_isp["ISP processing<br/>[isp.c]"]
  node_media_pipeline["VPSS and VENC<br/>[main.c]"]
  node_frame_queue["H.264 frame queues<br/>[frame_queue.cpp]"]
  node_live_source["Live H.264 source"]
  node_rtsp_sessions["RTSP sessions"]
  node_rtsp_server["RTSP server<br/>[rtsp_live555.cpp]"]
end

subgraph group_board_control["Board control"]
  node_board_control_server["TCP command server<br/>[control_server.c]"]
  node_control_actions["OSD, masks, recording<br/>[main.c]"]
  node_device_controls["Sensor and device controls<br/>[sensor.c]"]
end

subgraph group_relay["Relay services"]
  node_mediamtx["MediaMTX relay<br/>[mediamtx.yml]"]
  node_http_api["HTTP control API<br/>[server.js]"]
end

subgraph group_browser["Browser interface"]
  node_web_ui["Video wall and controls<br/>[index.html]"]
  node_webrtc_player["WebRTC playback<br/>[webrtc-player.js]"]
  node_browser_recording["Browser recording<br/>[webrtc-player.js]"]
end

node_operator(("Operator"))

node_sensor -->|"supplies images"| node_isp
node_isp -->|"feeds processing"| node_media_pipeline
node_media_pipeline -->|"queues encoded frames"| node_frame_queue
node_frame_queue -->|"provides frames"| node_live_source
node_rtsp_sessions -->|"creates source"| node_live_source
node_rtsp_server -->|"serves streams"| node_rtsp_sessions
node_operator -->|"views and controls"| node_web_ui
node_web_ui -->|"hosts playback"| node_webrtc_player
node_webrtc_player -->|"requests WebRTC"| node_mediamtx
node_rtsp_server -->|"publishes RTSP"| node_mediamtx
node_operator -->|"sends control requests"| node_http_api
node_web_ui -->|"calls API"| node_http_api
node_http_api -->|"forwards TCP commands"| node_board_control_server
node_board_control_server -->|"dispatches commands"| node_control_actions
node_board_control_server -->|"sets sensor parameters"| node_device_controls
node_operator -->|"records playback"| node_browser_recording

click node_sensor "https://github.com/xingchennnnn/fh8862-multi-cam/blob/main/src/sensor.c"
click node_isp "https://github.com/xingchennnnn/fh8862-multi-cam/blob/main/src/isp.c"
click node_media_pipeline "https://github.com/xingchennnnn/fh8862-multi-cam/blob/main/src/main.c"
click node_frame_queue "https://github.com/xingchennnnn/fh8862-multi-cam/blob/main/src/frame_queue.cpp"
click node_live_source "https://github.com/xingchennnnn/fh8862-multi-cam/blob/main/src/h264_live_source.cpp"
click node_rtsp_sessions "https://github.com/xingchennnnn/fh8862-multi-cam/blob/main/src/h264_subsession.cpp"
click node_rtsp_server "https://github.com/xingchennnnn/fh8862-multi-cam/blob/main/src/rtsp_live555.cpp"
click node_board_control_server "https://github.com/xingchennnnn/fh8862-multi-cam/blob/main/src/control_server.c"
click node_control_actions "https://github.com/xingchennnnn/fh8862-multi-cam/blob/main/src/main.c"
click node_device_controls "https://github.com/xingchennnnn/fh8862-multi-cam/blob/main/src/sensor.c"
click node_mediamtx "https://github.com/xingchennnnn/fh8862-multi-cam/blob/main/web/mediamtx.yml"
click node_http_api "https://github.com/xingchennnnn/fh8862-multi-cam/blob/main/web/server.js"
click node_web_ui "https://github.com/xingchennnnn/fh8862-multi-cam/blob/main/web/index.html"
click node_webrtc_player "https://github.com/xingchennnnn/fh8862-multi-cam/blob/main/web/js/webrtc-player.js"
click node_browser_recording "https://github.com/xingchennnnn/fh8862-multi-cam/blob/main/web/js/webrtc-player.js"

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_sensor,node_isp,node_media_pipeline,node_frame_queue,node_live_source,node_rtsp_sessions,node_rtsp_server toneBlue
class node_board_control_server,node_control_actions,node_device_controls toneAmber
class node_mediamtx,node_http_api toneMint
class node_web_ui,node_webrtc_player,node_browser_recording toneRose
class node_operator toneIndigo
```

## Components

### Board video

- [IMX415 sensor](https://github.com/xingchennnnn/fh8862-multi-cam/blob/main/src/sensor.c): `src/sensor.c`
- [ISP processing](https://github.com/xingchennnnn/fh8862-multi-cam/blob/main/src/isp.c): `src/isp.c`
- [VPSS and VENC](https://github.com/xingchennnnn/fh8862-multi-cam/blob/main/src/main.c): `src/main.c`
- [H.264 frame queues](https://github.com/xingchennnnn/fh8862-multi-cam/blob/main/src/frame_queue.cpp): `src/frame_queue.cpp`
- [Live H.264 source](https://github.com/xingchennnnn/fh8862-multi-cam/blob/main/src/h264_live_source.cpp): `src/h264_live_source.cpp`
- [RTSP sessions](https://github.com/xingchennnnn/fh8862-multi-cam/blob/main/src/h264_subsession.cpp): `src/h264_subsession.cpp`
- [RTSP server](https://github.com/xingchennnnn/fh8862-multi-cam/blob/main/src/rtsp_live555.cpp): `src/rtsp_live555.cpp`

### Board control

- [TCP command server](https://github.com/xingchennnnn/fh8862-multi-cam/blob/main/src/control_server.c): `src/control_server.c`
- [OSD, masks, recording](https://github.com/xingchennnnn/fh8862-multi-cam/blob/main/src/main.c): `src/main.c`
- [Sensor and device controls](https://github.com/xingchennnnn/fh8862-multi-cam/blob/main/src/sensor.c): `src/sensor.c`

### Relay services

- [MediaMTX relay](https://github.com/xingchennnnn/fh8862-multi-cam/blob/main/web/mediamtx.yml): `web/mediamtx.yml`
- [HTTP control API](https://github.com/xingchennnnn/fh8862-multi-cam/blob/main/web/server.js): `web/server.js`

### Browser interface

- [Video wall and controls](https://github.com/xingchennnnn/fh8862-multi-cam/blob/main/web/index.html): `web/index.html`
- [WebRTC playback](https://github.com/xingchennnnn/fh8862-multi-cam/blob/main/web/js/webrtc-player.js): `web/js/webrtc-player.js`
- [Browser recording](https://github.com/xingchennnnn/fh8862-multi-cam/blob/main/web/js/webrtc-player.js): `web/js/webrtc-player.js`

### Other components

- **Operator**

## Connections

- IMX415 sensor → ISP processing: supplies images (evidence: `README.md`)
- ISP processing → VPSS and VENC: feeds processing (evidence: `README.md`)
- VPSS and VENC → H.264 frame queues: queues encoded frames (evidence: `README.md`)
- H.264 frame queues → Live H.264 source: provides frames (evidence: `src/h264_live_source.cpp`)
- RTSP sessions → Live H.264 source: creates source (evidence: `src/h264_subsession.cpp`)
- RTSP server → RTSP sessions: serves streams (evidence: `README.md`)
- Operator → Video wall and controls: views and controls (evidence: `README.md`)
- Video wall and controls → WebRTC playback: hosts playback (evidence: `README.md`)
- WebRTC playback → MediaMTX relay: requests WebRTC (evidence: `README.md`)
- RTSP server → MediaMTX relay: publishes RTSP (evidence: `README.md`)
- Operator → HTTP control API: sends control requests (evidence: `README.md`)
- Video wall and controls → HTTP control API: calls API (evidence: `README.md`)
- HTTP control API → TCP command server: forwards TCP commands (evidence: `README.md`)
- TCP command server → OSD, masks, recording: dispatches commands (evidence: `src/control_server.c`)
- TCP command server → Sensor and device controls: sets sensor parameters (evidence: `src/control_server.c`)
- Operator → Browser recording: records playback (evidence: `README.md`)
