Skip to content

Instantly share code, notes, and snippets.

@pulsejet
Last active September 28, 2023 00:58
Show Gist options
  • Save pulsejet/4d81c1356703b2c8ba19c1ca9e6f6e50 to your computer and use it in GitHub Desktop.
Save pulsejet/4d81c1356703b2c8ba19c1ca9e6f6e50 to your computer and use it in GitHub Desktop.
Install QSV in debian docker
#!/bin/bash
sudo apt-get update
sudo apt-get remove -y libva ffmpeg
sudo apt-get install -y \
autoconf libtool libdrm-dev xorg xorg-dev openbox \
libx11-dev libgl1-mesa-glx libgl1-mesa-dev \
xcb libxcb-xkb-dev x11-xkb-utils libx11-xcb-dev \
libxkbcommon-x11-dev libxcb-dri3-dev \
vim cmake git nasm build-essential
mkdir qsvbuild
cd qsvbuild
git clone --depth 1 --branch 2.17.0 https://github.com/intel/libva
cd libva
./autogen.sh
make
sudo make install
sudo ldconfig
cd ..
git clone --depth 1 --branch intel-gmmlib-22.3.4 https://github.com/intel/gmmlib
cd gmmlib
mkdir build && cd build
cmake ..
make -j"$(nproc)"
sudo make install
sudo ldconfig
cd ../..
git clone --depth 1 --branch intel-media-22.6.6 https://github.com/intel/media-driver
mkdir -p build_media
cd build_media
cmake ../media-driver
make -j"$(nproc)"
sudo make install
sudo ldconfig
cd ..
git clone --depth 1 --branch n6.0 https://github.com/FFmpeg/FFmpeg
cd FFmpeg
./configure --enable-nonfree
make -j"$(nproc)"
sudo make install
sudo ldconfig
cd ..
cd ..
rm -rf qsvbuild
rm -rf /var/lib/apt/lists/*
@lmgarret
Copy link

Thanks for the snippet! This is the only way I could have QSV working with an Alder Lake CPU in debian bullseye.

I think there are just 2 things you may want to adjust here:

  1. In order to build intel/media-driver I also needed to apt install build-essential
  2. L12 you mkdir qsvbuild but never cd in it, so L49 rm -rf qsvbuild doesn't remove all the repos/build folders as I guess it should do

@pulsejet
Copy link
Author

pulsejet commented Mar 8, 2023

Thanks @lmgarret, updated.

@ChildLearningClub
Copy link

ChildLearningClub commented Sep 28, 2023

Running this exact Dockerfile:

FROM nextcloud:25

# Enable QSV support
SHELL ["/bin/bash", "-c"]
RUN apt-get update && \
    apt-get install -y sudo curl git && \
    rm -rf /var/lib/apt/lists/*
RUN curl https://gist.githubusercontent.com/pulsejet/4d81c1356703b2c8ba19c1ca9e6f6e50/raw/qsv-docker.sh | bash

results in a keyboard layout prompt during the build that can only be bypassed by including:

# Set DEBCONF_NONINTERACTIVE_SEEN to true
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections

The final Dockerfile looks like this:

FROM nextcloud:25

# Set DEBCONF_NONINTERACTIVE_SEEN to true
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections

# Enable QSV support
SHELL ["/bin/bash", "-c"]
RUN apt-get update && \
    apt-get install -y sudo curl git && \
    rm -rf /var/lib/apt/lists/*
RUN curl https://gist.githubusercontent.com/pulsejet/4d81c1356703b2c8ba19c1ca9e6f6e50/raw/qsv-docker.sh | bash

When I run with the latest version on Nextcloud:

FROM nextcloud:latest

# Enable QSV support
SHELL ["/bin/bash", "-c"]
RUN apt-get update && \
    apt-get install -y sudo curl git && \
    rm -rf /var/lib/apt/lists/*
RUN curl https://gist.githubusercontent.com/pulsejet/4d81c1356703b2c8ba19c1ca9e6f6e50/raw/qsv-docker.sh | bash

Within Memories Admin I see:

File Support:
ffmpeg preview binary not found. Thumbnail generation may not work for videos.

Video Streaming:
ffmpeg binary not found.
ffprobe binary not found.

So this is not intended to work with newer versions of Nextcloud or am I missing something?

@pulsejet
Copy link
Author

pulsejet commented Sep 28, 2023

@ChildLearningClub if you're using docker, I recommend using an external transcoder. The Dockerfile for go-vod takes care of this issue directly.

A RUN would create a separate layer IIRC. So all you need is ENV DEBIAN_FRONTEND=noninteractive before the curl

@ChildLearningClub
Copy link

okay, thank you @pulsejet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment