feat: 添加ARM64 Rockchip硬件加速支持

- 集成Rockchip MPP和RGA硬件加速库
- 添加libx264和v4l2m2m支持
- 为不同架构优化FFmpeg依赖:
  * AMD64: 系统FFmpeg + Intel硬件加速
  * ARM: 系统FFmpeg
  * ARM64: 自编译FFmpeg + Rockchip硬件加速
This commit is contained in:
mofeng-git 2025-08-25 00:24:46 +08:00
parent 916a0483b4
commit 7ccac8bc9e
3 changed files with 52 additions and 18 deletions

View File

@ -9,6 +9,7 @@ COPY --from=builder /tmp/ustreamer/ustreamer /tmp/ustreamer/ustreamer-dump /usr/
COPY --from=builder /tmp/wheel/*.whl /tmp/wheel/
COPY --from=builder /tmp/ustreamer/libjanus_ustreamer.so /usr/lib/ustreamer/janus/
COPY --from=builder /usr/lib/janus/transports/* /usr/lib/janus/transports/
COPY --from=builder /opt/usr/ /usr/
ARG TARGETARCH
@ -43,12 +44,15 @@ RUN sed -i 's/deb.debian.org/mirrors.tuna.tsinghua.edu.cn/' /etc/apt/sources.lis
libasound2 \
nano \
unzip \
libavcodec59 \
libavformat59 \
libavutil57 \
libswscale6 \
libavfilter8 \
libavdevice59 \
&& if [ ${TARGETARCH} != arm64 ]; then \
apt-get install -y --no-install-recommends \
libavcodec59 \
libavformat59 \
libavutil57 \
libswscale6 \
libavfilter8 \
libavdevice59; \
fi \
&& if [ ${TARGETARCH} != arm ] && [ ${TARGETARCH} != arm64 ]; then \
apt-get install -y --no-install-recommends \
ffmpeg \

View File

@ -49,27 +49,36 @@ RUN sed -i 's/deb.debian.org/mirrors.tuna.tsinghua.edu.cn/' /etc/apt/sources.lis
libusb-1.0-0-dev \
libldap2-dev \
libsasl2-dev \
ffmpeg \
libavcodec-dev \
libavformat-dev \
libavutil-dev \
libswscale-dev \
libavfilter-dev \
libavdevice-dev \
vainfo \
libva-dev \
libva-drm2 \
libva-x11-2 \
libdrm-dev \
mesa-va-drivers \
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 \
&& if [ ${TARGETARCH} != arm ] && [ ${TARGETARCH} != arm64 ]; then \
apt-get install -y --no-install-recommends \
vainfo \
libva-dev \
libva-drm2 \
libva-x11-2 \
intel-media-va-driver \
i965-va-driver; \
fi \
&& if [ ${TARGETARCH} = arm64 ]; then \
apt-get install -y --no-install-recommends \
ninja-build \
zlib1g-dev \
libswresample-dev; \
fi \
&& apt clean \
&& rm -rf /var/lib/apt/lists/*
@ -131,6 +140,27 @@ RUN git clone --depth=1 https://gitlab.freedesktop.org/libnice/libnice /tmp/libn
&& cd /tmp \
&& rm -rf /tmp/janus-gateway
# 编译 Rockchip MPP、RGA 和 FFmpeg仅 arm64
RUN if [ ${TARGETARCH} = arm64 ]; then \
git clone --depth=1 https://github.com/rockchip-linux/mpp.git /tmp/mpp \
&& cd /tmp/mpp \
&& cmake -DRKPLATFORM=ON -DCMAKE_INSTALL_PREFIX=/usr . \
&& make -j$(nproc) \
&& make install \
&& make install DESTDIR=/opt \
&& git clone --depth=1 -b 1.9.1 https://github.com/airockchip/librga /tmp/librga \
&& cd /tmp/librga \
&& meson setup --prefix=/usr rkrga_build \
&& ninja -C rkrga_build install \
&& DESTDIR=/opt 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-alsa --enable-libv4l2 --enable-libx264 --enable-v4l2-m2m --disable-programs \
&& make -j$(nproc) \
&& make install \
&& make install DESTDIR=/opt; \
fi
# 编译 ustreamer
RUN echo "Building ustreamer with timestamp cache bust" \
&& sed --in-place --expression 's|^#include "refcount.h"$|#include "../refcount.h"|g' /usr/include/janus/plugins/plugin.h \

View File

@ -108,7 +108,7 @@ install_base_packages() {
iptables network-manager curl kmod libmicrohttpd12 libjansson4 libssl3 \\
libsofia-sip-ua0 libglib2.0-0 libopus0 libogg0 libcurl4 libconfig9 \\
python3-pip net-tools libavcodec59 libavformat59 libavutil57 libswscale6 \\
libavfilter8 libavdevice59 v4l-utils libv4l-0 && \\
libavfilter8 libavdevice59 v4l-utils libv4l-0 nano unzip && \\
apt clean && \\
rm -rf /var/lib/apt/lists/*
"