SECUREXSECURITY ENGINEERINGNVR 文档

视频硬件加速

视频硬件加速的目标是把 H.264/H.265 解码从 CPU 移到 GPU/媒体引擎。它与 Coral/OpenVINO 等 AI 推理不同:一个负责“把压缩视频解成画面”,另一个负责“识别画面里的对象”。

Intel

ffmpeg:
  hwaccel_args: preset-vaapi

较新的 Intel 平台也可使用 QSV 预设,例如 H.264 使用 preset-intel-qsv-h264,H.265 使用 preset-intel-qsv-h265。容器通常需要映射 /dev/dri。

AMD

ffmpeg:
  hwaccel_args: preset-vaapi

AMD VAAPI 环境通常使用 radeonsi 驱动。确认宿主机 VAAPI 正常后再排查容器。

NVIDIA

需要正确的 NVIDIA 驱动、Container Toolkit/运行时以及支持 NVDEC/CUVID 的 GPU。Securex 使用对应的 FFmpeg 预设时,容器必须可访问 GPU。

为什么 GPU 显示 0%

  • 当前码流仍在 CPU 解码,hwaccel preset 没生效。
  • 统计工具看的不是实际被使用的 render node/GPU。
  • 码流很轻,瞬时利用率接近 0。
  • 你看的“GPU”是 3D 引擎,而视频解码在 Video/Media engine。
  • Coral 正常工作只说明 AI 推理正常,与 GPU 解码无直接关系。

验证步骤

  1. 宿主机确认 GPU 驱动和设备节点。
  2. 容器内确认 /dev/dri 或 NVIDIA 设备可见。
  3. 检查 FFmpeg 启动命令/日志是否使用预设。
  4. 同时观察 CPU 降幅、视频引擎和摄像头稳定性。

不要为了 0% 强行修改

只要 CPU 占用合理、FFmpeg 无错误、画面和录像稳定,就不要为了让某个监控数值“必须有百分比”而随意更换解码参数。硬件代际、驱动与统计接口差异很大。

Video hardware acceleration

Hardware video acceleration moves H.264/H.265 decoding from CPU cores to a GPU/media engine. It is separate from AI inference: decode turns compressed video into frames, while Coral/OpenVINO/ONNX classify those frames.

Intel

ffmpeg:
  hwaccel_args: preset-vaapi

Newer Intel systems can also use QSV presets such as preset-intel-qsv-h264 or preset-intel-qsv-h265. The container normally needs access to /dev/dri.

AMD

ffmpeg:
  hwaccel_args: preset-vaapi

AMD VAAPI commonly uses the radeonsi driver. Prove VAAPI works on the host before troubleshooting the container.

NVIDIA

Requires a compatible driver, NVIDIA container runtime/toolkit, and NVDEC/CUVID-capable GPU.

Why GPU may show 0%

  • The stream is still decoding on CPU.
  • Telemetry is watching a different GPU/render node.
  • The stream is light and utilization is bursty.
  • You are viewing a 3D engine while decode uses a Video/Media engine.
  • Coral activity says nothing about GPU decode.

Verification

  1. Verify the host driver and device node.
  2. Verify device visibility in the container.
  3. Check FFmpeg logs/arguments for the intended preset.
  4. Observe CPU reduction and stream stability, not just one percentage.

Do not tune for a number

If CPU is reasonable and video is stable, do not change working decode parameters solely to make a monitoring widget show non-zero utilization.

Aceleración de vídeo

La aceleración mueve la decodificación H.264/H.265 de CPU al motor multimedia de la GPU. Es distinta de la inferencia IA: una decodifica vídeo y la otra reconoce objetos.

Intel

ffmpeg:
  hwaccel_args: preset-vaapi

En Intel reciente también se pueden usar preset-intel-qsv-h264 y preset-intel-qsv-h265. El contenedor suele necesitar /dev/dri.

AMD

ffmpeg:
  hwaccel_args: preset-vaapi

AMD VAAPI suele usar radeonsi.

NVIDIA

Necesita driver, runtime/toolkit de contenedor y GPU con NVDEC/CUVID.

GPU al 0%

  • FFmpeg sigue usando CPU.
  • Se monitoriza otro render node.
  • La carga es muy baja.
  • Se mira el motor 3D y no Video/Media.
  • Coral no tiene relación directa con la decodificación GPU.

Verificación

  1. Compruebe driver y dispositivo en el host.
  2. Compruebe acceso desde el contenedor.
  3. Revise argumentos/logs de FFmpeg.
  4. Observe reducción de CPU y estabilidad.

No optimice solo para un porcentaje

Si CPU y vídeo son correctos, no cambie parámetros solo para ver un número distinto de cero.

输入关键词开始搜索