-
-
Notifications
You must be signed in to change notification settings - Fork 46
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
Nvidia GPU features not working #79
Comments
you might need to get an ffmpeg build with GPU enabled or install a video codec SDK. The GPU stuff is only tested on Windows. |
@izevar did you try the above steps? Did they work? Could you please give us an update? Thank you! |
im not having any performance issues , but is intel quicksync supported under docker. btw im using raw and having no issues at all. just trying to make sure it uses as little resources as possible. |
we're working on quicksync under docker. Nothing will beat raw for encoding
though.
…On Tue, Nov 10, 2020 at 5:56 PM stripeyhorse ***@***.***> wrote:
im not having any performance issues , but is intel quicksync supported
under docker.
btw im using raw and having no issues at all. just trying to make sure it
uses as little resources as possible.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#79 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAGDKXIH6EB3FVN73CSOKR3SPEE4ZANCNFSM4TF2GKTA>
.
|
@doitandbedone test version here for linux h264 support |
Perfect. I'll give it a try.
Thanks!
…On Thu, Nov 12, 2020, 11:38 PM sean tearney ***@***.***> wrote:
@doitandbedone <https://github.com/doitandbedone> test version here for
linux h264 support
https://ispyrtcdata.blob.core.windows.net/downloads/Agent_Linux64_H264.zip
see server settings and you can set the Codec to H264 on the General tab.
Then set the encoder on the recording tab on the camera to use quicksync
and if the drivers are installed properly it should use them. See the logs
for messages. Specifically on Agent startup if quicksync is going to work
there should be a message about it under
"Hardware Support"
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#79 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AORTFNBCCXDGVX7KVUQ5SLTSPTO6LANCNFSM4TF2GKTA>
.
|
Sorry for the delay, been having issues lately with the sever, spent the last few days to put it back up and not lose any of my data phew. So back to almost normal but still need to do a few other things. If everything goes well I should be able to run a test tomorrow. I really appreciate all the help and effort you're putting into this! |
Hi there, If I log into the container via shell and retry dotnet /agent/Agent.dll, I get an ffmpeg output like this: Init FFmpeg I can run some tests for you on my server if this helps us speed up the resolution. Best regards, |
you need to use a build of ffmpeg that has the libraries instead of the static binaries - agent uses the libraries like avutil.56 not the ffmpeg binary file. also to decode using the gpu you need to select GPU on the decoder options under the video source settings.. and you'd need to use the build of agent that i uploaded up there ^^ somewhere |
Yes, that's where I left off as well. Seems the recommended ffmpeg repo has other libraries included. I was using the logs to try and install all the ones it complained about and use the compilation flags for it too. Still a work in progress though. The build is posted in an earlier comment, you will have to modify the current Dockerfile to make use of the new build however. Once the version is ready I'll make it available more publicly. |
Do you have it working? It works fine on Windows so in theory should be OK on Docker. As long as the ffmpeg parts are there |
Not yet, ffmpeg is proving to be the most challenging part so far, but then again, haven't been able to get back to it, there's two branches I created if you want to take a look. |
I'm not 100% certain you need to rebuild it. If it can save to mp4 using the h264 codec then it should be able to use the gpu if the codecs are available |
So I finally had to time to run it, ran into a few issues (dirvers/cuda version) but all resolved, however, it still prefers software. I do see a warning: And a few errors/warnings:
I followed setup as instructed:
Full logs: |
if you set LogFFMPEGLevel in the media/xml/config.xml file to 48 ffmpeg
should write a whole load of debug to the logs.
<Logging LogFFMPEGLevel="48" LogWebRTCLevel="5" />
…On Mon, Nov 23, 2020 at 1:58 PM doitandbedone ***@***.***> wrote:
So I finally had to time to run it, ran into a few issues (dirvers/cuda
version) but all resolved, however, it still prefers software. I do see a
warning:
�[37m�[40mWarning: h264 compatible version of ffmpeg must be installed to
use H264 encoding
Do I need another version, or is this just a friendly warning?
And a few errors/warnings:
�[37m�[40mParking: Failed to create specified HW device.
�[32m�[40m[h264 @ 0x14c03403ba40] A hardware frames or device context is required for hardware accelerated decoding.
�[32m�[40m[h264 @ 0x14c03403ba40] Failed setup for format vaapi_vld: hwaccel initialisation returned error.
�[37m�[40mParking: Failed to create specified HW device.
�[32m�[40m[h264 @ 0x14c03403ba40] A hardware frames or device context is required for hardware accelerated decoding.
�[32m�[40m[h264 @ 0x14c03403ba40] Failed setup for format vaapi_vld: hwaccel initialisation returned error.
I followed setup as instructed:
- Set server settings to Codec H264/MP4/MP3
[image: Screen Shot 2020-11-22 at 9 50 03 PM]
<https://user-images.githubusercontent.com/61026996/99932641-8985bc80-2d0d-11eb-8ade-7ccd5af9adf6.png>
- Set Recording to quicksync
[image: Screen Shot 2020-11-22 at 9 50 21 PM]
<https://user-images.githubusercontent.com/61026996/99932658-91ddf780-2d0d-11eb-949e-492d4af91fa4.png>
Additionally, I tried going into Video Source (camera settings) and
change Decoder to GPU (used FFMPEG as well), but no luck on either.
[image: Screen Shot 2020-11-22 at 9 51 25 PM]
<https://user-images.githubusercontent.com/61026996/99932673-9d312300-2d0d-11eb-9ff2-a1dd731fe9b8.png>
[image: Screen Shot 2020-11-22 at 9 51 32 PM]
<https://user-images.githubusercontent.com/61026996/99932674-9dc9b980-2d0d-11eb-950c-1c13763fd36c.png>
Full logs:
nvidia-docker-ispy-error.zip
<https://github.com/doitandbedone/ispyagentdvr-docker/files/5581268/nvidia-docker-ispy-error.zip>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#79 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAGDKXNGRRIIZXXSOJZQQGLSRH22FANCNFSM4TF2GKTA>
.
|
Woah, after enabling more logs it goes haywire, it gets so overwhelming it starts to freeze the server... Anyhow, had to kill the container and collect logs afterwards. The container also seems to stay fine, so got the logs from it as well. They seem to be truncated given the huge amount of data. |
It's missing the connection logs where it complains about creating the hardware context. Stop the camera, make sure its all set up to use the gpu, start it and stop it and then save off the logs. |
GPU support isn't available on docker on windows, which is my dev environment :( With docker on linux it seems you have to forward the device to the container for it to be able to access it like: also |
Yes, I'm using the special nvidia cuda container:
One thing I noticed however, seems the ffmpeg does not have cuda enabled: I noticed since I tried using the available libx264: Output: Perhaps ffmpeg needs to be rebuild to enable cuda acceleration? |
i've got it working on my linux test box on ubuntu 18, hardware encode h264
and decode using vaapi, needed quite a lot of code changes. Will have an
update soon. Testing on OSX/ VP8 etc.
…On Thu, Dec 3, 2020 at 11:31 PM doitandbedone ***@***.***> wrote:
Yes, I'm using the special nvidia cuda container:
https://github.com/NVIDIA/nvidia-docker
And I am passing the GPU over, I can actually see it in the container when
running nvidia-smi.
One thing I noticed however, seems the ffmpeg does not have cuda enabled:
Hardware acceleration methods: vdpau vaapi drm opencl
I noticed since I tried using the available libx264:
#> ffmpeg -y -vsync 0 -hwaccel cuda -hwaccel_output_format cuda -i
11_TimeLapse_2020-12-03_07-04-43.mp4 -c:a copy -c:v libx264 -b:v 5M
output.mp4 Device creation failed: -12. [h264 @ 0x5636e258bd80] No device
available for decoder: device type cuda needed for codec h264.
Output:
Stream mapping: Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Device setup failed for decoder on input stream #0:0 : Cannot allocate
memory
Perhaps ffmpeg needs to be rebuild to enable cuda acceleration?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#79 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAGDKXMOBPI3KPGRP3QOMJTSS6VNRANCNFSM4TF2GKTA>
.
|
here's an updated version - use this and set the recorder mode to GPU and the codec in settings to h264 |
Wow, you beat me to it.. I'll try it, give me a few mins. |
Did you take any extra steps to get it working? Seems it's not using the GPU, however, I turn everything off and rebooted to see starting logs, I see this:
I tried a standalone command: Output:
I'm thinking compatibility issues with the card? Or somehow missing something that is not letting the card be seen? I do get a good output with nvidia-smi thoug,h as shown before. |
So I went back to your comment earlier on passing the devices. I guess internally it's looking for
I then tried --device /dev/nvidia0:/dev/video0
But as you may have noticed, it then goes onto /dev/video1. Not too sure about that "invalid argument" though. P.S.: Do note that the devices are being forwarded by nvidia onto the container without the need of --device, the print was in fact from inside the container (and it prints the same on the host machine), they are just referenced differently within agent's commands/libs. |
i've been concentrating on getting it working on linux, should work on docker as long as the devices are forwarded into the container. maybe this will help: |
Right, I mean at the end of the day docker container is running ubuntu 18.04. The question again is what the devices ffplay is expecting in what order. The nvidia runtime forwards with the naming printed above. But ffplay seems to be using /dev0, /dev1 not too sure what those are supposed to be mapped to. nvidia-uvm, nvidia-actl, nvidia-0, etc |
@rb2k would you be able to help us out here how you got the gpu working under docker? |
The mesa-va-drivers will just help with open source drivers (intel, amd). https://github.com/blakeblackshear/frigate/blob/master/docker/Dockerfile.amd64nvidia#L17-L47 |
Oh yup... I know all about it. But it essentially comes down to installing drivers on your host machine and either using the nvidia runtime for any base image or the cuda base image that comes with the included runtime. From there there's the --runtime nvidia flag and the environment variables to expose the GPU and its capabilities. All done and check working. |
Vaapi is a wrapper.. It should work with cuda. The message about cuda not available in the logs is from opencv saying it wasn't built with cuda support (because that adds about 300mb to the size of it). |
Right, that's why I was looking on the ffmpeg side but needs to be rebuilt to add support for it. Vaapi still uses Cuda under the hood? I thought it was just an alternative and cuda wasn't needed. |
I'm not sure about that, I guess so, when I run it on windows it lists CUDA as an option but that is using a different build of ffmpeg. |
Just so we're clear and have no differences:
Ubuntu 18.04
Nvidia Card (I have 750 TI, drivers 440.59)
Special build of Agent previously linked
Codec H264
Encoder GPU
Decoder GPU
ffmpeg Jonathon's PPA (Although we know there's a difference here)
…On Sun, Dec 6, 2020, 2:17 PM sean tearney ***@***.***> wrote:
I'm not sure about that, I guess so, when I run it on windows it lists
CUDA as an option but that is using a different build of ffmpeg.
I don't think the build of ffmpeg is the issue though as it's (vaapi)
working fine on my linux box for decode and encode (not under docker but
with all the same libraries)
[image: Screenshot from 2020-12-07 06-13-31]
<https://user-images.githubusercontent.com/800093/101294635-baa8d580-3853-11eb-875b-5fda95f0020c.png>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#79 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AORTFND3SHI7TJ2UMWWAGDTSTP7F5ANCNFSM4TF2GKTA>
.
|
That's all the same except I haven't got an nvidia card in this box, it's
just using the intel graphics drivers on the chip. So Codec H264 in
settings then set the decoder to GPU on the General tab when you edit the
camera and Encoder to GPU on the Recording tab.
On Mon, Dec 7, 2020 at 7:29 AM doitandbedone <[email protected]>
wrote:
… Just so we're clear and have no differences:
Ubuntu 18.04
Nvidia Card (I have 750 TI, drivers 440.59)
Special build of Agent previously linked
Codec H264
Encoder GPU
Decoder GPU
ffmpeg Jonathon's PPA (Although we know there's a difference here)
On Sun, Dec 6, 2020, 2:17 PM sean tearney ***@***.***>
wrote:
> I'm not sure about that, I guess so, when I run it on windows it lists
> CUDA as an option but that is using a different build of ffmpeg.
> I don't think the build of ffmpeg is the issue though as it's (vaapi)
> working fine on my linux box for decode and encode (not under docker but
> with all the same libraries)
>
> [image: Screenshot from 2020-12-07 06-13-31]
> <
https://user-images.githubusercontent.com/800093/101294635-baa8d580-3853-11eb-875b-5fda95f0020c.png
>
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <
#79 (comment)
>,
> or unsubscribe
> <
https://github.com/notifications/unsubscribe-auth/AORTFND3SHI7TJ2UMWWAGDTSTP7F5ANCNFSM4TF2GKTA
>
> .
>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#79 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAGDKXI7EKMPFFCRXLJ5F4LSTQHV5ANCNFSM4TF2GKTA>
.
|
Oh, I thought you did have an nvidia card. That's vastly different. And
yes, everything is as stated. Tough luck :(
…On Sun, Dec 6, 2020, 3:43 PM sean tearney ***@***.***> wrote:
That's all the same except I haven't got an nvidia card in this box, it's
just using the intel graphics drivers on the chip. So Codec H264 in
settings then set the decoder to GPU on the General tab when you edit the
camera and Encoder to GPU on the Recording tab.
On Mon, Dec 7, 2020 at 7:29 AM doitandbedone ***@***.***>
wrote:
> Just so we're clear and have no differences:
> Ubuntu 18.04
> Nvidia Card (I have 750 TI, drivers 440.59)
> Special build of Agent previously linked
> Codec H264
> Encoder GPU
> Decoder GPU
> ffmpeg Jonathon's PPA (Although we know there's a difference here)
>
> On Sun, Dec 6, 2020, 2:17 PM sean tearney ***@***.***>
> wrote:
>
> > I'm not sure about that, I guess so, when I run it on windows it lists
> > CUDA as an option but that is using a different build of ffmpeg.
> > I don't think the build of ffmpeg is the issue though as it's (vaapi)
> > working fine on my linux box for decode and encode (not under docker
but
> > with all the same libraries)
> >
> > [image: Screenshot from 2020-12-07 06-13-31]
> > <
>
https://user-images.githubusercontent.com/800093/101294635-baa8d580-3853-11eb-875b-5fda95f0020c.png
> >
> >
> > —
> > You are receiving this because you were mentioned.
> > Reply to this email directly, view it on GitHub
> > <
>
#79 (comment)
> >,
> > or unsubscribe
> > <
>
https://github.com/notifications/unsubscribe-auth/AORTFND3SHI7TJ2UMWWAGDTSTP7F5ANCNFSM4TF2GKTA
> >
> > .
> >
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> <
#79 (comment)
>,
> or unsubscribe
> <
https://github.com/notifications/unsubscribe-auth/AAGDKXI7EKMPFFCRXLJ5F4LSTQHV5ANCNFSM4TF2GKTA
>
> .
>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#79 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AORTFNGSADS4776NJSEBUHLSTQJKZANCNFSM4TF2GKTA>
.
|
whats the console output from start to decode/ encode with GPU enabled? |
apt install mesa-va-drivers |
When running it, it says it's up to date. I can try a non nvidia runtime
and see if it works. It's required for pasthrough though.
…On Sun, Dec 6, 2020, 5:01 PM sean tearney ***@***.***> wrote:
apt install mesa-va-drivers
should be added to the docker file though right for it to work with gpu
under other devices
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#79 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AORTFNHTSNKKJ5BGZR673DDSTQSNDANCNFSM4TF2GKTA>
.
|
Hey guys, happy New Year! any update on this? Thanks |
@oriol73 Sorry for the late reply and Happy New Year as well! Unfortunately, no advances have been done on this. But will post any developments in this topic as soon as we find them. For the time being, we still recommend using raw for fastest results. |
Hi guys, I’m also wondering if there’s any update on this ? |
@doitandbedone bearing in mind i know next to nothing about docker, there's a deploy command in this example that seems to give deepstack access to the gpu, is this something that could be used to open up the gpu to agent in docker? |
Right, the problem is not pass-through/access to the GPU, I was able to
achieve that, the problem was ispy/ffmpeg taking use of it. It came down to
having ffmpeg being recompiled to use nvidia's codec/decoder but since it
has other dependencies it became overwhelming.
If you have suggestions on building ffmpeg or another pre built repo with
nvidia support then I can revisit this.
As for the other one. The access is for deepstack itself. Their image seems
to have support for nvidia GPU's.
…On Wed, Mar 24, 2021, 8:02 PM sean tearney ***@***.***> wrote:
@doitandbedone <https://github.com/doitandbedone> bearing in mind i know
next to nothing about docker, there's a deploy command in this example that
seems to give deepstack access to the gpu, is this something that could be
used to open up the gpu to agent in docker?
#197 <#197>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#79 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AORTFNDEWVYL4EUMALR5YO3TFKRS5ANCNFSM4TF2GKTA>
.
|
there is this |
@doitandbedone there's a docker container with ffmpeg already compiled with nvidia libraries here:
example: You can leave this container up and running with: and then ffmpeg binaries/libraries could be shared/cloned from ffmpeg container to agentdvr container....then adding the right PATH env, and start using them. Would this help? |
Thanks for sharing! Been a while since I last tried, the main problem was
besides nvidia compatibility there were some extras for ispy to work. I'll
give it a try!
…On Mon, Mar 29, 2021 at 11:15 AM oriol73 ***@***.***> wrote:
@doitandbedone <https://github.com/doitandbedone> there's a docker
container with ffmpeg already compiled with nvidia libraries here:
- https://github.com/jrottenberg/ffmpeg
- https://hub.docker.com/r/jrottenberg/ffmpeg
scroll down to --> Use nvidia hardware acceleration enabled build
example:
docker run --runtime=nvidia jrottenberg/ffmpeg:4.1-nvidia -hwaccel cuvid
-c:v h264_cuvid -i INPUT -vf scale_npp=-1:720 -c:v h264_nvenc -preset slow
OUTPUT
You can leave this container up and running with:
docker run --runtime=nvidia -it --entrypoint='bash'
jrottenberg/ffmpeg:4.1-nvidia
and then ffmpeg binaries/libraries could be shared/cloned from ffmpeg
container to agentdvr container....then adding the right PATH env, and
start using them.
Would this help?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#79 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AORTFNFFSWMXMA5SQIPTHNTTGDGT7ANCNFSM4TF2GKTA>
.
|
@doitandbedone I've read on iSpy release notes that for Linux installation it's required an ffmeg distribution, required from specific PPAs: jonathonf/ffmpeg-4 or savoury1/ffmpeg4 . Checking savoury1/ffmpeg4 PPA description here https://launchpad.net/~savoury1/+archive/ubuntu/ffmpeg4 , seems that this is already compiled with nvidia hardware support: * nVidia display hardware: FFmpeg at this PPA is built with nv-codec-headers allowing hardware-accelerated video encoding and decoding using recent enough nVidia GPUs. The version of nv-codec-headers used (9.1.23) requires at least version 435.21 or newer of the nVidia proprietary display drivers. For newer nVidia drivers than official Ubuntu repos see the Ubuntu "Graphics Drivers" team PPA here: https://launchpad.net/~graphics-drivers/+archive/ubuntu/ppa Have you considered to configure your dockerfile with savoury1/ffmpeg4 PPA instead of jonathonf/ffmpeg-4 ? Furthermore, if this works well, you won't need a different tag for nvidia setup, having one single version of the container as this PPA seems verified by iSPY. |
@oriol73 I had actually already looked into this. There's a branch called feature/simple-ffmpeg-nvidia. Back then it still didn't work, but there's been multiple updates. You can check it out. At the moment I'm swamped but as soon as I get a chance I can revisit it. |
I think I was able to get a container that uses hardware accelerated video decoding. I'll paste my Dockerfile below, but the highlights are:
The deb-multimedia version of ffmpeg seems to fit the bill. It has various Nvidia hardware acceleration features enabled, and it's not built statically so it contains the required libraries. Now when I run my custom Docker container, I see in the log:
And I also see an entry in nvidia-smi, showing that dotnet is using 67MiB on the GPU. However, CPU usage still seems to be higher than I would've thought, so I'm not sure everything is working correctly. Anyway, the Dockerfile I used is:
|
@theaccountforjake Do appreciate all the work, however, I'm afraid I can't use a non-free and also experimental/unofficial repo. Will keep looking for alternatives however. |
@doitandbedone That's a good point. Does usage of CUDA or other HW acceleration require the Nvidia's instructions for building (https://docs.nvidia.com/video-technologies/video-codec-sdk/ffmpeg-with-nvidia-gpu/) use the non-free option, unfortunately. |
Still a little bit of a grey area for me as well, since this is for ffmpeg. The repo didn't have much details to be honest. As for nvidia, last I found out was that it's open source (free) vs closed source (nvivida nonfree). These are available for everyone but not sure if there's any other licensing caveats in there, didn't find any. Once you get to the codecs there's some very tricky licensing schemes. This is why I went to use their CUDA images and that makes it work, but then ffmpeg became the issue. |
Check in on this - any update? I'm super interested in GPU support in the Docker, but unclear how I can assist. |
For those interested, here's a Dockerfile I put together for Ubuntu 22.04. You need to have your docker setup for nvidia as per: https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html
|
Hello
Seem that all GPU related features are not working:
GPU decoding
GPU encoding
Object detection
There is any extra step needed to enable it ?
The text was updated successfully, but these errors were encountered: