Files
cuframes/README.md
T
gx c8ab4522f2 initial commit: design specification + repo scaffolding
cuframes — open-source FFmpeg-плагин и runtime library для zero-copy
sharing декодированных видеокадров между процессами через CUDA IPC.

Содержимое initial commit:
- docs/architecture.md — полная design-spec (418 строк) с prior art,
  protocol design, API draft, phase plan, acceptance criteria
- README.md — landing с описанием идеи, состава, quickstart-tease,
  roadmap, ссылки на community-discussions подтверждающие спрос
- CONTRIBUTING.md — guidelines, code style, commit message convention
- CHANGELOG.md — Keep a Changelog format, Unreleased / 0.0.1
- LICENSE — LGPL-2.1+ (compatibility с FFmpeg)
- .gitignore — build/CMake/Docker/Python/CUDA-specific

Следующие шаги (отдельные коммиты):
- docker/Dockerfile.dev (CUDA 12.x dev environment)
- tools/spike/ (Phase 0 PoC код для measurement CUDA IPC latency)
2026-05-14 21:17:34 +01:00

89 lines
3.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# cuframes
Zero-copy sharing декодированных видеокадров между процессами через CUDA IPC.
**Статус:** ⚠️ Design phase. Дизайн-спецификация готова, реализация в процессе.
**Лицензия:** LGPL-2.1+
**Платформы:** Linux, NVIDIA CUDA ≥ 12.0
## Идея в одну минуту
Типичный setup с несколькими сервисами видеоаналитики:
```
Camera ─► ffmpeg #1 (NVR, decode + record)
─► ffmpeg #2 (AI-detector, decode + inference)
─► ffmpeg #3 (custom analytics, decode + ...)
```
Каждый сервис делает **свой** decode на GPU. На 16 cameras × 25 fps × 3 consumers
это сотни лишних NVDEC operations и GB/s VRAM-bandwidth впустую.
`cuframes` устраняет дублирование:
```
Camera ─► ffmpeg + cuframes filter ─► VRAM ─┬─► consumer 1 (NVR)
├─► consumer 2 (AI)
└─► consumer 3 (analytics)
```
Один decode, frame остаётся в VRAM, любое количество consumers читают
**zero-copy** через CUDA IPC.
## Состав
- **FFmpeg filter `cuda_ipc_export`** — добавляется в любой ffmpeg-pipeline
- **`libcuframes`** — C library + C++/Python bindings для consumers
- **Docker images** — drop-in replacement для существующих setups (включая Frigate)
## 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
# 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);
}
```
## Документация
- [docs/architecture.md](docs/architecture.md) — полный design document
- [docs/protocol.md](docs/protocol.md) — wire protocol *(в разработке)*
- [docs/quickstart.md](docs/quickstart.md) — *(в разработке)*
## Why
Подтверждённый спрос в Frigate community ([#17033](https://github.com/blakeblackshear/frigate/discussions/17033),
[#20191](https://github.com/blakeblackshear/frigate/discussions/20191), [#21559](https://github.com/blakeblackshear/frigate/discussions/21559))
— люди тычатся в NVDEC saturation при многокамерных setup'ах. Решения уровня
NVIDIA DeepStream закрытые / vendor-locked. Open source FFmpeg-plugin для этой
ниши **не существует**. См. подробный prior-art analysis в `docs/architecture.md`.
## Roadmap
| 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 дней |
## Contributing
Проект на ранней стадии. Перед PR сверьтесь с [docs/architecture.md](docs/architecture.md)
и [CONTRIBUTING.md](CONTRIBUTING.md).