缺点:可能是更新了内核或其他组件,kvm VM cpu类型只有host是正常使用的。

难点:安装Mesa开源驱动

思路:创建media-server容器(自带jellyfin) --> 宿主机与容器均安装最新mesa驱动(版本要一致) --> 安装最新FFpmeg --> 允许容器使用显卡(linux万物基于文件,给容器访问权限即可)--> 配置jellyfin

https://jellyfin.org/docs/general/administration/hardware-acceleration.html
QQ截图20210520154318.png

https://wiki.archlinux.org/title/Hardware_video_acceleration#Comparison_tables
AMD GPU需要开源驱动程序Mesa 20.1或更高版本才能支持硬件解码HEVC。 (仅支持如下编码方式)
H.264/MPEG-4 AVC Radeon HD 7000 and newer
H.265/HEVC 8bit Radeon 400 and newer
H.265/HEVC 10bit Raven Ridge and newer

安装Mesa驱动

有点难,需要完善

nano /etc/apt/sources.list
# debian10镜像源 mesa驱动为18
#deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster main contrib non-free
#deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-updates main contrib non-free
#deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-backports main contrib non-free
#deb https://mirrors.tuna.tsinghua.edu.cn/debian-security buster/updates main contrib non-free
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free
# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free

过于简单粗暴,不太可取需要一起研究研究,没找到更新mesa驱动相关教程

apt-get update
apt install mesa*


允许LXC虚拟机使用核显

ls -la /dev/dri 获取id 我的是226,修改conf文件路径/etc/pve/nodes/<节点名称>/lxc
我的LXC虚拟机是101.conf
QQ截图20210520160529.png

arch: amd64 
cores: 4 
hostname: mediaserver 
memory: 4096 
mp0:/dev/sdc1,mp=/media/shared 
net0:name=eth0,bridge=vmbr0,firewall=1,gw=192.168.1.1,hwaddr=C6:ED:D6:AD:58:5E,ip=192.168.1.2
onboot: 1 
ostype: debian 
rootfs: local-lvm:vm-101-disk-0,size=100G
swap: 512 
lxc.cgroup.devices.allow: c 226:0 rwm
lxc.cgroup.devices.allow: c 226:128 rwm 
lxc.mount.entry: /dev/dri
dev/dri none bind,optional,create=dir

安装最新稳定版FFmpeg

修改jellyfin参数

/dev/dri/renderd128或/dev/dri/card0 (自己测试哪个好使,看大多数教程都是intel的选的是renderd128,但是我用不好使,卡了我两天,最后哎就是玩儿~,直接选card0,算是打通了APU硬件加速全流程)

填写刚刚安装的FFmpeg路径

滑到最下面点保存

打开视频选择清晰度,再点数据信息,查看是否转码成功。

配置SSL证书(公网使用最好使用SSL加密,以防出现断流问题)

mkdir /etc/ssl/jellyfin
SSL_PASSWORD=
CERT_PATH=/etc/ssl/jellyfin/cert.pfx
openssl pkcs12 -export -out $CERT_PATH -inkey /etc/ssl/private/cert.key -in /etc/ssl/private/cert.pem -password pass:$SSL_PASSWORD
chmod +r $CERT_PATH
JELLYFIN_CONF=/etc/jellyfin/system.xml
sed -i '/<CertificatePath*/d' $JELLYFIN_CONF
sed -i '/<CertificatePassword*/d' $JELLYFIN_CONF
sed -i "/<\/ServerConfiguration/i \ <CertificatePath>$CERT_PATH</CertificatePath>\n <CertificatePassword>$SSL_PASSWORD</CertificatePassword>" $JELLYFIN_CONF

Last modification:May 20th, 2021 at 04:51 pm
如果觉得我的文章对你有用,请随意赞赏