Certain nvidia cards include a hardware decoder, which can greatly improve the performance of video decoding. In order to use NVDEC, a special build of ffmpeg with NVDEC support is required. The special docker architecture 'amd64nvidia' includes this support for amd64 platforms. An aarch64 for the Jetson, which also includes NVDEC may be added in the future.
Some more detailed setup instructions are also available in this issue.
In order to pass NVDEC, the docker engine must be set to
nvidia and the environment variables
NVIDIA_DRIVER_CAPABILITIES=compute,utility,video must be set.
In a docker compose file, these lines need to be set:
In your frigate config.yml, you'll need to set ffmpeg to use the hardware decoder. The decoder you choose will depend on the input video.
A list of supported codecs (you can use
ffmpeg -decoders | grep cuvid in the container to get a list)
For example, for H265 video (hevc), you'll select
-c:v hevc_cuvid to your ffmpeg input arguments:
If everything is working correctly, you should see a significant improvement in performance.
Verify that hardware decoding is working by running
nvidia-smi, which should show the ffmpeg