mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2025-12-14 02:00:32 +08:00
feat: 大幅优化 RKMPP 在 ustreamer 中的编解码性能
feat: 添加 DRM 初步支持 fix: 修复 OEC TURBO 硬件编解码设备权限错误
This commit is contained in:
parent
0328163a9e
commit
edb9112435
@ -68,8 +68,9 @@ RUN sed -i 's/deb.debian.org/mirrors.tuna.tsinghua.edu.cn/' /etc/apt/sources.lis
|
|||||||
;; \
|
;; \
|
||||||
arm64) \
|
arm64) \
|
||||||
apt-get install -y --no-install-recommends \
|
apt-get install -y --no-install-recommends \
|
||||||
v4l-utils libv4l-0 \
|
v4l-utils libv4l-0 libavutil57 \
|
||||||
libstdc++6 \
|
libstdc++6 libavcodec59 libavformat59 \
|
||||||
|
libswscale6 libavfilter8 libavdevice59 \
|
||||||
libva2 libva-drm2 libva-x11-2 \
|
libva2 libva-drm2 libva-x11-2 \
|
||||||
libvdpau1 ocl-icd-libopencl1 \
|
libvdpau1 ocl-icd-libopencl1 \
|
||||||
;; \
|
;; \
|
||||||
|
|||||||
@ -54,16 +54,13 @@ RUN sed -i 's/deb.debian.org/mirrors.tuna.tsinghua.edu.cn/' /etc/apt/sources.lis
|
|||||||
mesa-vdpau-drivers \
|
mesa-vdpau-drivers \
|
||||||
v4l-utils \
|
v4l-utils \
|
||||||
libv4l-dev \
|
libv4l-dev \
|
||||||
&& if [ ${TARGETARCH} != arm64 ]; then \
|
ffmpeg \
|
||||||
apt-get install -y --no-install-recommends \
|
libavcodec-dev \
|
||||||
ffmpeg \
|
libavformat-dev \
|
||||||
libavcodec-dev \
|
libavutil-dev \
|
||||||
libavformat-dev \
|
libswscale-dev \
|
||||||
libavutil-dev \
|
libavfilter-dev \
|
||||||
libswscale-dev \
|
libavdevice-dev \
|
||||||
libavfilter-dev \
|
|
||||||
libavdevice-dev; \
|
|
||||||
fi \
|
|
||||||
&& if [ ${TARGETARCH} != arm ] && [ ${TARGETARCH} != arm64 ]; then \
|
&& if [ ${TARGETARCH} != arm ] && [ ${TARGETARCH} != arm64 ]; then \
|
||||||
apt-get install -y --no-install-recommends \
|
apt-get install -y --no-install-recommends \
|
||||||
vainfo \
|
vainfo \
|
||||||
@ -148,7 +145,7 @@ RUN git clone --depth=1 https://gitlab.freedesktop.org/libnice/libnice /tmp/libn
|
|||||||
|
|
||||||
# 编译 Rockchip MPP、RGA 和 FFmpeg(仅 arm64)
|
# 编译 Rockchip MPP、RGA 和 FFmpeg(仅 arm64)
|
||||||
RUN if [ ${TARGETARCH} = arm64 ]; then \
|
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 \
|
&& 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 .. \
|
&& cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DBUILD_TEST=OFF .. \
|
||||||
&& make -j$(nproc) \
|
&& 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 setup rkrga rkrga_build --prefix=/usr --libdir=lib --buildtype=release -Dcpp_args=-fpermissive -Dlibdrm=false -Dlibrga_demo=false \
|
||||||
&& meson configure rkrga_build > /dev/null \
|
&& meson configure rkrga_build > /dev/null \
|
||||||
&& ninja -C rkrga_build install \
|
&& ninja -C rkrga_build install \
|
||||||
&& git clone --depth=1 https://github.com/nyanmisaka/ffmpeg-rockchip.git /tmp/ffmpeg-rockchip \
|
&& rm -rf /tmp/rkmpp /tmp/rkrga; \
|
||||||
&& 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; \
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# 编译 ustreamer
|
# 编译 ustreamer
|
||||||
RUN sed --in-place --expression 's|^#include "refcount.h"$|#include "../refcount.h"|g' /usr/include/janus/plugins/plugin.h \
|
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 \
|
&& 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 -v \
|
||||||
&& /tmp/ustreamer/ustreamer-dump -v \
|
&& /tmp/ustreamer/ustreamer-dump -v \
|
||||||
&& cp /tmp/ustreamer/python/dist/*.whl /tmp/wheel/
|
&& 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 "libsrtp2.so.*" -exec cp {} /tmp/lib/ \; \
|
||||||
&& find /usr/lib -name "libwebsockets.so.*" -exec cp {} /tmp/lib/ \; \
|
&& find /usr/lib -name "libwebsockets.so.*" -exec cp {} /tmp/lib/ \; \
|
||||||
&& if [ ${TARGETARCH} = arm64 ]; then \
|
&& 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 "libpostproc.so.*" -exec cp {} /tmp/lib/ \; \
|
||||||
&& find /usr/lib -name "librockchip*" -exec cp {} /tmp/lib/ \; \
|
&& find /usr/lib -name "librockchip*" -exec cp {} /tmp/lib/ \; \
|
||||||
&& find /usr/lib -name "librga.so.*" -exec cp {} /tmp/lib/ \; ; \
|
&& find /usr/lib -name "librga.so.*" -exec cp {} /tmp/lib/ \; ; \
|
||||||
fi
|
fi
|
||||||
@ -374,6 +374,15 @@ config_oec_turbo_files() {
|
|||||||
echo "信息:配置 VPU 硬件编码支持..."
|
echo "信息:配置 VPU 硬件编码支持..."
|
||||||
run_in_chroot "sed -i 's/--h264-hwenc=disabled/--h264-hwenc=rkmpp/g' /etc/kvmd/override.yaml"
|
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 文件
|
# 替换 DTB 文件
|
||||||
replace_oec_turbo_dtb
|
replace_oec_turbo_dtb
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user