Enabling QSV in ARM Docker Container #1120
Replies: 2 comments 1 reply
-
I didn't have the two files I wanted to include when I posted the original message. Here they are:
Place this file in the CONFIG folder, flag it Execute, get to a shell prompt inside the ARM docker container (I use Portainer), and type ./config/enable-qsv.sh and the QSV support will be installed. no restart of the container is required. This assumes QSV is configured properly on the host. To include QSV support during the ARM docker image build, there is documentation in the .sh file itself, but basically copy the lines: apt install -qqy intel-media-va-driver-non-free to line 24 before cleanup in install_mkv_hb_deps.sh in arm-dependencies/scripts compose.yaml.zip Let me know if there are any questions. I have not yet done any extensive testing, but it all seems to work. Hope this helps somebody. |
Beta Was this translation helpful? Give feedback.
-
One last comment I forgot - there are devices that need to be exposed to the container from the host. They are:
These are in the docker compose file but if you don't use compose, they will need to be included on the docker command line that starts up the container. Basically, the flow is: Handbrake in the ARM Docker container talks to the Intel Media SDK, which in turn talks to 'intel-media-va-driver-non-free', which in turn talks to the two /dev/dri devices which then get passed out to the corresponding devices on the host which then talk to the actual GPU (QSV). |
Beta Was this translation helpful? Give feedback.
-
I've worked with ARM since autumn 2023 and one thing that never seemed to work reliably was QSV support in the Docker container. Only once did I get the QSV indicator on the ARM main page to light green and it quit quickly thereafter and I was never able to replicate that. I used the ubuntu-quicksync.sh script on the host, from within the container, all kind of other things and nothing seemed to work again.
I decided to do a non-docker or manual or bare-metal ARM install onto a clean install of Ubuntu 22.04 and go from there. Very quickly I had success with a QSV enabled install of ARM. I found I didn't end up really using QSV, but it was working and it was quite the performance improvement when used.
I detailed that adventure in the post entitled 'My recent ARM experience with Ubuntu 22.04 bare (no Docker) and Handbrake custom profiles - I hope it helps somebody.'. From the response, it seems it was helpful for some and I'm glad for that.
However, I am a fan of Docker and the path forward for the project is definitely ARM in a Docker container.
This QSV thing was still bugging me. I figured it cant be THAT hard to get it going, so I decided to work on it by building the Docker image from scratch and seeing what needed to be done to get it working.
I pulled the project and found that the build process had some issues. That was reported and got quickly resolved and I got to work.
Great Support!!
3 things need to be in place for QSV support and one was already there - Handbrake was being built with QSV support enabled. That left getting the interface to the GPU in place and getting the software support for QSV into place.
The interface to the GPU is provided by installing 'intel-media-va-driver'. 'intel-media-va-driver' comes in two flavors, one is open sourced (intel-media-va-driver) and the other has closed source enhancements/extensions (intel-media-va-driver-non-free).
The software support for QSV is provided by the 'Intel Media SDK'. That can be found at 'Intel Media Stack on Ubuntu' - https://github.com/Intel-Media-SDK/MediaSDK/wiki/Intel-media-stack-on-Ubuntu.
I decided to first try loading this support into the ARM Docker container by accessing the container using Portainer and getting to a shell prompt, installing these modules, and seeing what happens.
All this being said, --
I created a script called 'enable-qsv.sh' that runs 'apt update', installs one of the 'intel-media-va-driver' versions, and installs the 'Intel Media SDK'.
I copied it to the ARM 'config' folder, and flagged it 'Execute'.
I got into Portainer and got to a prompt in the ARM Docker container
I typed in './config/enable-qsv.sh' and let it run. It only adds about 68 meg to the container, so it ran quickly. No errors.
I exited the shell back to Portainer.
I fired up a browser, went to the ARM :8080 page and... Success..!! the QSV status indicator was green!
Was it really so, was there really QSV support?
I went back to the container and gained access to the prompt, and this time I typed - 'HandBrakeCLI --help | grep -A12 "Select video encoder" '. There was a list of supported encoders and it included qsv_h264 and qsv_h265. Great!
One thing I did discover was that Handbrake seems to require the 'non-free' driver 'intel-media-va-driver-non-free' and the additional functionality it provides. Loading the 'free' driver and the Media SDK will light up the ARM QSV green indicator on the front browser status page (it sees some QSV support), but with that config, Handbrake does not see the enhanced QSV support, Handbrake only sees that when using the 'non-free' media drivers. Sorry to the purists, but that's out of my control.
So now it seemed like I could get QSV support going in the ARM Docker container by running this script, but I sure didn't want to have to run a .sh script every time I need to recreate the container, so I need to build an image with these changes.
Looking the .sh script I created, there's only 3 lines, all 'apt install' type lines, that need to get into the docker build. Since they are all related to Handbrake and could be considered a dependency to proper or complete functionality of Handbrake, I added the lines to the script file 'install_mkv_hb_deps.sh' in arm-dependencies/scripts at line 24 just before cleanup.
I built arm-dependencies, built automatic-ripping-machine and recreated the container. Now everything was reporting QSV support without the trouble of running any scripts.
I haven't ripped any disks as a test yet, I'll be doing that this evening (it was late by the time I was satisfied with how this all ended up), but I don't anticipate any issues. My changes seem to be fairly minor and are just additional modules.
All in all some fairly minor changes that will give QSV support for ARM in a Docker container.
As a bonus, I now fire up ARM through Portainer using a Docker-Compose script.
Sorry this was so long.
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions