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

Support for HandBrake on Linux, Solaris, and other Unix-like platforms
Forum rules
An Activity Log is required for support requests. Please read How-to get an activity log? for details on how and why this should be provided.
Gedeon
Posts: 2
Joined: Fri Jan 11, 2019 8:08 am

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

Post 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
User avatar
BradleyS
Moderator
Posts: 1860
Joined: Thu Aug 09, 2007 12:16 pm

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

Post by BradleyS »

For instructions on building HandBrake for Linux with experimental QSV support, see https://handbrake.fr/docs/en/latest/dev ... linux.html
gene308
Posts: 2
Joined: Thu Feb 21, 2019 5:24 pm

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

Post 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.
rollin_eng
Veteran User
Posts: 4840
Joined: Wed May 04, 2011 11:06 pm

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

Post 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.
User avatar
JohnAStebbins
HandBrake Team
Posts: 5712
Joined: Sat Feb 09, 2008 7:21 pm

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

Post 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.
gene308
Posts: 2
Joined: Thu Feb 21, 2019 5:24 pm

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

Post 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.
User avatar
JohnAStebbins
HandBrake Team
Posts: 5712
Joined: Sat Feb 09, 2008 7:21 pm

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

Post 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.
amateur_ripper
Posts: 5
Joined: Thu Mar 07, 2019 5:36 pm

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

Post 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?
User avatar
JohnAStebbins
HandBrake Team
Posts: 5712
Joined: Sat Feb 09, 2008 7:21 pm

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

Post 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.
amateur_ripper
Posts: 5
Joined: Thu Mar 07, 2019 5:36 pm

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

Post by amateur_ripper »

JohnAStebbins wrote: Thu Mar 07, 2019 6:43 pmIf you've been using the 'ultrafast' preset in a software encoder
Nah, using slow.
JohnAStebbins wrote: Thu Mar 07, 2019 6:43 pmor larger files with QSV
How much larger are we talking?
JohnAStebbins wrote: Thu Mar 07, 2019 6:43 pmRegarding 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.
Woodstock
Veteran User
Posts: 4614
Joined: Tue Aug 27, 2013 6:39 am

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

Post 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.
User avatar
JohnAStebbins
HandBrake Team
Posts: 5712
Joined: Sat Feb 09, 2008 7:21 pm

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

Post by JohnAStebbins »

amateur_ripper wrote: Fri Mar 08, 2019 12:14 pm
JohnAStebbins wrote: Thu Mar 07, 2019 6:43 pmRegarding 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
User avatar
JohnAStebbins
HandBrake Team
Posts: 5712
Joined: Sat Feb 09, 2008 7:21 pm

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

Post 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.
User avatar
JohnAStebbins
HandBrake Team
Posts: 5712
Joined: Sat Feb 09, 2008 7:21 pm

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

Post 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.
User avatar
JohnAStebbins
HandBrake Team
Posts: 5712
Joined: Sat Feb 09, 2008 7:21 pm

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

Post 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
smaggard
Posts: 7
Joined: Fri Mar 08, 2019 9:27 pm

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

Post 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.
User avatar
JohnAStebbins
HandBrake Team
Posts: 5712
Joined: Sat Feb 09, 2008 7:21 pm

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

Post by JohnAStebbins »

It hit the PPA about 20 minutes after I posted. So it's there now.
smaggard
Posts: 7
Joined: Fri Mar 08, 2019 9:27 pm

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

Post by smaggard »

https://launchpad.net/~stebbins/+archiv ... e-releases is showing the last upload from 2/19, is the qsv in a differnet PPA?
smaggard
Posts: 7
Joined: Fri Mar 08, 2019 9:27 pm

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

Post 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?
User avatar
JohnAStebbins
HandBrake Team
Posts: 5712
Joined: Sat Feb 09, 2008 7:21 pm

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

Post 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.
smaggard
Posts: 7
Joined: Fri Mar 08, 2019 9:27 pm

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

Post 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.
User avatar
JohnAStebbins
HandBrake Team
Posts: 5712
Joined: Sat Feb 09, 2008 7:21 pm

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

Post 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.
smaggard
Posts: 7
Joined: Fri Mar 08, 2019 9:27 pm

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

Post by smaggard »

if the flatpaks will be the best way, then I can wait for them
User avatar
JohnAStebbins
HandBrake Team
Posts: 5712
Joined: Sat Feb 09, 2008 7:21 pm

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

Post 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.
Post Reply