Author Topic: How compile with nvidia "nvenc" enabled in *ubuntu?  (Read 11476 times)

YAFU

  • Newbie
  • *
  • Posts: 29
How compile with nvidia "nvenc" enabled in *ubuntu?
« 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:
Code: [Select]
*** 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.
« Last Edit: October 04, 2015, 03:39:57 PM by YAFU »

YAFU

  • Newbie
  • *
  • Posts: 29
Re: How compile with nvidia "nvenc" enabled in *ubuntu?
« Reply #1 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
« Last Edit: October 04, 2015, 08:33:43 PM by YAFU »

Jan Gruuthuse

  • Hero Member
  • *****
  • Posts: 6052
Re: How compile with nvidia "nvenc" enabled in *ubuntu?
« Reply #2 on: October 05, 2015, 09:02:44 AM »
Try build with
Code: [Select]
cd ~/avidemux2 && bash bootStrap.bash --deb --with-qt4 --without-gtk --with-cliYou 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:
Code: [Select]
git clone https://github.com/mean00/avidemux2.gitnext times:
update:
Code: [Select]
cd ~/avidemux2 && git pullbuild:
Code: [Select]
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:
-----------------------
Code: [Select]
git clone git://git.videolan.org/x264.git
next times: Update x264:
-----------------------------
Code: [Select]
cd ~/x264 && git pull
Building x264:
-----------
Code: [Select]
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:
Quote
install -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

« Last Edit: October 05, 2015, 10:54:20 AM by Jan Gruuthuse »

YAFU

  • Newbie
  • *
  • Posts: 29
Re: How compile with nvidia "nvenc" enabled in *ubuntu?
« Reply #3 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:
Code: [Select]
**************************
***  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?
« Last Edit: October 05, 2015, 05:37:29 PM by YAFU »

mean

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 10958
Re: How compile with nvidia "nvenc" enabled in *ubuntu?
« Reply #4 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

Jan Gruuthuse

  • Hero Member
  • *****
  • Posts: 6052
Re: How compile with nvidia "nvenc" enabled in *ubuntu?
« Reply #5 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
#########################################
« Last Edit: October 06, 2015, 09:15:07 AM by Jan Gruuthuse »

YAFU

  • Newbie
  • *
  • Posts: 29
Re: How compile with nvidia "nvenc" enabled in *ubuntu?
« Reply #6 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:
Code: [Select]
$ 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?
« Last Edit: October 06, 2015, 03:47:31 PM by YAFU »

mean

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 10958
Re: How compile with nvidia "nvenc" enabled in *ubuntu?
« Reply #7 on: October 06, 2015, 04:56:57 PM »
you could force the detection
i.e. edit cmake/admCheclNvEnc.cmake
and replace
Code: [Select]
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
Code: [Select]
   SET(USE_NVENC True)

YAFU

  • Newbie
  • *
  • Posts: 29
Re: How compile with nvidia "nvenc" enabled in *ubuntu?
« Reply #8 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":
Code: [Select]
-- Checking for NVENC
-- *****************
--  nvenc header Found

but then it still reporting:
Code: [Select]
**************************
***  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

  • Newbie
  • *
  • Posts: 29
Re: How compile with nvidia "nvenc" enabled in *ubuntu?
« Reply #9 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.

mean

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 10958
Re: How compile with nvidia "nvenc" enabled in *ubuntu?
« Reply #10 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

mean

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 10958
Re: How compile with nvidia "nvenc" enabled in *ubuntu?
« Reply #11 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

YAFU

  • Newbie
  • *
  • Posts: 29
Re: How compile with nvidia "nvenc" enabled in *ubuntu?
« Reply #12 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.
« Last Edit: October 06, 2015, 10:08:58 PM by YAFU »

mean

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 10958
Re: How compile with nvidia "nvenc" enabled in *ubuntu?
« Reply #13 on: October 07, 2015, 05:38:41 AM »
Both problems fixed

Jan Gruuthuse

  • Hero Member
  • *****
  • Posts: 6052
Re: How compile with nvidia "nvenc" enabled in *ubuntu?
« Reply #14 on: October 07, 2015, 06:35:28 AM »
Code: [Select]
**************************
***  Optional Library  ***
***      Summary       ***
**************************
*** Video Encoder      ***
    NVENC          Yes