Author Topic: Compile Avidemux 2.7.5 including NVENC  (Read 583 times)

msta

  • Newbie
  • *
  • Posts: 3
Compile Avidemux 2.7.5 including NVENC
« on: March 23, 2020, 04:58:01 PM »
Hello,
I'm trying to build my Avidemux with hardware accelerated codecs.

But there is no codec in the list, which looks like a NVENC-hardware accelerated one  :-\

Is this maybe because I used Avidemux 2.7.5 instead of 2.6.*?
What's wrong?
« Last Edit: March 23, 2020, 05:05:31 PM by msta »

eumagga0x2a

  • Moderator
  • Hero Member
  • *****
  • Posts: 3948
Re: Compile Avidemux 2.7.5 including NVENC
« Reply #1 on: March 23, 2020, 05:30:42 PM »
]

This part of some old instruction is obsolete, you need to clone, build and install https://github.com/FFmpeg/nv-codec-headers which also means that your NVIDIA driver must be very recent.

Quote
  • sudo ./createDebFromSourceUbuntu.bash

Never ever do this. The script will ask for root permissions only for tasks which need them, never for the build process. You should at least discard the avidemux2 directory (using sudo because running the build script with sudo results in files owned by root) and clone the source again.

To summarize, you need nv-codec-headers installed, your NVIDIA driver must be at least version 435.21 or later and you don't run the convenience build script with sudo.

msta

  • Newbie
  • *
  • Posts: 3
Re: Compile Avidemux 2.7.5 including NVENC
« Reply #2 on: March 24, 2020, 03:29:26 AM »
Well, createDebFromSourceUbuntu didn't ask me wor root privilleges, when it needed them. But I can run the build as normal user and just the installation as root. I build the nv-codec-headers and again avidemux and now, the codecs are there!

So this would be the complete installation:
Code: [Select]
sudo apt-get install libvdpau-dev  # is this still required?
git clone https://github.com/FFmpeg/nv-codec-headers
cd nv-codec-headers && make
cd nv-codec-headers && sudo make install
git clone https://github.com/mean00/avidemux2.git
cd avidemux2 && git submodule update --init --recursive
cd avidemux2 && git pull --recurse
cd avidemux2 && bash bootStrap.bash --deb
cd avidemux2/debs && rm --interactive=never *-dev.deb  # if you don't want to install the development packages
cd avidemux2/debs && sudo dpkg -i *.deb
avidemux  # this will run the tool

A few questions are open:
How would I remove the packages, installed with dpkg -i *.deb (If I want)?
How can I get a startmenu-Entry for this avidemux? (Except of creating a .desktop entry in /usr/var/applications/ by hand?

As expected, the h.265 doesn't work for my K5000M but the h.264 does.

Thanks.

eumagga0x2a

  • Moderator
  • Hero Member
  • *****
  • Posts: 3948
Re: Compile Avidemux 2.7.5 including NVENC
« Reply #3 on: March 24, 2020, 12:45:23 PM »
Well, createDebFromSourceUbuntu didn't ask me wor root privilleges, when it needed them.

The script simply calls sudo which asks for password if it hasn't been invoked in the current shell recently. This means, if you have executed anything using sudo within the configured timeout prior to running the convenience script, it won't ask for password because sudo already has it.

Quote
I build the nv-codec-headers and again avidemux and now, the codecs are there!

Good.

Quote
So this would be the complete installation:
Code: [Select]
sudo apt-get install libvdpau-dev  # is this still required?

For hw accelerated decoding and display via VDPAU to be available – yes, sure, but the convenience script will do it after calling

Code: [Select]
sudo apt-get update
to sync the local package database with repositories. Installing the package ahead of running the script does no harm, of course.

Quote
Code: [Select]
git clone https://github.com/FFmpeg/nv-codec-headers
cd nv-codec-headers && make
cd nv-codec-headers && sudo make install

You are already in $(pwd)/nv-codec-headers so the second call to "cd nv-codec-headers" will fail and subsequent "sudo make install" will be skipped. Drop the second "cd nv-codec-headers" call.

Quote
Code: [Select]
git clone https://github.com/mean00/avidemux2.git
cd avidemux2 && git submodule update --init --recursive

You probably don't want Avidemux source to be checked out inside the nv-codec-headers directory as you do according to your instruction. Apart from that, these lines are correct.

Quote
Code: [Select]
cd avidemux2 && git pull --recurse

Wrong in the same context as explained above. The call to "git pull --recurse" is necessary later, when you want to sync your old local clone with the current state of the remote branch you are on ("master" by default).

I skip similar notes regarding the following lines.

Quote
Code: [Select]
avidemux  # this will run the tool

No, the default name of the Avidemux GUI executable is avidemux3_qt5. Of course, you can create an alias or a wrapper script, e.g. to redirect stdout of avidemux3_qt5 to /dev/null (to avoid Avidemux debug messages polluting the user's journal).

Quote
A few questions are open:
How would I remove the packages, installed with dpkg -i *.deb (If I want)?

Code: [Select]
sudo apt-get purge "avidemux*"
Quote
How can I get a startmenu-Entry for this avidemux? (Except of creating a .desktop entry in /usr/var/applications/ by hand?

There should be one (https://github.com/mean00/avidemux2/blob/master/avidemux/qt4/xdg_data/org.avidemux.Avidemux.desktop) placed in ${INSTALL_PREFIX}/share/applications by default. Is it missing?

If you are the sole user of your computer and if you are going to follow the development closely, you might want to skip creating debs and run Avidemux without installation --> https://github.com/mean00/avidemux2/blob/master/run_avidemux_template.sh

msta

  • Newbie
  • *
  • Posts: 3
Re: Compile Avidemux 2.7.5 including NVENC
« Reply #4 on: March 25, 2020, 03:57:59 AM »
Well, I thought, a CD-command in a shell-script would only affect the following commands separated with &&...

Ok, some other problem: I updated to nvidia-440 when I unneccessarily installed Cuda, but this caused the prime-select-menu to disappear from the nvidia settings, so I cannot longer switch to the intel graphics. And Steam refused to start, because of some missing 32-bit-driver-whatever (X Error of failed request: GLXBadContext). So I went back to nvidia-390, but with this driver, the NVENC-Codec doesn't work any longer  >:(

I tried bumblebee instead of prime-select, but it works neither with 390 nor 415. I never could get bumblebee working before. Is it still in use?

Well, I would have replaced my K5000M with any AMD-Graphic so many times, if my laptop would support enduro and nut just optimus. I really started hating Nvidia for their shitty linux drivers and will never again buy a Nvidia-GPU, but for the moment, I have to accept it  :o

.. my Intel HD-Graphics 4000 should have a h.264 encoder, too. Ist there a chance to use it with avidemux?
« Last Edit: March 25, 2020, 05:00:21 AM by msta »

eumagga0x2a

  • Moderator
  • Hero Member
  • *****
  • Posts: 3948
Re: Compile Avidemux 2.7.5 including NVENC
« Reply #5 on: March 25, 2020, 01:13:03 PM »
Well, I thought, a CD-command in a shell-script would only affect the following commands separated with &&...

Exactly that. You cd into a subdirectory given as a relative path, run a command, than try again to cd into a subdirectory of the current subdirectory:

Code: [Select]
cd foo && bar
cd foo && xyz

means you enter the directory $(pwd)/foo/foo. If you do

Code: [Select]
cd /full/path/to/foo && bar
cd /full/path/to/foo && xyz

you enter just /full/path/to/foo no matter how many times called. Alternatively, you must cd .. before calling cd foo again.

Quote
So I went back to nvidia-390, but with this driver, the NVENC-Codec doesn't work any longer

You might try to check out and build Avidemux from legacy-compat branch (the one used to generate Windows-XP-compatible cross-builds and thus stuck forever with the last Windows-XP-compatible FFmpeg version 3.3.9) instead of master. However, I'm unsure whether all other parts regarding Linux-only hw accel are in workable state there. You could find it out :)

NB: the legacy branch needs the old nvEncodeAPI.h you mentioned in the first post of this topic.

Quote
I tried bumblebee instead of prime-select, but it works neither with 390 nor 415. I never could get bumblebee working before. Is it still in use?

I don't know, I don't posess hardware which would need this.

Quote
Well, I would have replaced my K5000M with any AMD-Graphic so many times

I don't know whether any of hw accelerated encoders and decoders in Avidemux work with AMD graphics. Usually, NVIDIA drivers work very well as long as the ongoing kernel and userspace development doesn't pull the rug out from under their feet.

Quote
.. my Intel HD-Graphics 4000 should have a h.264 encoder, too. Ist there a chance to use it with avidemux?

If your X runs on Intel, you should be able to use the libva output, hw accelerated decoder and the "Intel H264" as well as "Intel AVC HW (VA)" hw accelerated H.264 encoders.
« Last Edit: March 25, 2020, 01:15:24 PM by eumagga0x2a »