feat(filter): FFmpeg 7.1 cuframes:// input demuxer (PoC v1) #1
Reference in New Issue
Block a user
Delete Branch "feat/ffmpeg-demuxer"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Что делает
Out-of-tree patch для FFmpeg 7.1, добавляющий новый input format
cuframes://<key>. Любой FFmpeg-based потребитель (Frigate, кастомныерекордеры, re-streamers) теперь может подписаться на уже декодированные
кадры от
cuframes-rtsp-sourceчерезобычный URL — без своего NVDEC pass.
Это шаг к v0.2 cuframes из roadmap (FFmpeg-side integration без форка
Frigate).
Состав
filter/cuframesdec.cread_headerподключается к publisher'у и кеширует 1-й frame для определения размеров;read_packetкопирует NV12 GPU → CPU черезcudaMemcpy2DAsync+ выдаётAVPacketfilter/ffmpeg-7.1-cuframes-demuxer.patchlibavformat/Makefile,libavformat/allformats.c,configure(--enable-libcuframes); кладётcuframesdec.cвlibavformat/filter/README.mdLimitations v1 (намеренно)
cudaMemcpy2DAsync(для PoC совместимости со всемиFFmpeg pipeline'ами). Zero-copy через
AVHWFramesContext— запланированов v2
Главный выигрыш v1 всё равно достигнут: 1× NVDEC у publisher'а на N
consumer'ов вместо N× NVDEC.
Опции
CLI smoke test (прошёл)
2026-05-17, host build FFmpeg 7.1 patched + libcuframes 0.1, publisher на
камере 192.168.88.98 (1920×1080 HEVC 25fps):
speed=1x= pipeline в реальном времени с частотой камеры, 0 drops.Frigate integration (план, не в этом PR)
После пересборки Frigate image с patched FFmpeg в
config.yml:Detect-стрим декодируется один раз в publisher'е, recording продолжает
mux'иться Frigate'ом из encoded RTSP без декода (как сейчас).
Не входит в PR: Dockerfile-патч самого Frigate image (тяжёлая сборка
с CUDA + TensorRT base, требует много трафика и build-времени; делается
отдельным PR в инфраструктурном репо).
Зависимости
adjust в
allformats.c/configureoffset'ах)cudaMemcpy2D*функцийRoadmap v2+
AVHWFramesContext(NV12 остаётся в VRAM весь pipeline).pcфайл для libcuframes (вместо ручных--extra-cflags/--extra-ldflags)Checklist
ffmpeg -formats | grep cuframes)ffmpeg -h demuxer=cuframes)