Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Used windows PC with Nvidia card and Frigate (docker)- how I can make it Frigate work and used Nvidia card? #1847

Closed
antonbek89 opened this issue Sep 25, 2021 · 12 comments
Labels

Comments

@antonbek89
Copy link

Hi
So I used a PC with Nvidia card and I want to use this PC for Frigate under docker

I already saw this option -

blakeblackshear/frigate:stable-amd64nvidia

But How I run it after the pull? with docker-compose ? how I can be sure the Frigate used the Nvidia card?

@antonbek89 antonbek89 changed the title Used windows PC with Nvidia card and docker - how I can make it work toghter and used Nvidia card? Used windows PC with Nvidia card and Frigate (docker)- how I can make it Frigate work and used Nvidia card? Sep 25, 2021
@ozett
Copy link

ozett commented Sep 26, 2021

@blthlt
Copy link

blthlt commented Sep 27, 2021

It would be nice if there was a step by step guide for this.. I've been trying to get this to work on my system for a week. The document listed above seems to be missing some information. We have to remember not everyone is a Linux guru.

@ozett
Copy link

ozett commented Sep 27, 2021

yeah, your right.
i remember that it was a lot of fiddling for me too.
i can not fully remember details, but critial was to follow the nivdia-guide for the nvidia-docker.
🤔
i think i followed the guide to install the nvidia-container:
https://docs.nvidia.com/datacenter/cloud-native/driver-containers/overview.html

@spattinson
Copy link

spattinson commented Sep 30, 2021

There is a shortcut to force home assistant to use amd64nvidia ffmpeg once you have met all prerequisites for passing gpu into container. Install the normal amd64 frigate add-on through home assistant. If you go to /config/addons/local you should find subdirectories one is frigate on mobile now, but have a look. Find the Dockerfile and edit it, replace ${ARCH} with amd64nvidia. Uninstall frigate in home assistant, then recheck Dockerfile has not change again, reinstall frigate and home assistant should pull the correct image. I have just done this upgrading to 0.9.0 beta and it worked great. At some points home assistant overwrites Dockerfile with default one, so dont do auto upgrades, repeat the above when you want to upgrade.

@spattinson
Copy link

Here are the exact steps I took to get nvidia decoding working on amd64 debian buster:

Install Debian Buster - enable non-free, contrib, backports during install

Install Nvidia driver (maybe not necessary since CUDA installs nvidia driver)
lspci
sudo apt -y install nvidia-detect
nvidia-detect
sudo apt install nvidia-driver
sudo reboot

Install CUDA
sudo apt-get install software-properties-common
sudo add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/debian10/x86_64/ /"
sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/debian10/x86_64/7fa2af80.pub
sudo add-apt-repository contrib
sudo apt-get update
sudo apt-get -y install cuda
A newer nvidia driver has been installed so...
sudo reboot

Install Docker
sudo apt-get update
sudo apt-get install
apt-transport-https
ca-certificates
curl
gnupg
lsb-release
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo
"deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
sudo reboot

Install CUDA Docker support
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
&& curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
&& curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list
sudo apt-get update
sudo apt-get install -y nvidia-docker2
sudo systemctl restart docker
sudo docker run --rm --gpus all nvidia/cuda:11.0-base nvidia-smi

Install Frigate
git clone ...
cd frigate
make amd64nvidia_all
sudo docker run -d --name frigate
--restart=unless-stopped
--mount type=tmpfs,target=/tmp/cache,tmpfs-size=1000000000
--device /dev/bus/usb:/dev/bus/usb
--device /dev/dri/renderD128
--device /dev/vpu_service
--device /dev/dri/card0
-v /home/scott/hassio/media:/media/frigate
-v /home/scott/hassio/homeassistant/frigate.yml:/config/config.yml:ro
-e FRIGATE_RTSP_PASSWORD='password'
-e NVIDIA_VISIBLE_DEVICES=all
-e NVIDIA_DRIVER_CAPABILITIES=compute,utility,video
-p 5000:5000
-p 1935:1935
--runtime=nvidia
--privileged
frigate

Check ffmpeg cpu use
htop

browse to
Install Hassio
sudo apt install jq
sudo ./install.sh -d /home/scott/hassio
sudo journalctl -f

@stale
Copy link

stale bot commented Oct 31, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Oct 31, 2021
@stale stale bot closed this as completed Nov 3, 2021
@antonbek89
Copy link
Author

@spattinson
Hi
Thanks for the steps guide

I have question about the Nvidia docker, the Nvidia Cuda docker must to install?

I ask it because I'm install Ubuntu 20.04 on the laptop (it's the host) and I can see Nvidia driver already installed automatically
When I'm running ffmpeg I can saw all the stuff belong to Nvidia card

So I'm wonder in my situation the Cuda docker must to have?

@SeaDude
Copy link

SeaDude commented Jul 5, 2022

Here are the exact steps I took to get nvidia decoding working on amd64 debian buster:

@spattinson Do you have any hdaccel_args set in your config.yml file to make this work?

@LordNex
Copy link

LordNex commented Aug 2, 2022

Has the NVDEC been added to the aarch distro yet for use on the Jetson Nano? The docks just still say it may be in the future and references this closed ticket

@josepescobarinditex
Copy link

I'm interested too compatibility with Jetson Nano... I tryed a lot of workarrounds without success

@caublet
Copy link

caublet commented Nov 9, 2022

@NickM-27
Copy link
Collaborator

NickM-27 commented Nov 9, 2022

Is it please possible to update tag for nvidia on dockerhub to update to 11.1 please?

ref: https://hub.docker.com/layers/blakeblackshear/frigate/stable-amd64nvidia/images/sha256-d91dc45bbc8d80f270430668a2a8983f5b22e203c3994545c68964b7b9f8dc8c?context=explore

Please read the docs and the release notes, there is no longer an nvidia specific tag as everything is built into the stable tag

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

9 participants