How compile with nvidia "nvenc" enabled in *ubuntu?

Started by YAFU, October 04, 2015, 03:30:00 PM

Previous topic - Next topic

YAFU

Hello.
My card is GTX 960, 355.11 driver. Kubuntu 14.04 64bits.
I've been reading this thread:
http://avidemux.org/smif/index.php?topic=16389.0

but I don't know the necessary dependencies to be able to compile with nvenc enabled.

As recommended here for ffmpeg:
http://ubuntuforums.org/showthread.php?t=2265485&p=13229467#post13229467

I downloaded sdk 5.0.1 and I copied the files from "/samples/nvEncoder/inc" to "/usr/local/include"

But when I do "bash bootStrap.bash --deb", I get:
*** Video Encoder      ***
    NVENC          No
*** Miscellaneous      ***
    gettext        Yes
    SDL            Yes
    XVideo         Yes
    VDPAU          Yes
    LIBVA          Yes


Another question. In that other thread, "Jan Gruuthuse" mentions "H264 (nvidia)"
and "H264 (ff / nvidia)". Are those other encoders where I can take advantage of nvidia GPU? How do I compile with them also enabled?

Edit:
I did not understand in that thread the doubt about whether the GTX 960 is supported. At least in Windows with Mediacoder, the GTX 960 works with nvenc.

YAFU

Ok, I had doubts about whether my problem might be related to a missing dependency. But I have been able to compile ffmpeg with "nvenc" enabled, and apparently ffmpeg can find the SDK files copied to "/usr/local/include/". When configure ffmpeg report in encoders:
nvenc     
nvenc_h264
nvenc_hevc

ffmpeg with nvenc is working well on my GTX 960.
So I think that is not a problem in my system. I'm trying to compile avidemux with:
bash bootStrap.bash --deb --with-core --with-plugins --without-gtk

I still get
NVENC          No

Avidemux sources downloaded today: avidemux_2.6.10.tar.gz

Jan Gruuthuse

#2
Try build with
cd ~/avidemux2 && bash bootStrap.bash --deb --with-qt4 --without-gtk --with-cli
You did install all debs found  where you did build avidemux: avidemux2/debs
    avidemux3-core-2.6.10-YYMMDD-runtime
    avidemux3-plugins-COMMON-2.6.10-YYMMDD-plugins
    avidemux3-qt4-2.6.10-YYMMDD-runtime
    avidemux3-plugins-QT4-2.6.10-YYMMDD-plugins
    avidemux3-cli-2.6.10-YYMMDD-runtime
    avidemux3-plugins-CLI-2.6.10-YYMMDD-plugins
    avidemux3-settings-2.6.10--YYMMDD-settings
and you do start "/usr/bin/avidemux3_qt4" from terminal?
ffmpeg building was not needed, avidemux has a its own build

These:
Quote"H264 (nvidia)"
and "H264 (ff / nvidia)"
were references to Avidemux menu.
In avidemux menu in Video Output you should find H264 (ff/nvidia) if your build was successful.

Building avidemux is easier when you use git source:
1st time:
git clone https://github.com/mean00/avidemux2.git
next times:
update:
cd ~/avidemux2 && git pull
build:
cd ~/avidemux2 && bash bootStrap.bash --deb --with-qt4 --without-gtk --with-cli


If the reference is not showing up, you might need to build and install x264, when done rebuild avidemux.

x264:
=====
1st time: Get x264:
-----------------------
git clone git://git.videolan.org/x264.git

next times: Update x264:
-----------------------------
cd ~/x264 && git pull

Building x264:
-----------
cd ~/x264
./configure  --prefix="/usr" --bindir="/usr/local/bin" --libdir="/usr/lib/x86_64-linux-gnu/" --enable-static --enable-shared --enable-pic
make
sudo make install


installing should report this:
Quoteinstall -d /usr/local/bin
install x264 /usr/local/bin
install -d /usr/include
install -d /usr/lib/x86_64-linux-gnu/
install -d /usr/lib/x86_64-linux-gnu//pkgconfig
install -m 644 ./x264.h /usr/include
install -m 644 x264_config.h /usr/include
install -m 644 x264.pc /usr/lib/x86_64-linux-gnu//pkgconfig


YAFU

Jan Gruuthuse, thank you very much for your detailed explanation.
Regarding x264, Can x264 be related to the problem where nvenc is not detected by avidemux? I have installed, "libx264-dev" package, anyway I downloaded and installed x264 from git and I have also tried avidemux from Git, but I keep getting:
**************************
***  Optional Library  ***
***      Summary       ***
**************************
*** Video Encoder      ***
    NVENC          No
*** Miscellaneous      ***
    gettext        Yes
    SDL            No
    XVideo         Yes
    VDPAU          Yes
    LIBVA          Yes
    OpenGL         Yes
**************************
***   Release Build    ***
**************************


By the way, I get an error when compiling:
http://www.pasteall.org/61485
Is it looking for Qt5 files, even when I'm compiling without Qt5? (bash bootStrap.bash --deb --with-qt4 --without-gtk --with-cli)

But anyway, first I want to solve the problem with nvenc. it should indicate "NVENC          Yes", right?

mean

There is a .h that needs to be found by avidemux, so it must be somewhere sane
in particular nvEncodeAPI.h

Jan Gruuthuse

#5
nvEncodeAPI.h is located in /usr/include/x86_64-linux-gnu with ubuntu 14.04.3 lts
You should see this get by in terminal window:
Quote-- Checking for NVENC
-- *****************
--  nvenc header Found
in:
Quote
#########################################
Configure for avidemux core libs Started
#########################################
Quote#########################################
Configure for avidemux Qt4 Started
#########################################
Quote#########################################
Configure for avidemux Cli Started
#########################################

YAFU

Hi.
This is weird. I already had copied the sdk files with "nvEncodeAPI.h" in both paths, "/usr/local/include/" and "/usr/include/x86_64-linux-gnu"
I deleted the files from "/usr/local/include/" even I restarted the system, but keep getting:
$ locate nvEncodeAPI.h
/usr/local/include/nvEncodeAPI.h

Even when the file is not there anymore.

How I can make my system finds "nvEncodeAPI.h" into "/usr/include/x86_64-linux-gnu"?
Perhaps if I could set "--prefix="/usr/local" then avidemux  can find the file in "/usr/local/include/"?

Edit:
By the way, the SDK version I downloaded is 5.0.1
Is Avidemux compatible with this version?

mean

you could force the detection
i.e. edit cmake/admCheclNvEnc.cmake
and replace

11                        IF(NVENC_INCLUDE_DIR)
12                                 MESSAGE(STATUS " nvenc header Found ")
13                                 SET(USE_NVENC True)
14                         ELSE(NVENC_INCLUDE_DIR)
15                                 MESSAGE(STATUS " nvenc header not Found ")
16                         ENDIF(NVENC_INCLUDE_DIR)




by

   SET(USE_NVENC True)


YAFU

Hello, still not working. But there is something I had not noticed. Apparently it can find "NVENC":
-- Checking for NVENC
-- *****************
--  nvenc header Found


but then it still reporting:
**************************
***  Optional Library  ***
***      Summary       ***
**************************
*** Video Encoder      ***
    NVENC          No
*** Miscellaneous      ***


http://www.pasteall.org/61505

I'm using this SDK:
http://developer.download.nvidia.com/compute/nvenc/v5.0/nvenc_5.0.1_sdk.zip

YAFU

Ok, I solved the other problem I had mentioned before in message #3 by installing "qttools5-dev-tools" package. I do not know why it has that package as a dependency if I'm installing with qt4:
http://avidemux.org/admWiki/doku.php?id=build:install_2.6

Well, I installed the generated deb packages and "H264 (ff/nvidia)" is there in avidemux and works well. So I do not understand the message " NVENC          No" when configuring.

Thank you.

mean

Could be a print out issue
Regarding Qt5, It's a packaging weirdness, some needed tools are in that qttools package. These tools should be in qt5-dev as you need them if you do something with qt5 most of the times

mean

and there is a file missing in the install, so if you dont have ffmpeg installed at all on your system, nvenc will fail

YAFU

#12
Are you referring to some of the logs that I had published here?
I always have ffmpeg installed. I had installed ffmpeg from a multimedia PPA for Ubuntu 14.04 which installs it in "/opt/ffmpeg" (in 14.04, ffmpeg was replaced by avconv). Currently I have ffmpeg installed in "/opt/ffmpeg" but compiled by myself with nvenc support. ffmpeg binary from "/opt/ffmpeg/bin/ffmpeg" linked to "/usr/bin" (I guess these links are done automatically when installed?).
Nvenc is working well in avidemux. So if you have seen this missing file in my logs, it should be another print out issue.

By the way, with avidemux from git I get "SDL   NO" (this does not happen with the source downloaded from the website. I do not know what is that SDL and if it is important. I do not know if it was installed or is a print out issue.

mean


Jan Gruuthuse

**************************
***  Optional Library  ***
***      Summary       ***
**************************
*** Video Encoder      ***
    NVENC          Yes