Run h264_nvenc.mp4 via Nvidia GPU in Nvidia Prime mode (GPU offload)

Hi,
im runing my laptop in Nvidia Prime (Nvidia On Demand, Hybrid graphics) mode and trying to run nvenc in CinGG via GPU Offload.

Here is my start command:

export __NV_PRIME_RENDER_OFFLOAD=1export __GLX_VENDOR_LIBRARY_NAME=nvidiaexport __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0export __VK_LAYER_NV_optimus=NVIDIA_onlyexport LIBVA_DRIVER_NAME=nvidiafirejail --env=__NV_PRIME_RENDER_OFFLOAD=1 --env=__GLX_VENDOR_LIBRARY_NAME=nvidia --env=__NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0 --env=__VK_LAYER_NV_optimus=NVIDIA_only --env=LIBVA_DRIVER_NAME=nvidia --env=DESKTOPINTEGRATION=appimaged --noprofile --appimage /home/user/Downloads/CinGG-20230331-x86_64.AppImageAnd i cant get Nvidia GPU utilization.
The render runs via CPU.

Here is the information that proves I can run applications through the Nvidia GPU:

export __NV_PRIME_RENDER_OFFLOAD=1export __GLX_VENDOR_LIBRARY_NAME=nvidiaexport __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0export __VK_LAYER_NV_optimus=NVIDIA_onlyexport LIBVA_DRIVER_NAME=nvidiainxi -GxxGraphics:Device-1: Intel HD Graphics 630 vendor: Dell driver: i915 v: kernel ports:active: eDP-1 empty: DP-1 bus-ID: 00:02.0 chip-ID: 8086:591bDevice-2: NVIDIA GP107M [GeForce GTX 1050 Mobile] vendor: Delldriver: nvidia v: 545.29.06 pcie: speed: 2.5 GT/s lanes: 16 ports:active: none empty: HDMI-A-1 bus-ID: 01:00.0 chip-ID: 10de:1c8dDevice-3: Sunplus Innovation Integrated_Webcam_HD type: USBdriver: uvcvideo bus-ID: 1-12:4 chip-ID: 1bcf:28c1Display: x11 server: X.Org v: 1.21.1.3 compositors: 1: xfwm v: 4.18.02: Picom v: git-31727 driver: X: loaded: modesetting,nvidiaunloaded: fbdev,nouveau,vesa gpu: i915 display-ID: :0.0 screens: 1Screen-1: 0 s-res: 1920x1080 s-dpi: 96Monitor-1: eDP-1 model: AU Optronics res: 1920x1080 dpi: 142diag: 394mm (15.5)OpenGL: renderer: NVIDIA GeForce GTX 1050/PCIe/SSE2v: 4.6.0 NVIDIA 545.29.06 direct render: Yes I can successfully run apps with Nvidia GPU utilization, e.g. games on Wine.
But CinGG doesnt utilize the Nvidia GPU in Nvidia Prime mode via GPU offload if i run the render via h264_nvenc.mp4 profile

@cinuzer

@andreapaz

Did you build/compile CinGG yourself or are you using an AppImage or one of the package files at:

 https://github.com/einhander/cin-gg-packages/releases

Unfortunately, I have not found a computer to test nvenc here yet but have 1 more I can look at. I am hoping that Andrea has tested this since we upgraded to ffmpeg 6.1 recently and can verify that it is working.

When you say it is not using the GPU, have you also looked at the startup window where you started CinGG to see if there is the error message: Cannot load libcuda.so.1 ?

@phylsmith2004
No, im using appimage.

Today I ran the CineGG render (after rebooting my laptop).
And as far as I can tell from the preview of the rendering process in the Compositor window (its going fast) - Nvidia GPU encoding is working again for me

Here is the stdout of a successful render via nvenc:

[spoiler title=log]

export __NV_PRIME_RENDER_OFFLOAD=1export __GLX_VENDOR_LIBRARY_NAME=nvidiaexport __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0export __VK_LAYER_NV_optimus=NVIDIA_onlyexport LIBVA_DRIVER_NAME=nvidiafirejail --env=__NV_PRIME_RENDER_OFFLOAD=1 --env=__GLX_VENDOR_LIBRARY_NAME=nvidia --env=__NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0 --env=__VK_LAYER_NV_optimus=NVIDIA_only --env=LIBVA_DRIVER_NAME=nvidia --env=DESKTOPINTEGRATION=appimaged --noprofile --appimage /home/user/Downloads/CinGG-20230331-x86_64.AppImageParent pid 89472, child pid 89473** Warning: dropping all Linux capabilities and setting NO_NEW_PRIVS prctl Mounting appimage type 2Warning: NVIDIA card detected, nogroups command ignoredChild process initialized in 51.93 msCinelerra Infinity - built: Mar 31 2023 08:26:24git://git.cinelerra-gg.org/goodguy/cinelerra.git(c) 2006-2019 Heroine Virtual Ltd. by Adam Williams2007-2020 mods for Cinelerra-GG by W.P.Morrow aka goodguyCinelerra is free software, covered by the GNU General Public License,and you are welcome to change it and/or distribute copies of it undercertain conditions. There is absolutely no warranty for Cinelerra.audio0 pad 64 0 (64)Failed to open VDPAU backend libvdpau_va_gl.so: cannot open shared object file: No such file or directoryFailed HW device create.dev:vdpauerr: Unknown error occurredHW device init failed, using SW decode.file:/home/user/Video/1-bad-lightbulb.mp4err: Operation not permittedFailed to open VDPAU backend libvdpau_va_gl.so: cannot open shared object file: No such file or directoryFailed HW device create.dev:vdpauerr: Unknown error occurredHW device init failed, using SW decode.file:/home/user/Video/1-bad-lightbulb.mp4err: Operation not permittedFailed to open VDPAU backend libvdpau_va_gl.so: cannot open shared object file: No such file or directoryFailed HW device create.dev:vdpauerr: Unknown error occurredHW device init failed, using SW decode.file:/home/user/Video/1-bad-lightbulb.mp4err: Operation not permittedFailed to open VDPAU backend libvdpau_va_gl.so: cannot open shared object file: No such file or directoryFailed HW device create.dev:vdpauerr: Unknown error occurredHW device init failed, using SW decode.file:/home/user/Video/1-bad-lightbulb.mp4err: Operation not permittedFailed to open VDPAU backend libvdpau_va_gl.so: cannot open shared object file: No such file or directoryFailed HW device create.dev:vdpauerr: Unknown error occurredHW device init failed, using SW decode.file:/home/user/Video/1-bad-lightbulb.mp4err: Operation not permittedFailed to open VDPAU backend libvdpau_va_gl.so: cannot open shared object file: No such file or directoryFailed HW device create.dev:vdpauerr: Unknown error occurredHW device init failed, using SW decode.file:/home/user/Video/1-bad-lightbulb.mp4err: Operation not permittedRender::render_single: Session finished. rendered 3722 frames in 22.803 secs, 163.224 fpsTotal excess of backups: -50Session time: 0:02:37Cpu time: user: 0:01:03.442 sys: 0:00:03.304Parent is shutting down, bye…AppImage detached

So i cant reproduce nvenc fail to render for now

@cinuzer

@Andrew_r

So i cant reproduce nvenc fail to render for now
Interesting, I am at a loss for an explanation.

Failed to open backend VDPAU as well as all of the other errors would be due to the AppImage being created on a computer with different graphics hardware that does not have that capability.