diff --git a/docs/docs/configuration/hardware_acceleration.md b/docs/docs/configuration/hardware_acceleration.md index e2153f4f2..ecdc038b4 100644 --- a/docs/docs/configuration/hardware_acceleration.md +++ b/docs/docs/configuration/hardware_acceleration.md @@ -67,4 +67,76 @@ ffmpeg: ### NVIDIA GPU -NVIDIA GPU based decoding via NVDEC is supported, but requires special configuration. See the [NVIDIA NVDEC documentation](/configuration/nvdec) for more details. +These instructions are based on the [jellyfin documentation](https://jellyfin.org/docs/general/administration/hardware-acceleration.html#nvidia-hardware-acceleration-on-docker-linux) + +Add `--gpus all` to your docker run command or update your compose file. + +```yaml +services: + frigate: + ... + image: blakeblackshear/frigate:stable + deploy: # <------------- Add this section + resources: + reservations: + devices: + - capabilities: [gpu] +``` + +The decoder you need to pass in the `hwaccel_args` 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) + +```shell + V..... h263_cuvid Nvidia CUVID H263 decoder (codec h263) + V..... h264_cuvid Nvidia CUVID H264 decoder (codec h264) + V..... hevc_cuvid Nvidia CUVID HEVC decoder (codec hevc) + V..... mjpeg_cuvid Nvidia CUVID MJPEG decoder (codec mjpeg) + V..... mpeg1_cuvid Nvidia CUVID MPEG1VIDEO decoder (codec mpeg1video) + V..... mpeg2_cuvid Nvidia CUVID MPEG2VIDEO decoder (codec mpeg2video) + V..... mpeg4_cuvid Nvidia CUVID MPEG4 decoder (codec mpeg4) + V..... vc1_cuvid Nvidia CUVID VC1 decoder (codec vc1) + V..... vp8_cuvid Nvidia CUVID VP8 decoder (codec vp8) + V..... vp9_cuvid Nvidia CUVID VP9 decoder (codec vp9) +``` + +For example, for H265 video (hevc), you'll select `hevc_cuvid`. + +```yaml +ffmpeg: + hwaccel_args: + - -c:v + - hevc_cuvid +``` + +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 +processes: + +``` ++-----------------------------------------------------------------------------+ +| NVIDIA-SMI 455.38 Driver Version: 455.38 CUDA Version: 11.1 | +|-------------------------------+----------------------+----------------------+ +| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC | +| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | +| | | MIG M. | +|===============================+======================+======================| +| 0 GeForce GTX 166... Off | 00000000:03:00.0 Off | N/A | +| 38% 41C P2 36W / 125W | 2082MiB / 5942MiB | 5% Default | +| | | N/A | ++-------------------------------+----------------------+----------------------+ + ++-----------------------------------------------------------------------------+ +| Processes: | +| GPU GI CI PID Type Process name GPU Memory | +| ID ID Usage | +|=============================================================================| +| 0 N/A N/A 12737 C ffmpeg 249MiB | +| 0 N/A N/A 12751 C ffmpeg 249MiB | +| 0 N/A N/A 12772 C ffmpeg 249MiB | +| 0 N/A N/A 12775 C ffmpeg 249MiB | +| 0 N/A N/A 12800 C ffmpeg 249MiB | +| 0 N/A N/A 12811 C ffmpeg 417MiB | +| 0 N/A N/A 12827 C ffmpeg 417MiB | ++-----------------------------------------------------------------------------+ +``` diff --git a/docs/docs/configuration/nvdec.md b/docs/docs/configuration/nvdec.md deleted file mode 100644 index 69889241b..000000000 --- a/docs/docs/configuration/nvdec.md +++ /dev/null @@ -1,99 +0,0 @@ ---- -id: nvdec -title: NVIDIA hardware decoder ---- - -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](https://github.com/blakeblackshear/frigate/issues/1847#issuecomment-932076731). - -## Docker setup - -### Requirements - -[nVidia closed source driver](https://www.nvidia.com/en-us/drivers/unix/) required to access NVDEC. -[nvidia-docker](https://github.com/NVIDIA/nvidia-docker) required to pass NVDEC to docker. - -### Setting up docker-compose - -In order to pass NVDEC, the docker engine must be set to `nvidia` and the environment variables -`NVIDIA_VISIBLE_DEVICES=all` and `NVIDIA_DRIVER_CAPABILITIES=compute,utility,video` must be set. - -In a docker compose file, these lines need to be set: - -```yaml -services: - frigate: - ... - image: blakeblackshear/frigate:stable-amd64nvidia - runtime: nvidia - environment: - - NVIDIA_VISIBLE_DEVICES=all - - NVIDIA_DRIVER_CAPABILITIES=compute,utility,video -``` - -### Setting up the configuration file - -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) - -```shell - V..... h263_cuvid Nvidia CUVID H263 decoder (codec h263) - V..... h264_cuvid Nvidia CUVID H264 decoder (codec h264) - V..... hevc_cuvid Nvidia CUVID HEVC decoder (codec hevc) - V..... mjpeg_cuvid Nvidia CUVID MJPEG decoder (codec mjpeg) - V..... mpeg1_cuvid Nvidia CUVID MPEG1VIDEO decoder (codec mpeg1video) - V..... mpeg2_cuvid Nvidia CUVID MPEG2VIDEO decoder (codec mpeg2video) - V..... mpeg4_cuvid Nvidia CUVID MPEG4 decoder (codec mpeg4) - V..... vc1_cuvid Nvidia CUVID VC1 decoder (codec vc1) - V..... vp8_cuvid Nvidia CUVID VP8 decoder (codec vp8) - V..... vp9_cuvid Nvidia CUVID VP9 decoder (codec vp9) -``` - -For example, for H265 video (hevc), you'll select `hevc_cuvid`. Add -`-c:v hevc_cuvid` to your ffmpeg input arguments: - -```yaml -ffmpeg: - input_args: ... - - -c:v - - hevc_cuvid -``` - -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 -processes: - -``` -+-----------------------------------------------------------------------------+ -| NVIDIA-SMI 455.38 Driver Version: 455.38 CUDA Version: 11.1 | -|-------------------------------+----------------------+----------------------+ -| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC | -| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | -| | | MIG M. | -|===============================+======================+======================| -| 0 GeForce GTX 166... Off | 00000000:03:00.0 Off | N/A | -| 38% 41C P2 36W / 125W | 2082MiB / 5942MiB | 5% Default | -| | | N/A | -+-------------------------------+----------------------+----------------------+ - -+-----------------------------------------------------------------------------+ -| Processes: | -| GPU GI CI PID Type Process name GPU Memory | -| ID ID Usage | -|=============================================================================| -| 0 N/A N/A 12737 C ffmpeg 249MiB | -| 0 N/A N/A 12751 C ffmpeg 249MiB | -| 0 N/A N/A 12772 C ffmpeg 249MiB | -| 0 N/A N/A 12775 C ffmpeg 249MiB | -| 0 N/A N/A 12800 C ffmpeg 249MiB | -| 0 N/A N/A 12811 C ffmpeg 417MiB | -| 0 N/A N/A 12827 C ffmpeg 417MiB | -+-----------------------------------------------------------------------------+ -``` diff --git a/docs/sidebars.js b/docs/sidebars.js index 39346c107..d8a3f5b98 100644 --- a/docs/sidebars.js +++ b/docs/sidebars.js @@ -22,7 +22,6 @@ module.exports = { "configuration/stationary_objects", "configuration/advanced", "configuration/hardware_acceleration", - "configuration/nvdec", "configuration/camera_specific", ], Integrations: [