• Welcome to LiuJason's Blog!

树莓派RaspberryPi 4B设置显存开启硬件加速 支持Emby|Plex|JellyFin转码

未分类 Jason 5 years ago (2020-03-16) 2843 Views 0 Comments
文章目录[隐藏]

前言

尝试在树莓派上装Emby,然后转码播放1080P的视频,发现非常非常非常的卡,一看CPU....全满了:

但是RaspberryPi本身硬件是支持硬解码的,所以需要做一些配置来开启功能。

升级内核固件

pi@raspberrypi:/ $ sudo rpi-update
 *** Raspberry Pi firmware updater by Hexxeh, enhanced by AndrewS and Dom
 *** Performing self-update
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 18058  100 18058    0     0  59794      0 --:--:-- --:--:-- --:--:-- 59794
 *** Relaunching after update
 *** Raspberry Pi firmware updater by Hexxeh, enhanced by AndrewS and Dom
 *** We're running for the first time
 *** Backing up files (this will take a few minutes)
 *** Backing up firmware
 *** Backing up modules 4.19.97-v7l+
#############################################################
WARNING: 'rpi-update' updates to pre-releases of the linux 
kernel tree and Videocore firmware.

'rpi-update' should only be used if there is a specific 
reason to do so - for example, a request by a Raspberry Pi 
engineer.

DO NOT use 'rpi-update' as part of a regular update process.

##############################################################
Would you like to proceed? (y/N)
 *** Downloading specific firmware revision (this will take a few minutes)
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   168  100   168    0     0   1083      0 --:--:-- --:--:-- --:--:--  1083
100  115M    0  115M    0     0  2911k      0 --:--:--  0:00:40 --:--:-- 3233k
 *** Updating firmware
 *** Updating kernel modules
 *** depmod 4.19.108-v8+
 *** depmod 4.19.108-v7l+
 *** depmod 4.19.108+
 *** depmod 4.19.108-v7+
 *** Updating VideoCore libraries
 *** Using HardFP libraries
 *** Updating SDK
 *** Running ldconfig
 *** Storing current firmware revision
 *** Deleting downloaded files
 *** Syncing changes to disk
 *** If no errors appeared, your firmware was successfully updated to b524f5e7ace11ed7500fc39e63247fe9756fbddf
 *** A reboot is needed to activate the new firmware

这里先不要重启,先修改一下显存大小,在sudo nano /boot/config.txt中增加一行:

gpu_mem=320

然后重启树莓派,重启后查看一下GPU显存的情况:

pi@raspberrypi:~ $ vcgencmd get_mem arm && vcgencmd get_mem gpu
arm=704M
gpu=320M

设置Docker硬件(可选)


另外volume也要加上这个:/opt/vc/lib:/opt/vc/lib

开启硬件加速


之后验证一下,在JellyFin后台Dashboard > Logs里面点击ffmpeg-transcode日志,查看Stream mapping信息:

Stream mapping:
  Stream #0:0 (hevc) -> overlay:main (graph 0)
  Stream #0:4 (pgssub) -> scale (graph 0)
  scale (graph 0) -> Stream #0:0 (h264_omx)
  Stream #0:1 -> #0:1 (dts (dca) -> mp3 (libmp3lame))

可以看到使用了h264_omx硬件加速~实际CPU的压力也小了很多


This article is under CC BY-NC-SA 4.0 license.
Please quote the original link:https://www.liujason.com/article/656.html
Like (2)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址