Skip to content

Commit 9f1b0a4

Browse files
authored
feat: Add vaapi packages to enable hardware-accelerated playback (#44)
* feat: Add vaapi packages to enable hardware-accelerated playback * feat: Add nvtop to help test video acceleration * docs: Add steps for configuring video acceleration in Firefox
1 parent 303bf28 commit 9f1b0a4

File tree

2 files changed

+43
-3
lines changed

2 files changed

+43
-3
lines changed

Containerfile

+21-3
Original file line numberDiff line numberDiff line change
@@ -85,21 +85,39 @@ RUN KERNEL_VERSION="$(rpm -q kernel --queryformat '%{VERSION}-%{RELEASE}.%{ARCH}
8585
rpm-ostree install \
8686
https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm \
8787
https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm \
88-
&& \
89-
sed -i 's@enabled=1@enabled=0@g' /etc/yum.repos.d/rpmfusion-free{,-updates}.repo \
9088
&& \
9189
rpm-ostree install \
9290
xorg-x11-drv-${NVIDIA_PACKAGE_NAME}-{,cuda-,devel-,kmodsrc-,power-}${NVIDIA_FULL_VERSION} \
9391
kernel-devel-${KERNEL_VERSION} nvidia-container-toolkit \
9492
"/tmp/akmods/${NVIDIA_PACKAGE_NAME}/kmod-${NVIDIA_PACKAGE_NAME}-${KERNEL_VERSION}-${NVIDIA_FULL_VERSION#*:}.rpm" \
9593
/tmp/ublue-os-nvidia-addons/rpmbuild/RPMS/noarch/ublue-os-nvidia-addons-*.rpm \
94+
&& \
95+
rpm-ostree override remove $(rpm -qa --queryformat='%{NAME} ' \
96+
mesa-va-drivers \
97+
libavutil-free \
98+
libswscale-free \
99+
libswresample-free \
100+
libavformat-free \
101+
libavcodec-free \
102+
libavfilter-free \
103+
libavdevice-free \
104+
libpostproc-free) \
105+
--install=mesa-va-drivers-freeworld \
106+
--install=mesa-vdpau-drivers-freeworld \
107+
--install=libva-intel-driver \
108+
--install=nvtop \
109+
--install=nvidia-vaapi-driver \
110+
--install=ffmpeg-libs \
111+
--install=ffmpeg \
112+
--install=libavcodec-freeworld \
113+
--install=libva-utils \
96114
&& \
97115
mv /etc/nvidia-container-runtime/config.toml{,.orig} && \
98116
cp /etc/nvidia-container-runtime/config{-rootless,}.toml \
99117
&& \
100118
semodule --verbose --install /usr/share/selinux/packages/nvidia-container.pp \
101119
&& \
102-
sed -i 's@enabled=1@enabled=0@g' /etc/yum.repos.d/rpmfusion-nonfree{,-updates}.repo \
120+
sed -i 's@enabled=1@enabled=0@g' /etc/yum.repos.d/rpmfusion-{,non}free{,-updates}.repo \
103121
&& \
104122
ln -s /usr/bin/ld.bfd /etc/alternatives/ld && \
105123
ln -s /etc/alternatives/ld /usr/bin/ld \

README.md

+22
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,28 @@ $ podman run \
125125
docker.io/mirrorgooglecontainers/cuda-vector-add:v0.1
126126
```
127127
128+
## Video playback
129+
130+
Additional runtime packages are added for enabling hardware-accelerated video playback. This can the enabled in Firefox (RPM or flatpak) by setting the following options to `true` in `about:config`:
131+
132+
* `gfx.webrender.all`
133+
* `media.ffmpeg.vaapi.enabled`
134+
135+
136+
Extensive host access and reduced sandboxing is needed for Firefox flatpak to use `/usr/lib64/dri/nvidia_drv_video.so`:
137+
138+
```
139+
$ flatpak override \
140+
--user \
141+
--filesystem=host-os \
142+
--env=LIBVA_DRIVER_NAME=nvidia \
143+
--env=LIBVA_DRIVERS_PATH=/run/host/usr/lib64/dri \
144+
--env=LIBVA_MESSAGING_LEVEL=1 \
145+
--env=MOZ_DISABLE_RDD_SANDBOX=1 \
146+
--env=NVD_BACKEND=direct \
147+
org.mozilla.firefox
148+
```
149+
128150
## Acknowledgements
129151
130152
Thanks to Alex Diaz for advice, and who got this working first, check out this repo:

0 commit comments

Comments
 (0)