feat: 大幅优化 RKMPP 在 ustreamer 中的编解码性能

feat: 添加 DRM 初步支持

fix: 修复 OEC TURBO 硬件编解码设备权限错误
This commit is contained in:
mofeng-git 2025-09-28 15:24:25 +08:00
parent 0328163a9e
commit edb9112435
3 changed files with 28 additions and 26 deletions

View File

@ -68,8 +68,9 @@ RUN sed -i 's/deb.debian.org/mirrors.tuna.tsinghua.edu.cn/' /etc/apt/sources.lis
;; \
arm64) \
apt-get install -y --no-install-recommends \
v4l-utils libv4l-0 \
libstdc++6 \
v4l-utils libv4l-0 libavutil57 \
libstdc++6 libavcodec59 libavformat59 \
libswscale6 libavfilter8 libavdevice59 \
libva2 libva-drm2 libva-x11-2 \
libvdpau1 ocl-icd-libopencl1 \
;; \

View File

@ -54,16 +54,13 @@ RUN sed -i 's/deb.debian.org/mirrors.tuna.tsinghua.edu.cn/' /etc/apt/sources.lis
mesa-vdpau-drivers \
v4l-utils \
libv4l-dev \
&& if [ ${TARGETARCH} != arm64 ]; then \
apt-get install -y --no-install-recommends \
ffmpeg \
libavcodec-dev \
libavformat-dev \
libavutil-dev \
libswscale-dev \
libavfilter-dev \
libavdevice-dev; \
fi \
ffmpeg \
libavcodec-dev \
libavformat-dev \
libavutil-dev \
libswscale-dev \
libavfilter-dev \
libavdevice-dev \
&& if [ ${TARGETARCH} != arm ] && [ ${TARGETARCH} != arm64 ]; then \
apt-get install -y --no-install-recommends \
vainfo \
@ -148,7 +145,7 @@ RUN git clone --depth=1 https://gitlab.freedesktop.org/libnice/libnice /tmp/libn
# 编译 Rockchip MPP、RGA 和 FFmpeg仅 arm64
RUN if [ ${TARGETARCH} = arm64 ]; then \
git clone -b jellyfin-mpp --depth=1 https://github.com/nyanmisaka/mpp.git /tmp/rkmpp \
git clone --depth=1 https://github.com/rockchip-linux/mpp.git /tmp/rkmpp \
&& mkdir -p /tmp/rkmpp/rkmpp_build && cd /tmp/rkmpp/rkmpp_build \
&& cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DBUILD_TEST=OFF .. \
&& make -j$(nproc) \
@ -158,21 +155,17 @@ RUN if [ ${TARGETARCH} = arm64 ]; then \
&& meson setup rkrga rkrga_build --prefix=/usr --libdir=lib --buildtype=release -Dcpp_args=-fpermissive -Dlibdrm=false -Dlibrga_demo=false \
&& meson configure rkrga_build > /dev/null \
&& ninja -C rkrga_build install \
&& git clone --depth=1 https://github.com/nyanmisaka/ffmpeg-rockchip.git /tmp/ffmpeg-rockchip \
&& cd /tmp/ffmpeg-rockchip \
&& ./configure --prefix=/usr --enable-gpl --enable-version3 --enable-libdrm --enable-rkmpp --enable-rkrga \
--enable-libv4l2 --enable-libx264 --enable-shared --disable-programs \
--disable-doc --disable-htmlpages --disable-manpages --disable-network --disable-protocols \
--disable-decoders --disable-debug --disable-alsa \
&& make -j$(nproc) \
&& make install \
&& rm -rf /tmp/rkmpp /tmp/rkrga /tmp/ffmpeg-rockchip; \
&& rm -rf /tmp/rkmpp /tmp/rkrga; \
fi
# 编译 ustreamer
RUN sed --in-place --expression 's|^#include "refcount.h"$|#include "../refcount.h"|g' /usr/include/janus/plugins/plugin.h \
&& git clone --depth=1 https://github.com/mofeng-git/ustreamer /tmp/ustreamer \
&& make -j$(nproc) WITH_PYTHON=1 WITH_JANUS=1 WITH_FFMPEG=1 -C /tmp/ustreamer \
&& if [ ${TARGETARCH} = arm64 ]; then \
make -j$(nproc) WITH_PYTHON=1 WITH_JANUS=1 WITH_FFMPEG=1 WITH_MPP=1 -C /tmp/ustreamer; \
else \
make -j$(nproc) WITH_PYTHON=1 WITH_JANUS=1 WITH_FFMPEG=1 -C /tmp/ustreamer; \
fi \
&& /tmp/ustreamer/ustreamer -v \
&& /tmp/ustreamer/ustreamer-dump -v \
&& cp /tmp/ustreamer/python/dist/*.whl /tmp/wheel/
@ -186,9 +179,8 @@ RUN mkdir /tmp/lib \
&& find /usr/lib -name "libsrtp2.so.*" -exec cp {} /tmp/lib/ \; \
&& find /usr/lib -name "libwebsockets.so.*" -exec cp {} /tmp/lib/ \; \
&& if [ ${TARGETARCH} = arm64 ]; then \
find /usr/lib -name "libav*.so.*" -exec cp {} /tmp/lib/ \; \
&& find /usr/lib -name "libsw*.so.*" -exec cp {} /tmp/lib/ \; \
find /usr/lib -name "libsw*.so.*" -exec cp {} /tmp/lib/ \; \
&& find /usr/lib -name "libpostproc.so.*" -exec cp {} /tmp/lib/ \; \
&& find /usr/lib -name "librockchip*" -exec cp {} /tmp/lib/ \; \
&& find /usr/lib -name "librga.so.*" -exec cp {} /tmp/lib/ \; ; \
fi
fi

View File

@ -374,6 +374,15 @@ config_oec_turbo_files() {
echo "信息:配置 VPU 硬件编码支持..."
run_in_chroot "sed -i 's/--h264-hwenc=disabled/--h264-hwenc=rkmpp/g' /etc/kvmd/override.yaml"
# 配置 rc.local 自启脚本,添加设备权限设置
echo "信息:配置 rc.local 自启脚本..."
run_in_chroot "cat > /etc/rc.local << 'EOF'
#!/bin/bash
chmod 777 /dev/mpp_service /dev/rga
exit 0
EOF"
run_in_chroot "chmod +x /etc/rc.local"
# 替换 DTB 文件
replace_oec_turbo_dtb