Please contact the owner of the site that linked you to the original URL and let them know their link is broken.
-
+
diff --git a/57316f1e.e0fa6872.js b/57316f1e.b42340c7.js
similarity index 99%
rename from 57316f1e.e0fa6872.js
rename to 57316f1e.b42340c7.js
index 4785e436e..af57f1312 100644
--- a/57316f1e.e0fa6872.js
+++ b/57316f1e.b42340c7.js
@@ -1 +1 @@
-(window.webpackJsonp=window.webpackJsonp||[]).push([[10],{79:function(e,n,t){"use strict";t.r(n),t.d(n,"frontMatter",(function(){return o})),t.d(n,"metadata",(function(){return a})),t.d(n,"toc",(function(){return d})),t.d(n,"default",(function(){return u}));var r=t(3),i=t(7),c=(t(0),t(98)),o={id:"nvdec",title:"nVidia hardware decoder"},a={unversionedId:"configuration/nvdec",id:"configuration/nvdec",isDocsHomePage:!1,title:"nVidia hardware decoder",description:"Certain nvidia cards include a hardware decoder, which can greatly improve the",source:"@site/docs/configuration/nvdec.md",slug:"/configuration/nvdec",permalink:"/frigate/configuration/nvdec",editUrl:"https://github.com/blakeblackshear/frigate/edit/master/docs/docs/configuration/nvdec.md",version:"current"},d=[{value:"Docker setup",id:"docker-setup",children:[{value:"Requirements",id:"requirements",children:[]},{value:"Setting up docker-compose",id:"setting-up-docker-compose",children:[]},{value:"Setting up the configuration file",id:"setting-up-the-configuration-file",children:[]}]}],p={toc:d};function u(e){var n=e.components,t=Object(i.a)(e,["components"]);return Object(c.b)("wrapper",Object(r.a)({},p,t,{components:n,mdxType:"MDXLayout"}),Object(c.b)("p",null,"Certain nvidia cards include a hardware decoder, which can greatly improve the\nperformance of video decoding. In order to use NVDEC, a special build of\nffmpeg with NVDEC support is required. The special docker architecture 'amd64nvidia'\nincludes this support for amd64 platforms. An aarch64 for the Jetson, which\nalso includes NVDEC may be added in the future."),Object(c.b)("h2",{id:"docker-setup"},"Docker setup"),Object(c.b)("h3",{id:"requirements"},"Requirements"),Object(c.b)("p",null,Object(c.b)("a",Object(r.a)({parentName:"p"},{href:"https://www.nvidia.com/en-us/drivers/unix/"}),"nVidia closed source driver")," required to access NVDEC.\n",Object(c.b)("a",Object(r.a)({parentName:"p"},{href:"https://github.com/NVIDIA/nvidia-docker"}),"nvidia-docker")," required to pass NVDEC to docker."),Object(c.b)("h3",{id:"setting-up-docker-compose"},"Setting up docker-compose"),Object(c.b)("p",null,"In order to pass NVDEC, the docker engine must be set to ",Object(c.b)("inlineCode",{parentName:"p"},"nvidia")," and the environment variables\n",Object(c.b)("inlineCode",{parentName:"p"},"NVIDIA_VISIBLE_DEVICES=all")," and ",Object(c.b)("inlineCode",{parentName:"p"},"NVIDIA_DRIVER_CAPABILITIES=compute,utility,video")," must be set."),Object(c.b)("p",null,"In a docker compose file, these lines need to be set:"),Object(c.b)("pre",null,Object(c.b)("code",Object(r.a)({parentName:"pre"},{}),"services:\n frigate:\n ...\n image: blakeblackshear/frigate:stable-amd64nvidia\n runtime: nvidia\n environment:\n - NVIDIA_VISIBLE_DEVICES=all\n - NVIDIA_DRIVER_CAPABILITIES=compute,utility,video\n")),Object(c.b)("h3",{id:"setting-up-the-configuration-file"},"Setting up the configuration file"),Object(c.b)("p",null,"In your frigate config.yml, you'll need to set ffmpeg to use the hardware decoder.\nThe decoder you choose will depend on the input video."),Object(c.b)("p",null,"A list of supported codecs (you can use ",Object(c.b)("inlineCode",{parentName:"p"},"ffmpeg -decoders | grep cuvid")," in the container to get a list)"),Object(c.b)("pre",null,Object(c.b)("code",Object(r.a)({parentName:"pre"},{})," V..... h263_cuvid Nvidia CUVID H263 decoder (codec h263)\n V..... h264_cuvid Nvidia CUVID H264 decoder (codec h264)\n V..... hevc_cuvid Nvidia CUVID HEVC decoder (codec hevc)\n V..... mjpeg_cuvid Nvidia CUVID MJPEG decoder (codec mjpeg)\n V..... mpeg1_cuvid Nvidia CUVID MPEG1VIDEO decoder (codec mpeg1video)\n V..... mpeg2_cuvid Nvidia CUVID MPEG2VIDEO decoder (codec mpeg2video)\n V..... mpeg4_cuvid Nvidia CUVID MPEG4 decoder (codec mpeg4)\n V..... vc1_cuvid Nvidia CUVID VC1 decoder (codec vc1)\n V..... vp8_cuvid Nvidia CUVID VP8 decoder (codec vp8)\n V..... vp9_cuvid Nvidia CUVID VP9 decoder (codec vp9)\n")),Object(c.b)("p",null,"For example, for H265 video (hevc), you'll select ",Object(c.b)("inlineCode",{parentName:"p"},"hevc_cuvid"),". Add\n",Object(c.b)("inlineCode",{parentName:"p"},"-c:v hevc_covid")," to your ffmpeg input arguments:"),Object(c.b)("pre",null,Object(c.b)("code",Object(r.a)({parentName:"pre"},{}),"ffmpeg:\n input_args:\n ...\n - -c:v\n - hevc_cuvid\n")),Object(c.b)("p",null,"If everything is working correctly, you should see a significant improvement in performance.\nVerify that hardware decoding is working by running ",Object(c.b)("inlineCode",{parentName:"p"},"nvidia-smi"),", which should show the ffmpeg\nprocesses:"),Object(c.b)("pre",null,Object(c.b)("code",Object(r.a)({parentName:"pre"},{}),"+-----------------------------------------------------------------------------+\n| NVIDIA-SMI 455.38 Driver Version: 455.38 CUDA Version: 11.1 |\n|-------------------------------+----------------------+----------------------+\n| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |\n| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |\n| | | MIG M. |\n|===============================+======================+======================|\n| 0 GeForce GTX 166... Off | 00000000:03:00.0 Off | N/A |\n| 38% 41C P2 36W / 125W | 2082MiB / 5942MiB | 5% Default |\n| | | N/A |\n+-------------------------------+----------------------+----------------------+\n\n+-----------------------------------------------------------------------------+\n| Processes: |\n| GPU GI CI PID Type Process name GPU Memory |\n| ID ID Usage |\n|=============================================================================|\n| 0 N/A N/A 12737 C ffmpeg 249MiB |\n| 0 N/A N/A 12751 C ffmpeg 249MiB |\n| 0 N/A N/A 12772 C ffmpeg 249MiB |\n| 0 N/A N/A 12775 C ffmpeg 249MiB |\n| 0 N/A N/A 12800 C ffmpeg 249MiB |\n| 0 N/A N/A 12811 C ffmpeg 417MiB |\n| 0 N/A N/A 12827 C ffmpeg 417MiB |\n+-----------------------------------------------------------------------------+\n")),Object(c.b)("p",null,"To further improve performance, you can set ffmpeg to skip frames in the output,\nusing the fps filter:"),Object(c.b)("pre",null,Object(c.b)("code",Object(r.a)({parentName:"pre"},{})," output_args:\n - -filter:v\n - fps=fps=5\n")),Object(c.b)("p",null,"This setting, for example, allows Frigate to consume my 10-15fps camera streams on\nmy relatively low powered Haswell machine with relatively low cpu usage."))}u.isMDXComponent=!0},98:function(e,n,t){"use strict";t.d(n,"a",(function(){return l})),t.d(n,"b",(function(){return m}));var r=t(0),i=t.n(r);function c(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function a(e){for(var n=1;n=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var p=i.a.createContext({}),u=function(e){var n=i.a.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):a(a({},n),e)),t},l=function(e){var n=u(e.components);return i.a.createElement(p.Provider,{value:n},e.children)},s={inlineCode:"code",wrapper:function(e){var n=e.children;return i.a.createElement(i.a.Fragment,{},n)}},f=i.a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,c=e.originalType,o=e.parentName,p=d(e,["components","mdxType","originalType","parentName"]),l=u(t),f=r,m=l["".concat(o,".").concat(f)]||l[f]||s[f]||c;return t?i.a.createElement(m,a(a({ref:n},p),{},{components:t})):i.a.createElement(m,a({ref:n},p))}));function m(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var c=t.length,o=new Array(c);o[0]=f;var a={};for(var d in n)hasOwnProperty.call(n,d)&&(a[d]=n[d]);a.originalType=e,a.mdxType="string"==typeof e?e:r,o[1]=a;for(var p=2;p=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var p=i.a.createContext({}),u=function(e){var n=i.a.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):a(a({},n),e)),t},l=function(e){var n=u(e.components);return i.a.createElement(p.Provider,{value:n},e.children)},s={inlineCode:"code",wrapper:function(e){var n=e.children;return i.a.createElement(i.a.Fragment,{},n)}},f=i.a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,c=e.originalType,o=e.parentName,p=d(e,["components","mdxType","originalType","parentName"]),l=u(t),f=r,m=l["".concat(o,".").concat(f)]||l[f]||s[f]||c;return t?i.a.createElement(m,a(a({ref:n},p),{},{components:t})):i.a.createElement(m,a({ref:n},p))}));function m(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var c=t.length,o=new Array(c);o[0]=f;var a={};for(var d in n)hasOwnProperty.call(n,d)&&(a[d]=n[d]);a.originalType=e,a.mdxType="string"==typeof e?e:r,o[1]=a;for(var p=2;pAdvanced | Frigate
-
+
@@ -22,7 +22,7 @@
Event and clip information is managed in a sqlite database at /media/frigate/clips/frigate.db. If that database is deleted, clips will be orphaned and will need to be cleaned up manually. They also won't show up in the Media Browser within HomeAssistant.
If you are storing your clips on a network share (SMB, NFS, etc), you may get a database is locked error message on startup. You can customize the location of the database in the config if necessary.
This may need to be in a custom location if network storage is used for clips.
The input and output parameters need to be adjusted for MJPEG cameras
input_args:
--avoid_negative_ts
- make_zero
--fflags
- nobuffer
--flags
- low_delay
--strict
- experimental
--fflags
- +genpts+discardcorrupt
--r
-'3'# <---- adjust depending on your desired frame rate from the mjpeg image
--use_wallclock_as_timestamps
-'1'
Note that mjpeg cameras require encoding the video into h264 for clips, recording, and rtmp roles. This will use significantly more CPU than if the cameras supported h264 feeds directly.
The default config will look for a USB Coral device. If you do not have a Coral, you will need to configure a CPU detector. If you have PCI or multiple Coral devices, you need to configure your detector devices in the config file. When using multiple detectors, they run in dedicated processes, but pull from a common queue of requested detections across all cameras.
Tune your object filters to adjust false positives: min_area, max_area, min_score, threshold.
For object filters in your configuration, any single detection below min_score will be ignored as a false positive. threshold is based on the median of the history of scores (padded to 3 values) for a tracked object. Consider the following frames when min_score is set to 0.6 and threshold is set to 0.85:
Frame
Current Score
Score History
Computed Score
Detected Object
1
0.7
0.0, 0, 0.7
0.0
No
2
0.55
0.0, 0.7, 0.0
0.0
No
3
0.85
0.7, 0.0, 0.85
0.7
No
4
0.90
0.7, 0.85, 0.95, 0.90
0.875
Yes
5
0.88
0.7, 0.85, 0.95, 0.90, 0.88
0.88
Yes
6
0.95
0.7, 0.85, 0.95, 0.90, 0.88, 0.95
0.89
Yes
In frame 2, the score is below the min_score value, so frigate ignores it and it becomes a 0.0. The computed score is the median of the score history (padding to at least 3 values), and only when that computed score crosses the threshold is the object marked as a true positive. That happens in frame 4 in the example.
For HassOS installations, the default location for the config file is /config/frigate.yml.
For all other installations, the default location for the config file is '/config/config.yml'. This can be overridden with the CONFIG_FILE environment variable. Camera specific ffmpeg parameters are documented here.
It is recommended to start with a minimal configuration and add to it:
Each of your cameras must be configured. The following is the minimum required to register a camera in Frigate. Check the camera configuration page for a complete list of options.
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:
For example, for H265 video (hevc), you'll select hevc_cuvid. Add
--c:v hevc_covid to your ffmpeg input arguments:
ffmpeg:
input_args:
...
- -c:v
- hevc_cuvid
If everything is working correctly, you should see a significant improvement in performance.
+-c:v hevc_cuvid to your ffmpeg input arguments:
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:
To further improve performance, you can set ffmpeg to skip frames in the output,
using the fps filter:
output_args:
- -filter:v
- fps=fps=5
This setting, for example, allows Frigate to consume my 10-15fps camera streams on
my relatively low powered Haswell machine with relatively low cpu usage.