Тонкий слой поверх C API: - cuframes::Error — exception при ошибках, code() для подробностей - cuframes::Publisher — RAII обёртка publisher'а (LIBRARY + EXTERNAL constructors) - cuframes::Subscriber + cuframes::FrameRef — RAII frame с автo-release - cuframes::AsyncSubscriber — с std::function callbacks - cuframes::Frame — read-only view (для callback'а) - cuframes::calc_frame_size(), now_ns() — utilities Smoke test (in dev container): $ g++ -std=c++17 ... -lcuframes -lcudart smoke.cpp $ ./smoke version: 0.1.0 FullHD NV12 frame: 3317760 bytes (pitch_y=2048, pitch_uv=2048)
cuframes
Zero-copy sharing декодированных видеокадров между процессами через CUDA IPC.
Статус: ⚠️ Design phase. Дизайн-спецификация готова, реализация в процессе. Лицензия: LGPL-2.1+
Минимальные требования
| Минимум | Рекомендуется | |
|---|---|---|
| OS | Linux kernel ≥ 5.4 | Ubuntu 24.04 |
| GPU | NVIDIA с compute capability ≥ 7.5 (Turing+) | Ampere/Ada/Blackwell |
| NVIDIA driver | 525 (для CUDA 12) | 555+ (для CUDA 13) |
| CUDA Toolkit (build) | 12.0 | 13.0+ |
| GCC / Clang | 11 / 14 | 12+ / 17+ |
| CMake | 3.20 | 3.28+ |
| Docker | 24.x + nvidia-container-toolkit 1.14+ | — |
Не работает на Windows, macOS, WSL2, AMD/Intel GPU, multi-GPU producer/consumer. Подробно — docs/requirements.md.
Идея в одну минуту
Типичный 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
🚧 в разработке
# 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 — полный design document
- docs/protocol.md — bit-exact wire protocol spec
- docs/requirements.md — system requirements (hardware, software, build, Docker, k8s)
- docs/benchmarks-phase0.md — Phase 0 latency/throughput measurements
- docs/quickstart.md — (в разработке)
Why
Подтверждённый спрос в Frigate community (#17033,
#20191, #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 и CONTRIBUTING.md.