OBS Studio not picking up NVenc

OBS Studio not picking up NVenc

Postby petechristyuk » Jul 22nd, '19, 17:16

On Mageia-6, I loaded the CUDA drivers so that OBS Studio could off-load video encoding to the graphics card. This worked a treat, reducing the CPU load from around 90% to 25% (its a fairly old machine and Gfx card!).

On Mageia-7, I am no longer offered an NVenc encode option in OBS. All I get is x264 or ffmpeg-VAAPI. I don't have VAAPI installed, as this is an NVidia gpu!

Is anyone else experiencing this? ie: Has the program been compiled correctly, or is this something unique to my machine?

Cheers,

--
Pete
petechristyuk
 
Posts: 22
Joined: Feb 28th, '18, 14:27

Re: OBS Studio not picking up NVenc

Postby Kosh » Jul 23rd, '19, 14:52

Can you check if the vdpau-library is installed (via MCC or
Code: Select all
rpm -qa | grep vdpau
urpmq --list | grep vdpau
) and is loaded by de nvidia-driver? (xorg.0.log?)

If that's functioning okay, then I have no idea at the moment.
Kosh
 
Posts: 10
Joined: Mar 11th, '19, 17:00

Re: OBS Studio not picking up NVenc

Postby petechristyuk » Jul 23rd, '19, 17:41

Well, vdpauinfo is telling me all is well, and that hardware encoding is supported, as is cuda-z.

Looks like I may have to recompile from source rpms....

--
Pete
petechristyuk
 
Posts: 22
Joined: Feb 28th, '18, 14:27

Re: OBS Studio not picking up NVenc

Postby Kosh » Jul 23rd, '19, 19:47

You need the "nvidia-cuda-toolkit-devel"-package next to the "nvidia-cuda-toolkit" and possibly the samples as well...
I have blender running now with cuda enabled. Maybe not relevant here, but before I installed the devel-package it did not register cuda as well.

Hold on, this might not work either. I just install OBS. Where is this setting listed, under: output/streaming/encoder?
Did you select another preset than "same as stream" in recording quality?

Update: Can't seem to get it done either so far. Annoying....
Last edited by Kosh on Jul 23rd, '19, 21:39, edited 1 time in total.
Kosh
 
Posts: 10
Joined: Mar 11th, '19, 17:00

Re: OBS Studio not picking up NVenc

Postby petechristyuk » Jul 23rd, '19, 21:37

Yes, that's it. You can also set it under output/recording/encoder, but that defaults to the same as the streaming setting.

On M6, there were two options, x264 and NVenc. On M7, there are also two options, x264 and ffmpeg-vaapi, but I don't have vaapi installed! I'm wondering if the version released in M7 was compiled on a machine with AMD graphics, and hasn't got any of the NVidia stuff built in - hence my thought about re-compiling it.

--
Pete
petechristyuk
 
Posts: 22
Joined: Feb 28th, '18, 14:27

Re: OBS Studio not picking up NVenc

Postby wintpe » Jul 25th, '19, 16:35

OBS Studio can use ffmpeg and the cuda version has not been included with mga7.
But it seems OBS studio is not also aware that ffmpeg can be compiled with these different facilities, and so even with ffmpeg selected as the encoder still cant present the right options to
make ffmpeg encode using the graphics card.

had the same issue with ffmpeg as provided
im not sure what your use case for obs studio was , but i can say a similar application shotcut as supplied as an appimage from one of the appimage repos,
does have hevc_nvenc and h264_nvenc as hardware encoder options.

https://sourceforge.net/projects/shotcu ... e/download

to run, simply make executable and double click it.

alternatively if you just want to convert video formats as i do, then the following will be helpful, as it will provide a nvenc capable ffmpeg, which can change 0.20 frames a second to anything for example 200.

based on 1070ti


Code: Select all

"make sure the following is installed (or similar versions)"

rpm -qa|egrep 'cuda|nvidia'
dkms-nvidia-current-430.34-1.mga7.nonfree
x11-driver-video-nvidia-current-430.34-1.mga7.nonfree
nvidia-current-utils-430.34-1.mga7.nonfree
nvidia-cuda-toolkit-10.1.168-1.mga7.nonfree
nvidia-cuda-toolkit-devel-10.1.168-1.mga7.nonfree
nvidia-current-cuda-opencl-430.34-1.mga7.nonfree
nvidia-current-doc-html-430.34-1.mga7.nonfree

"you need the following downloaded ."

git clone https://github.com/FFmpeg/nv-codec-headers

wget https://ffmpeg.org/releases/ffmpeg-4.1.4.tar.gz

tar xvf ffmpeg-4.1.4.tar.gz

drwx------ 18 peter peter     4096 Jul 22 16:38 ffmpeg-4.1.4/
-rw-rw-r--  1 peter peter 10691784 Jul 22 16:35 ffmpeg-4.1.4.tar.bz2
drwxr-xr-x  4 peter peter     4096 Apr 15 16:17 nv-codec-headers/

"now build it  (the make installs need to be run as root, unless you choose your home area for install)"

cd nv-codec-headers

make

make install PREFIX=/opt/ffmpeg

cd ../ffmpeg-4.1.4

PKG_CONFIG_PATH="/opt/ffmpeg/lib/pkgconfig" ./configure --prefix=/opt/ffmpeg --enable-cuda --enable-cuvid --enable-nvenc --enable-nonfree --enable-libnpp --extra-cflags=-I/usr/include --extra-ldflags=-L/usr/lib64/

make -j 10

make install


now either mv /bin/ffmpeg to one side and link the one in /opt/ffmpeg/bin, or prefix your path to /opt/ffmpeg/bin before bin.
either option works, one mayt be better for you.
ive already asked if this could be compiled in like in mga6 and i got back an excuse that some of the stuff needed was not redistributable (did it change since 6?)

also just to make this complete a few examples to test nvenc

Code: Select all
prepare for blueray playback dolby HD
/opt/ffmpeg/bin/ffmpeg -hwaccel_device 0  -hwaccel cuvid -i input_file.mkv   -c:v h264_nvenc  -preset slow  -rc cbr_hq -b:v 10000k -maxrate 20000k -bufsize 1000k -profile:v high -level:v 4.1 -pix_fmt yuv420p -flags global_header -c:a aac  output_file.mkv


prepare for blueray playback dolby 5.1
/opt/ffmpeg/bin/ffmpeg -hwaccel_device 0  -hwaccel cuvid -i input_file.mkv   -c:v h264_nvenc  -preset slow  -rc cbr_hq -b:v 10000k -maxrate 20000k -bufsize 1000k -profile:v high -level:v 4.1 -pix_fmt yuv420p -flags global_header -c:a ac3  output_file.mkv

prepare for 4k blueray playback dolby 5.1
/opt/ffmpeg/bin/ffmpeg -hwaccel_device 0  -hwaccel cuvid -i input_file.mkv  -c:v h264_nvenc  -preset slow  -rc cbr_hq -b:v 10000k -maxrate 20000k -bufsize 1000k -profile:v high -level:v 4.1 -pix_fmt yuv420p -flags global_header -c:a ac3  output_file.mkv

select first video track and second audio track only
/opt/ffmpeg/bin/ffmpeg -hwaccel_device 0  -hwaccel cuvid -i input_file.mkv  -c:v h264_nvenc  -preset slow  -rc cbr_hq -b:v 10000k -maxrate 20000k -bufsize 1000k -profile:v high -level:v 4.1 -pix_fmt yuv420p -flags global_header -map 0:v:0 -map 0:a:1 -c:a ac3  output_file.mkv

downsize from 4k to blueray playback dolby 5.1 untested
/opt/ffmpeg/bin/ffmpeg -hide_banner -hwaccel_device 0  -hwaccel nvdec -c:v hevc_cuvid -resize 1920x1080 -i input_file.mkv  -c:v h264_nvenc   -preset slow  -rc cbr_hq -b:v 10000k -maxrate 20000k -bufsize 1000k -profile:v high -level:v 4.1 -pix_fmt yuv420p -flags global_header -c:a ac3  output_file.mkv

blueray to fit on 8 gig dvd
/opt/ffmpeg/bin/ffmpeg -hwaccel_device 0  -hwaccel cuvid -i input_file.mkv   -c:v h264_nvenc  -preset slow  -rc cbr_hq -b:v 7000k -maxrate 10000k -bufsize 1000k -profile:v high -level:v 4.1 -pix_fmt yuv420p -flags global_header -c:a ac3  output_file.mkv


hope this helps you as well as others, it took me sometime to get it all working (all based on mga7 install)

regards peter
Redhat 6 Certified Engineer (RHCE)
Sometimes my posts will sound short, or snappy, however its realy not my intention to offend, so accept my apologies in advance.
wintpe
 
Posts: 1189
Joined: May 22nd, '11, 17:08
Location: Rayleigh,, Essex , UK

Re: OBS Studio not picking up NVenc

Postby petechristyuk » Jul 26th, '19, 11:33

Many thanks for this! I have my family visiting this week-end, and the computer in question is in the room being used by my little grand-daughter, so I won't be able to try until Monday at the earliest. But I will try at the first opportunity!

It seems strange that all this was available "off the shelf" in M6, but not in M7! A "giant leap" backwards?

Cheers,

--
Pete
petechristyuk
 
Posts: 22
Joined: Feb 28th, '18, 14:27

Re: OBS Studio not picking up NVenc

Postby petechristyuk » Jul 29th, '19, 20:48

Thanks to wintpe, I now have ffmpeg working with NVenc. However, OBS Studio still doesn't pick it up.

I've been trying to rebuild OBS Studio from the SRPMS, but it keeps failing with a string of similar errors like this:
Code: Select all
/usr/bin/ld: /opt/ffmpeg/bin/../lib/libavcodec.a(h264_weight_10bit.o): relocation R_X86_64_PC32 against symbol `ff_pw_1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /opt/ffmpeg/bin/../lib/libavcodec.a(sbrdsp.o): relocation R_X86_64_PC32 against symbol `ff_ps_neg' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /opt/ffmpeg/bin/../lib/libswscale.a(swscale.o): relocation R_X86_64_PC32 against symbol `ff_M24A' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /opt/ffmpeg/bin/../lib/libswscale.a(rgb2rgb.o): relocation R_X86_64_PC32 against symbol `ff_w1111' can not be used when making a shared object; recompile with -fPIC


But I did build it with CFLAGS="-O2 -fPIC", as one would for a 64 bit build!

I'm now stumped. I can either revert back to M6, which worked, or go back to Slackware-current, which I have on all my other machines and never gives me any trouble. I am beginning to wonder if this is the real reason the NVenc stuff wasn't built in to ffmpeg and OBS Studio in M7!

I have wasted too much time on this already.

--
Pete
petechristyuk
 
Posts: 22
Joined: Feb 28th, '18, 14:27

Re: OBS Studio not picking up NVenc

Postby hman » Aug 18th, '19, 12:44

i had same problem so i rebuild ffmpeg tained with nvenc support enabled. I follow this steps:
http://notes.integrazioneweb.com/2018/1 ... on-mageia/

for no builders i uploaded generated rpms here:
https://drive.google.com/file/d/13pAZdI ... sp=sharing

i also rebuild obs-studio-23.2.1 from cauldron to mageia 7:
https://copr-be.cloud.fedoraproject.org ... bs-studio/

here result
Image
Last edited by hman on Aug 20th, '19, 21:46, edited 1 time in total.
Blog: http://www.integrazioneweb.com/

Some projects:
- Monosim github.com/armando-basile/monosim/
- Comex-Project github.com/armando-basile/comex-project
- Sagent github.com/armando-basile/sagent
hman
 
Posts: 34
Joined: Feb 20th, '12, 11:56

Re: OBS Studio not picking up NVenc

Postby petechristyuk » Aug 18th, '19, 19:26

Thank you for your effort!

Since my last post, I have reverted to M6, as this "just worked" without any faffing around. When I get time, I will try upgrading to M7 again, and give your RPMs a try!

Many thanks!

--
Pete
petechristyuk
 
Posts: 22
Joined: Feb 28th, '18, 14:27


Return to Video

Who is online

Users browsing this forum: No registered users and 1 guest

cron