LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 09-28-2023, 05:48 AM   #1
zdolar
Member
 
Registered: Jul 2009
Location: Slovenija
Distribution: Slackware
Posts: 177

Rep: Reputation: 38
ffmpeg compile with nvidia acceleration failed


I have today updated Slackware64-current.
HP ZBook with Nvidia P2000
Installed:
nv-codec-headers-12.0.16.0-x86_64
nvidia-driver-535.113.01_multilib-x86_64
nvidia-kernel-535.113.01_6.4.16-x86_64

Nvidia krenel/driver test:
Code:
__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia glxinfo | grep OpenGL
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: Quadro P2000/PCIe/SSE2
OpenGL core profile version string: 4.6.0 NVIDIA 535.113.01
OpenGL core profile shading language version string: 4.60 NVIDIA
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 4.6.0 NVIDIA 535.113.01
OpenGL shading language version string: 4.60 NVIDIA
OpenGL context flags: (none)
OpenGL profile mask: (none)
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.2 NVIDIA 535.113.01
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
Code:
ls -la /usr/include/ffnvcodec/
total 476
drwxr-xr-x   2 root root   4096 23.09.2023 09:46:50 .
drwxr-xr-x 603 root root  36864 28.09.2023 08:33:13 ..
-rw-r--r--   1 root root  21876 23.09.2023 09:46:50 dynlink_cuda.h
-rw-r--r--   1 root root  66364 23.09.2023 09:46:50 dynlink_cuviddec.h
-rw-r--r--   1 root root  22503 23.09.2023 09:46:50 dynlink_loader.h
-rw-r--r--   1 root root  28494 23.09.2023 09:46:50 dynlink_nvcuvid.h
-rw-r--r--   1 root root 291178 23.09.2023 09:46:50 nvEncodeAPI.h
compiling ffmpeg from slackware source or Aliens repository-restricted both do not compile nvidia hardware acclerated encoders. There are no nvenc encoders:
Code:
ffmpeg -hide_banner -encoders |grep H.26
 V..... flv                  FLV / Sorenson Spark / Sorenson H.263 (Flash Video) (codec flv1)
 V..... h261                 H.261
 V..... h263                 H.263 / H.263-1996
 V..... h263_v4l2m2m         V4L2 mem2mem H.263 encoder wrapper (codec h263)
 V.S... h263p                H.263+ / H.263-1998 / H.263 version 2
 V....D libx264              libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (codec h264)
 V....D libx264rgb           libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 RGB (codec h264)
 V..... h264_qsv             H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (Intel Quick Sync Video acceleration) (codec h264)
 V..... h264_v4l2m2m         V4L2 mem2mem H.264 encoder wrapper (codec h264)
 V....D h264_vaapi           H.264/AVC (VAAPI) (codec h264)
 V....D libx265              libx265 H.265 / HEVC (codec hevc)
 V....D hevc_vaapi           H.265/HEVC (VAAPI) (codec hevc)
Looks like autodetection of nv codec headers do not detect them, or something else is missing.
As a result ffmpeg is not nvidia accelerated.

Please help.
 
Old 09-28-2023, 11:47 PM   #2
ReaperX7
LQ Guru
 
Registered: Jul 2011
Location: California
Distribution: Slackware64-15.0 Multilib
Posts: 6,558
Blog Entries: 15

Rep: Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097Reputation: 2097
Check the build instructions for an option to enable nvenc or edit the buildscript to enable it.
 
Old 09-29-2023, 07:09 AM   #3
zdolar
Member
 
Registered: Jul 2009
Location: Slovenija
Distribution: Slackware
Posts: 177

Original Poster
Rep: Reputation: 38
Quote:
Originally Posted by ReaperX7 View Post
Check the build instructions for an option to enable nvenc or edit the buildscript to enable it.
Yes I always RTFM.
All properly done by manuals/suggestions here and Nvidia.
What bothers me, is on nVidias page as Prerequisites:
To compile FFmpeg, the CUDA toolkit must be installed on the system, though the CUDA toolkit is not needed to run the FFmpeg compiled binary.
Previous versions do not require Cuda Toolkit to compile only nvenc and nvdec without Cuda acceleration.

For simple test I used pure ffmpeg-5.1.3 source and get undefined error as nvenc is not a library or dependency:
Code:
./configure   --prefix="$HOME/bin"   --bindir="$HOME/bin"   --disable-doc   --enable-static   --disable-shared  --enable-openssl   --enable-libvorbis   --enable-libmp3lame   --enable-libx264   --enable-libx265   --enable-libvpx   --enable-libopus   --enable-libfdk-aac   --enable-libtheora   --enable-zlib   --enable-libfreetype   --enable-libpulse   --enable-libfribidi   --enable-libass --enable-nvenc   --enable-gpl   --enable-nonfree
root@zbook ./configure   --prefix="$HOME/bin"   --bindir="$HOME/bin"   --disable-doc   --enable-static   --disable-shared  --enable-openssl   --enable-libvorbis   --enable-libmp3lame   --enable-libx264   --enable-libx265   --enable-libvpx   --enable-libopus   --enable-libfdk-aac   --enable-libtheora   --enable-zlib   --enable-libfreetype   --enable-libpulse   --enable-libfribidi   --enable-libass --enable-nvenc   --enable-gpl   --enable-nonfree
ERROR: nvenc requested but not found
As Cuda toolkit is massive, I prefer not to install it, if not needed.
 
Old 09-29-2023, 09:01 AM   #4
zdolar
Member
 
Registered: Jul 2009
Location: Slovenija
Distribution: Slackware
Posts: 177

Original Poster
Rep: Reputation: 38
Installed cuda-12.2, the same error remains.
 
Old 09-29-2023, 12:51 PM   #5
superkret2
LQ Newbie
 
Registered: Sep 2023
Location: Heidelberg, Germany
Distribution: Slackware64 15.0
Posts: 15

Rep: Reputation: 18
Do you have libvdpau installed?
It's a dependency of nvidia-driver according to https://docs.slackware.com/howtos:ha...aphics_drivers

Also you might try this:

Code:
For CUDA/OpenCL to work after reboot, and for utilites such as
nvidia-smi, you might need to include the following line in your
/etc/rc.d/rc.local:
(This is REQUIRED if you plan on running nvidia-persistenced)

    # Create missing nvidia device nodes after reboot
    /usr/bin/nvidia-modprobe -c 0 -u
 
Old 10-19-2023, 03:56 PM   #6
zdolar
Member
 
Registered: Jul 2009
Location: Slovenija
Distribution: Slackware
Posts: 177

Original Poster
Rep: Reputation: 38
Quote:
Originally Posted by superkret2 View Post
Do you have libvdpau installed?
It's a dependency of nvidia-driver according to https://docs.slackware.com/howtos:ha...aphics_drivers

Also you might try this:

Code:
For CUDA/OpenCL to work after reboot, and for utilites such as
nvidia-smi, you might need to include the following line in your
/etc/rc.d/rc.local:
(This is REQUIRED if you plan on running nvidia-persistenced)

    # Create missing nvidia device nodes after reboot
    /usr/bin/nvidia-modprobe -c 0 -u
Yes:
/dev/nvidia-modeset
/dev/nvidia-uvm
/dev/nvidia-uvm-tools
/dev/nvidia0
/dev/nvidiactl

/dev/nvidia-caps:
nvidia-cap1
nvidia-cap2

I tested all I found on net, but no success.
I also reverted kernel/driver to 530.41.03.
ffmpeg config do not detect nvidia kernel modules and drivers.
Explicitly specified enable-nvenc in configure returns:
nvenc requested but not found.

Can anybody help?
 
Old 10-19-2023, 04:17 PM   #7
zdolar
Member
 
Registered: Jul 2009
Location: Slovenija
Distribution: Slackware
Posts: 177

Original Poster
Rep: Reputation: 38
Part of config.log where error is:

Code:
clang: warning: CUDA version 12.1 is only partially supported [-Wunknown-cuda-version]
error: unable to create target: 'No available targets are compatible with triple "nvptx64-nvidia-cuda"'
1 error generated when compiling for sm_30.
check_pkg_config ffnvcodec ffnvcodec >= 9.1.23.1 ffnvcodec/nvEncodeAPI.h ffnvcodec/dynlink_cuda.h ffnvcodec/dynlink_cuviddec.h ffnvcodec/dynlink_nvcuvid.h 
test_pkg_config ffnvcodec ffnvcodec >= 9.1.23.1 ffnvcodec/nvEncodeAPI.h ffnvcodec/dynlink_cuda.h ffnvcodec/dynlink_cuviddec.h ffnvcodec/dynlink_nvcuvid.h 
pkg-config --exists --print-errors ffnvcodec >= 9.1.23.1
check_func_headers ffnvcodec/nvEncodeAPI.h ffnvcodec/dynlink_cuda.h ffnvcodec/dynlink_cuviddec.h ffnvcodec/dynlink_nvcuvid.h 
test_ld cc
test_cc
BEGIN /tmp/ffconf.BNgytSQg/test.c
    1	#include <ffnvcodec/nvEncodeAPI.h>
    2	#include <ffnvcodec/dynlink_cuda.h>
    3	#include <ffnvcodec/dynlink_cuviddec.h>
    4	#include <ffnvcodec/dynlink_nvcuvid.h>
    5	#include <stdint.h>
    6	int main(void) { int ret = 0;
    7	return ret; }
END /tmp/ffconf.BNgytSQg/test.c
gcc -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -DPIC -O2 -fPIC -I/usr/local/cuda/include -std=c11 -fomit-frame-pointer -fPIC -c -o /tmp/ffconf.BNgytSQg/test.o /tmp/ffconf.BNgytSQg/test.c
gcc -L/usr/local/cuda/lib64 -Wl,--as-needed -Wl,-z,noexecstack -o /tmp/ffconf.BNgytSQg/test /tmp/ffconf.BNgytSQg/test.o
check_cpp_condition winrt windows.h !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
test_cpp_condition windows.h !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
test_cpp
BEGIN /tmp/ffconf.BNgytSQg/test.c
    1	#include <windows.h>
    2	#if !(!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP))
    3	#error "unsatisfied condition: !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)"
    4	#endif
END /tmp/ffconf.BNgytSQg/test.c
gcc -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -DPIC -O2 -fPIC -I/usr/local/cuda/include -std=c11 -fomit-frame-pointer -fPIC -E -o /tmp/ffconf.BNgytSQg/test.o /tmp/ffconf.BNgytSQg/test.c
/tmp/ffconf.BNgytSQg/test.c:1:10: fatal error: windows.h: No such file or directory
    1 | #include <windows.h>
      |          ^~~~~~~~~~~
compilation terminated.
 
Old 10-27-2023, 08:40 AM   #8
zdolar
Member
 
Registered: Jul 2009
Location: Slovenija
Distribution: Slackware
Posts: 177

Original Poster
Rep: Reputation: 38
Finally solved.

nv-codec-headers is responsible for many hours lost.
The right version is 11.1.5.3 - the last 11.X version.
Despite a new nvidia kernel/driver installed, nv-codec-headers must be < 12.X.
Works with the latest 545.23.06 kernel/driver.
All options are autodetected with original Pats ffmpeg.SlackBuild.
As I'm out of US, I set to compile patented and non_free code.

Last edited by zdolar; 10-27-2023 at 08:44 AM.
 
1 members found this post helpful.
Old 03-26-2024, 11:41 PM   #9
Geremia
Member
 
Registered: Apr 2011
Distribution: slackware64-current
Posts: 503

Rep: Reputation: 46
Instructions for CUDA 12.x: https://docs.nvidia.com/video-techno...ling-for-linux
 
Old 03-27-2024, 04:01 PM   #10
Geremia
Member
 
Registered: Apr 2011
Distribution: slackware64-current
Posts: 503

Rep: Reputation: 46
be sure to update nv-codec-headers to correspond with your Cuda version

Quote:
Originally Posted by zdolar View Post
All options are autodetected with original Pat's ffmpeg.SlackBuild.
Not for me. It didn't detect CUDA when I tried to build ffmpeg 6.1.1.

Update: I needed to update nv-codec-headers to 12.1.14.0, then the SlackBuild detected everything properly.

Last edited by Geremia; 03-27-2024 at 04:48 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: FFmpeg 5.1 “Riemann” LTS Released with VDPAU AV1 Hardware Acceleration, New Filters LXer Syndicated Linux News 0 07-24-2022 08:32 AM
NVIDIA problems (NVIDIA-SMI has failed..., NVIDIA driver is not loaded....) CrimsonEvenfall Linux - General 1 04-16-2022 02:33 AM
Hardware Acceleration - your system is currently running without video hardware acceleration Dunnyman Linux - Software 3 11-18-2020 02:43 PM
[SOLVED] Slackware ARM Raspberry Pi - armv6 and armv7 - optimized FFMPEG with HW Acceleration abga Slackware - ARM 32 11-15-2019 07:09 PM
nvidia: Hardware acceleration without the official nvidia drivers? jaakkop Linux - Hardware 3 06-01-2006 07:44 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 03:36 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration