Avidemux Forum

Avidemux => Unix-Like (Linux/Bsd/...) => Topic started by: YAFU on October 04, 2015, 03:30:00 PM

Title: How compile with nvidia "nvenc" enabled in *ubuntu?
Post by: YAFU on October 04, 2015, 03:30:00 PM
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.
Title: Re: How compile with nvidia "nvenc" enabled in *ubuntu?
Post by: YAFU on October 04, 2015, 08:27:35 PM
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
Title: Re: How compile with nvidia "nvenc" enabled in *ubuntu?
Post by: Jan Gruuthuse on October 05, 2015, 09:02:44 AM
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

Title: Re: How compile with nvidia "nvenc" enabled in *ubuntu?
Post by: YAFU on October 05, 2015, 05:30:26 PM
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?
Title: Re: How compile with nvidia "nvenc" enabled in *ubuntu?
Post by: mean on October 06, 2015, 08:05:58 AM
There is a .h that needs to be found by avidemux, so it must be somewhere sane
in particular nvEncodeAPI.h
Title: Re: How compile with nvidia "nvenc" enabled in *ubuntu?
Post by: Jan Gruuthuse on October 06, 2015, 09:03:34 AM
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
#########################################
Title: Re: How compile with nvidia "nvenc" enabled in *ubuntu?
Post by: YAFU on October 06, 2015, 03:09:35 PM
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?
Title: Re: How compile with nvidia "nvenc" enabled in *ubuntu?
Post by: mean on October 06, 2015, 04:56:57 PM
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)

Title: Re: How compile with nvidia "nvenc" enabled in *ubuntu?
Post by: YAFU on October 06, 2015, 05:57:28 PM
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
Title: Re: How compile with nvidia "nvenc" enabled in *ubuntu?
Post by: YAFU on October 06, 2015, 06:55:01 PM
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.
Title: Re: How compile with nvidia "nvenc" enabled in *ubuntu?
Post by: mean on October 06, 2015, 07:00:45 PM
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
Title: Re: How compile with nvidia "nvenc" enabled in *ubuntu?
Post by: mean on October 06, 2015, 07:29:56 PM
and there is a file missing in the install, so if you dont have ffmpeg installed at all on your system, nvenc will fail
Title: Re: How compile with nvidia "nvenc" enabled in *ubuntu?
Post by: YAFU on October 06, 2015, 10:01:12 PM
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.
Title: Re: How compile with nvidia "nvenc" enabled in *ubuntu?
Post by: mean on October 07, 2015, 05:38:41 AM
Both problems fixed
Title: Re: How compile with nvidia "nvenc" enabled in *ubuntu?
Post by: Jan Gruuthuse on October 07, 2015, 06:35:28 AM
**************************
***  Optional Library  ***
***      Summary       ***
**************************
*** Video Encoder      ***
    NVENC          Yes
Title: Re: How compile with nvidia "nvenc" enabled in *ubuntu?
Post by: YAFU on October 07, 2015, 02:27:53 PM
Thanks!
This is the log I get now:
http://www.pasteall.org/61526

Regarding sdl in Avidemux from git, I do not know if this is because the version. I have installed: libsdl-console-dev (2.1-3)

Do you plan to support nvenc H265 (nvenc_hevc) in Avidemux?

I am very happy to finally have support for encoding with hardware acceleration in Linux. I know nvidia receives much criticism in Linux, but for my nvidia is which gives us better support (Good driver, good OpenCL, OpenGL and GPU acceleration). Instead, Intel gets good criticism, but for my intel is not good in Linux. Intel only provides decent driver for Linux, but about comparing features with Windows, intel is not good in Linux. I'm still trying to get support for Quick Sync on Linux, very confusing and difficult information.
Title: Re: How compile with nvidia "nvenc" enabled in *ubuntu?
Post by: mean on October 07, 2015, 03:07:54 PM
I dont think my video card supports h265
I can do it blindly, but it would most probably not work
Title: Re: How compile with nvidia "nvenc" enabled in *ubuntu?
Post by: YAFU on October 08, 2015, 03:55:00 AM
I could be beta tester if you are interested. nvenc_hevc is working with ffmpeg in my card.