datarhei / restreamer

The Restreamer is a complete streaming server solution for self-hosting. It has a visually appealing user interface and no ongoing license costs. Upload your live stream to YouTube, Twitch, Facebook, Vimeo, or other streaming solutions like Wowza. Receive video data from OBS and publish it with the RTMP and SRT server.
https://docs.datarhei.com/restreamer/
Apache License 2.0
3.78k stars 438 forks source link

How to make restreamer work with hardware encoding/decodig cuda etc. #419

Open FilipStadler opened 1 year ago

FilipStadler commented 1 year ago

I run restreamer on Linux, On WSL2 and RaspberryPI4 (Raspbian 32bit with gpu) but on the other I only use passtru to avoid GPU encoding but its a problem the cpu load is around 75% and sure it would be alot cooler if the hardware encoding was working for me.

But why is not working ?

I use GTX1660TI ( windows wsl2) and GTX1660 super with latest nvidia drivers on PopOS(Ubuntu 22.04)

For some reason it depends cuda something API but I am stuck because why is cuda needed by restreamer when other programs can do encoding/deconding ?

I need a guide on howto add the cuda support and possible simular for

Using nvidia-smi get something that says cuda 11.7

Sun Sep 18 11:02:34 2022
+-----------------------------------------------------------------------------+ | NVIDIA-SMI 515.65.01 Driver Version: 515.65.01 CUDA Version: 11.7 | |-------------------------------+----------------------+----------------------+ | 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 NVIDIA GeForce ... Off | 00000000:02:00.0 Off | N/A | | 5% 53C P8 24W / 125W | 662MiB / 6144MiB | 27% Default | | | | N/A | +-------------------------------+----------------------+----------------------+

Simular nvidia-smi On my wsl2 it says Driver 516.94 also cuda 11.7

I did find a guide to install cuda (tool kit)

https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64&Distribution=Ubuntu&target_version=22.04&target_type=deb_local

After that i installed restreamer for nvidia and but is it possible that it only works with cuda 11.4 and not 11.7 ?

I get the following errors

@1663619792 Duration: N/A, start: 373.607667, bitrate: N/A @1663619792 Program 0 @1663619792 Metadata: @1663619792 variant_bitrate : 4793958 @1663619792 Stream #0:0: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc @1663619792 Metadata: @1663619792 variant_bitrate : 4793958 @1663619792 Stream #0:1: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp @1663619792 Metadata: @1663619792 variant_bitrate : 4793958 @1663619792 [AVHWDeviceContext] Cannot load libcuda.so.1 @1663619792 [AVHWDeviceContext] Could not dynamically load CUDA @1663619792 Device creation failed: -1313558101. @1663619792 [h264 ] No device available for decoder: device type cuda needed for codec h264. @1663619792 Stream mapping:

Have anyone made hardware decoding/encoding work with succes ?

svenerbeck commented 1 year ago

Hello Filip Thank you for your patience. We'll have a look ...

Cheerio Sven

jstabenow commented 1 year ago

Hey @FilipStadler Maybe it's the CUDA version. We use 11.4, and you use 11.7. I will create a suitable image for you to test and let you know here.

FilipStadler commented 1 year ago

Hey @FilipStadler Maybe it's the CUDA version. We use 11.4, and you use 11.7. I will create a suitable image for you to test and let you know here.

Yes lets try because I have cuda 11.7 on two computers - a windows10 with wsl and a my normal ubuntu/popos. I did tried srt with hvec and the larix broadcaster and it was not working so i changed to h264 on the transmitting device and it was working so maybe this is also related to the problem. But it would surely be nice to have the gpu power working.

Tokolosh commented 1 year ago

i am having the same issues with Cuda 11.7 (RTX 2080Ti with the 515 Driverset) on a linux machine. No matter which cuda option i choose for de-/coding it always throws the same error mentioned above

Tokolosh commented 1 year ago

@jstabenow Any Updates on a test version with cuda 11.7?

jstabenow commented 1 year ago

Please check the latest datarhei/restreamer:cuda-latest image. It's now CUDA v11.7.1