docs+docker: integration guide и runtime image для Frigate/cctv stack
docs/integration.md — детальный guide для интеграции в существующий CCTV docker-compose: критичные требования (ipc=shareable/container, общий shared volume для socket), пример CuframesSource для cctv-processor, verification checklist, troubleshooting (timeout, ipc namespace mismatch, high latency). Зафиксировано: v0.1 frigate-decode не убирается без patch'а FFmpeg — это v0.2 scope. docker/Dockerfile.runtime — multi-stage build (devel → runtime), копирует libcuframes.so + cuframes-rtsp-source + sub_count в /usr/local. Образ ~700 MB (vs ~7 GB у dev'а). Smoke-test: бинарки запускаются, ldd видит все нужные libs. docker-compose.example.yml — reference docker-compose с правильным ipc mode и volume mounts для копирования в свои проекты. .dockerignore — исключает build/ и build-*/ из COPY context. README обновлён: статус v0.1 done, quickstart с реальным docker run, ссылка на integration guide.
This commit is contained in:
@@ -2,7 +2,8 @@
|
||||
|
||||
Zero-copy sharing декодированных видеокадров между процессами через CUDA IPC.
|
||||
|
||||
**Статус:** ⚠️ Design phase. Дизайн-спецификация готова, реализация в процессе.
|
||||
**Статус:** v0.1 — libcuframes готов, cuframes-rtsp-source готов, e2e-pipeline
|
||||
протестирован (4×subscriber × 2000 frames, 0 torn). FFmpeg filter — v0.2.
|
||||
**Лицензия:** LGPL-2.1+
|
||||
|
||||
## Минимальные требования
|
||||
@@ -46,37 +47,51 @@ Camera ─► ffmpeg + cuframes filter ─► VRAM ─┬─► consumer 1 (NVR)
|
||||
|
||||
## Состав
|
||||
|
||||
- **FFmpeg filter `cuda_ipc_export`** — добавляется в любой ffmpeg-pipeline
|
||||
- **`libcuframes`** — C library + C++/Python bindings для consumers
|
||||
- **Docker images** — drop-in replacement для существующих setups (включая Frigate)
|
||||
- **`libcuframes`** — C library + C++ RAII wrapper (header-only) для producer/consumer
|
||||
- **`cuframes-rtsp-source`** — standalone bridge RTSP → cuframes IPC (используется
|
||||
как input для AI/mosaic consumer'ов; альтернатива FFmpeg-filter'а до v0.2)
|
||||
- **`sub_count`** (examples/) — reference subscriber + smoke-test tool
|
||||
- **Docker images** — runtime для drop-in deployment (см. docker/Dockerfile.runtime)
|
||||
- **FFmpeg filter `cuda_ipc_export`** — *planned для v0.2*
|
||||
|
||||
## Quickstart
|
||||
|
||||
> 🚧 в разработке
|
||||
|
||||
```bash
|
||||
# Producer (после v0.1)
|
||||
docker run --gpus all -v /run/cuframes:/run/cuframes ghcr.io/<org>/cuframes-ffmpeg:N \
|
||||
ffmpeg -hwaccel cuda -i rtsp://camera/stream \
|
||||
-vf "scale_cuda=1920:1080,cuda_ipc_export=key=cam1" \
|
||||
-c:v copy -f segment recording.mp4
|
||||
# Publisher: декодирует RTSP в CUDA, публикует через cuframes IPC
|
||||
docker run -d --name cuframes-cam --runtime=nvidia --ipc=shareable \
|
||||
-v /run/cuframes:/run/cuframes \
|
||||
gx/cuframes:0.1 \
|
||||
/usr/local/bin/cuframes-rtsp-source \
|
||||
--rtsp 'rtsp://user:pass@cam/stream' --key cam1 --ring 6
|
||||
|
||||
# Consumer (C++)
|
||||
#include <cuframes.hpp>
|
||||
cuframes::Subscriber sub("cam1");
|
||||
while (auto frame = sub.next()) {
|
||||
// frame->cuda_ptr — device pointer, zero-copy
|
||||
process_on_cuda(frame->cuda_ptr, frame->width, frame->height);
|
||||
# Subscriber: получает декодированные frames zero-copy
|
||||
docker run --rm --runtime=nvidia --ipc=container:cuframes-cam \
|
||||
-v /run/cuframes:/run/cuframes:ro \
|
||||
gx/cuframes:0.1 \
|
||||
/usr/local/bin/sub_count --key cam1 --max-frames 100
|
||||
|
||||
# Или C++ кодом:
|
||||
#include <cuframes/cuframes.hpp>
|
||||
cuframes::SubscriberOptions opt;
|
||||
opt.key = "cam1";
|
||||
cuframes::Subscriber sub(opt);
|
||||
cudaStream_t s; cudaStreamCreate(&s);
|
||||
while (auto frame = sub.next(s, 1000)) { // 1s timeout
|
||||
cudaStreamSynchronize(s);
|
||||
process_on_cuda(frame->cuda_ptr(), frame->width(), frame->height());
|
||||
}
|
||||
```
|
||||
|
||||
**Полный integration guide** (docker-compose, cctv-processor, troubleshooting):
|
||||
[docs/integration.md](docs/integration.md).
|
||||
|
||||
## Документация
|
||||
|
||||
- [docs/architecture.md](docs/architecture.md) — полный design document
|
||||
- [docs/protocol.md](docs/protocol.md) — bit-exact wire protocol spec
|
||||
- [docs/requirements.md](docs/requirements.md) — system requirements (hardware, software, build, Docker, k8s)
|
||||
- [docs/integration.md](docs/integration.md) — **integration guide** для CCTV-стека (cuframes-rtsp-source + cctv-processor + Frigate)
|
||||
- [docs/benchmarks-phase0.md](docs/benchmarks-phase0.md) — Phase 0 latency/throughput measurements
|
||||
- [docs/quickstart.md](docs/quickstart.md) — *(в разработке)*
|
||||
|
||||
## Why
|
||||
|
||||
@@ -88,15 +103,16 @@ NVIDIA DeepStream закрытые / vendor-locked. Open source FFmpeg-plugin д
|
||||
|
||||
## Roadmap
|
||||
|
||||
| Phase | Что | Срок |
|
||||
| Phase | Что | Статус |
|
||||
|---|---|---|
|
||||
| 0 | PoC spike, CUDA IPC latency measurements | 3 дня |
|
||||
| 1 | `libcuframes` (producer/consumer ring buffer + handshake protocol) | 1 неделя |
|
||||
| 2 | FFmpeg filter `vf_cuda_ipc_export` + patched FFmpeg build | 1-2 недели |
|
||||
| 3 | C++ / Python bindings | 1 неделя |
|
||||
| 4 | Docker packaging + Frigate drop-in image | 3-5 дней |
|
||||
| 5 | Reference consumer: 16-камерный mosaic compositor | 1 неделя |
|
||||
| 6 | OSS launch (HN, reddit, FFmpeg upstream PR) | 3-5 дней |
|
||||
| 0 | PoC spike, CUDA IPC latency measurements | ✅ done |
|
||||
| 1 | `libcuframes` (producer/consumer ring buffer + handshake protocol) | ✅ done |
|
||||
| 1.5 | C++ RAII wrapper, cuframes-rtsp-source, integration docs | ✅ done |
|
||||
| 2 | FFmpeg filter `vf_cuda_ipc_input` + patched FFmpeg build | planned |
|
||||
| 3 | Python bindings (pybind11) | planned |
|
||||
| 4 | Docker runtime-images в реестре, Frigate plugin POC | planned |
|
||||
| 5 | Reference: 16-камерный mosaic consumer | planned |
|
||||
| 6 | OSS launch (HN, reddit, FFmpeg upstream PR) | planned |
|
||||
|
||||
## Contributing
|
||||
|
||||
|
||||
Reference in New Issue
Block a user