Page 1 of 2

Can I use QSV HW Accel from Linux GUI or command line ?

Posted: Fri Jan 11, 2019 8:20 am
by Gedeon
Description of problem or question:
I want to test QSV Intel HW encoding HEVC and H264.

If not from.the gui, from the command line at least ...

I'm using Ubuntu with 4.19.13 kernel.
Already installed Intel Media SDk and vainfo reports correctly the video/card subsystem.

Thanks in advance

Re: Can I use QSV HW Accel from Linux GUI or command line ?

Posted: Fri Jan 11, 2019 8:24 pm
by BradleyS
For instructions on building HandBrake for Linux with experimental QSV support, see https://handbrake.fr/docs/en/latest/dev ... linux.html

Re: Can I use QSV HW Accel from Linux GUI or command line ?

Posted: Thu Feb 21, 2019 5:27 pm
by gene308
I have the same question. I have a dual boot computer with mint 19 and windows 10. On windows qsv works perfectly. On linux qsv is missing.

Why should I have to compile my own copy of handbrake???????

I really don't like loading up my fresh install of mint with all the crap needed to build just a copy of handbrake.

Re: Can I use QSV HW Accel from Linux GUI or command line ?

Posted: Thu Feb 21, 2019 7:30 pm
by rollin_eng
gene308 wrote:
Thu Feb 21, 2019 5:27 pm
I have the same question. I have a dual boot computer with mint 19 and windows 10. On windows qsv works perfectly. On linux qsv is missing.

Why should I have to compile my own copy of handbrake???????

I really don't like loading up my fresh install of mint with all the crap needed to build just a copy of handbrake.
Indeed, in fact why should you have to do anything.

Perhaps someone from the HB team could come and do your laundry, maybe even empty your garbage if they’re not too lazy.

Re: Can I use QSV HW Accel from Linux GUI or command line ?

Posted: Thu Feb 21, 2019 7:41 pm
by JohnAStebbins
QSV on linux is a [Censored] show. It requires specific drivers with specific versions of various libraries that are not available from most linux distribution repositories.

In addition, I can't run QSV on a single one of my machines. So as of now, HandBrake's QSV on linux is completely untested. Nobody, to my knowledge, has ever built and run it. If somebody knows otherwise, please correct me. So, it is *highly* experimental and unsupported.

If you scan for issues users are having with QSV on windows, you'll see that even there it is problematic. I expect QSV on linux will have all the same problems plus many more.

Re: Can I use QSV HW Accel from Linux GUI or command line ?

Posted: Fri Feb 22, 2019 8:04 pm
by gene308
Thank you John for an honest answer. I have also discovered that ffmeg is also a mess when it comes to qsv support. The intel cpu family that has built in hardware decode and encode are now approaching three years since launch. Once again, linux the "superior" operating system is 3 years and 3 steps behind windows. I understand now that is not a handbrake issue, but a linux issue.

Looks like I will reworking my bash encoding scripts to windows batch files.

Thanks to all the handbrake people for creating a quality, easy to use program.

Re: Can I use QSV HW Accel from Linux GUI or command line ?

Posted: Fri Feb 22, 2019 10:37 pm
by JohnAStebbins
This thread spurred me to have another look at it. I got it working (both CLI and GUI) and have posted a PR for review https://github.com/HandBrake/HandBrake/pull/1922. You still have to build and install Intel's MediaSDK separately and you have to have all the proper libva*.so libraries installed from your repository for it work. But I might try enabling this in the Ubuntu nightly builds just to see what breaks. Whether this ever makes it to a release build will depend on how many problems pop up.

Re: Can I use QSV HW Accel from Linux GUI or command line ?

Posted: Thu Mar 07, 2019 5:50 pm
by amateur_ripper
First question - does QSV negatively impact quality? :)

I am trying to make QSV work in Ubuntu 18.04, but it doesn't seem to be working. What I've done so far:
- I built Media SDK according to these instructions, chose no optional items, used libva 2.4.0: https://github.com/Intel-Media-SDK/Medi ... -on-Ubuntu - it was placed in /opt/intel/mediasdk/
- I built Handbrake according to this manual https://handbrake.fr/docs/en/latest/dev ... linux.html and appended --enable-qsv

QSV doesn't seem to be used when I encode - just to be sure, what is the proper -e parameter when I want to use it for HEVC?

Re: Can I use QSV HW Accel from Linux GUI or command line ?

Posted: Thu Mar 07, 2019 6:43 pm
by JohnAStebbins
QSV is lower quality in general than the equivalent software encoder, but it's much faster. If you've been using the 'ultrafast' preset in a software encoder, then QSV might result in better quality than you've been getting. But if you use pretty much any other preset in a software encoder, you will have to live with either lower quality or larger files with QSV.

Regarding building with QSV support on linux, are you using the branch of the code that my QSV PR comes from? That branch fixes a few things that are necessary for QSV on linux to work.

Next, Intel's default install directory for mediasdk won't be found by the linux dynamic library loader. When running HandBrake, you'll have to set LD_LIBRARY_PATH=/opt/intel/mediasdk/lib64. You can either permanently add this to your environment, or you can specify it on the command line before the HandBrake exe name. e.g. when testing, I run it like this:

Code: Select all

LD_LIBRARY_PATH=/opt/intel/mediasdk/lib64 ghb
Once my PR gets approved and committed, we should be able to make HandBrake with QSV support available in the nightly builds.

Re: Can I use QSV HW Accel from Linux GUI or command line ?

Posted: Fri Mar 08, 2019 12:14 pm
by amateur_ripper
JohnAStebbins wrote:
Thu Mar 07, 2019 6:43 pm
If you've been using the 'ultrafast' preset in a software encoder
Nah, using slow.
JohnAStebbins wrote:
Thu Mar 07, 2019 6:43 pm
or larger files with QSV
How much larger are we talking?
JohnAStebbins wrote:
Thu Mar 07, 2019 6:43 pm
Regarding building with QSV support on linux, are you using the branch of the code that my QSV PR comes from? That branch fixes a few things that are necessary for QSV on linux to work.
No, can you tell me how to do that?
JohnAStebbins wrote:
Thu Mar 07, 2019 6:43 pm

Code: Select all

LD_LIBRARY_PATH=/opt/intel/mediasdk/lib64 ghb
Right now, this starts Handbrake GUI, but there is nothing about QSV in video encoders.

Re: Can I use QSV HW Accel from Linux GUI or command line ?

Posted: Fri Mar 08, 2019 3:18 pm
by Woodstock
When I last tested QSV vs. x264, I used "similar" settings for both. By that I mean simply changing the encoder used, leaving other settings the same, even though there isn't an exact match between quality settings between the two encoders.

My results were a 5% increase in size for the QSV-encoded file, consistent across several sources. The encode speed was phenomenal, on the order or 8-10 times the frames rate of x264, because I was not using any "slow" filters (slow filters reduce QSV frame rates). The quality difference was not significant to me. But the increased file size was.

Re: Can I use QSV HW Accel from Linux GUI or command line ?

Posted: Fri Mar 08, 2019 4:37 pm
by JohnAStebbins
amateur_ripper wrote:
Fri Mar 08, 2019 12:14 pm
JohnAStebbins wrote:
Thu Mar 07, 2019 6:43 pm
Regarding building with QSV support on linux, are you using the branch of the code that my QSV PR comes from? That branch fixes a few things that are necessary for QSV on linux to work.
No, can you tell me how to do that?

Code: Select all

git clone https://github.com/jstebbins/HandBrake.git HandBrake.jstebbins
cd HandBrake.jstebbins
git checkout origin/qsv -b qsv
mkdir build.qsv
cd build.qsv
../configure --enable-qsv
make -j8

Re: Can I use QSV HW Accel from Linux GUI or command line ?

Posted: Fri Mar 08, 2019 4:39 pm
by JohnAStebbins
Oh, but that is no longer necessary since the PR got committed to the master branch yesterday :mrgreen: Now you can do the same thing, but 'git clone' the official repo and no need to checkout a branch.

Re: Can I use QSV HW Accel from Linux GUI or command line ?

Posted: Fri Mar 08, 2019 4:43 pm
by JohnAStebbins
We will hopefully be building our nightlies with qsv enabled soon. With the flatpak nightlies there will be a mediasdk plugin so that you don't have to build and install that yourself. My suggestion would be to install flatpak and use our nightly flatpak bundles when they become available.

Re: Can I use QSV HW Accel from Linux GUI or command line ?

Posted: Fri Mar 08, 2019 5:00 pm
by JohnAStebbins
I just enabled qsv in the Ubuntu nightly builds and kicked off a build. Should be available on the PPA shortly, assuming I didn't fat-finger anything

Re: Can I use QSV HW Accel from Linux GUI or command line ?

Posted: Fri Mar 08, 2019 9:28 pm
by smaggard
Let us know when it hits the Ubuntu PPA, I will gladly test it on a couple 8th Gen i5's, one with an i630 one with an 655Plus.

Re: Can I use QSV HW Accel from Linux GUI or command line ?

Posted: Sat Mar 09, 2019 1:00 am
by JohnAStebbins
It hit the PPA about 20 minutes after I posted. So it's there now.

Re: Can I use QSV HW Accel from Linux GUI or command line ?

Posted: Sat Mar 09, 2019 12:19 pm
by smaggard
https://launchpad.net/~stebbins/+archiv ... e-releases is showing the last upload from 2/19, is the qsv in a differnet PPA?

Re: Can I use QSV HW Accel from Linux GUI or command line ?

Posted: Sat Mar 09, 2019 12:35 pm
by BradleyS

Re: Can I use QSV HW Accel from Linux GUI or command line ?

Posted: Sat Mar 09, 2019 12:54 pm
by smaggard
I installed from that PPA and I am not seeing qsv at all in the codec list, is there some prereq that I need to fulfill for this to work?

Re: Can I use QSV HW Accel from Linux GUI or command line ?

Posted: Sat Mar 09, 2019 3:40 pm
by JohnAStebbins
You still have to install Intel MediaSDK separately and make sure the shared libraries it creates are somewhere the system can find them.

Re: Can I use QSV HW Accel from Linux GUI or command line ?

Posted: Sat Mar 09, 2019 5:10 pm
by smaggard
MediaSDK is installed in /opt/intel/mediasdk/lib, and I have added that to my /etc/ld.so.conf.d/msdk.conf so it should be found., but when I apt install from the PPA I don't see what I expect.

Re: Can I use QSV HW Accel from Linux GUI or command line ?

Posted: Sat Mar 09, 2019 5:24 pm
by JohnAStebbins
This is why I made the previous comment here viewtopic.php?f=13&t=38624&p=183248#p182870

There are many things can go wrong in setting this up. Start out by showing us an activity log of HandBrake starting up. There might be some clue in that.

This is also why I created a MediaSDK plugin for our flatpak builds. We can distribute a known working tested and complete qsv environment this way. The best way for most people to have QSV on linux will ultimately be to use our flatpak builds once they become available. I think scott is still working on some build server issues to get this fully functioning.

Re: Can I use QSV HW Accel from Linux GUI or command line ?

Posted: Sat Mar 09, 2019 5:32 pm
by smaggard
if the flatpaks will be the best way, then I can wait for them

Re: Can I use QSV HW Accel from Linux GUI or command line ?

Posted: Sat Mar 09, 2019 5:53 pm
by JohnAStebbins
One thing, did you run ldconfig after adding /etc/ld.so.conf.d/msdk.conf? /etc/ld.so.cache is what's actually looks at to load libs and ldconfig updates this file.