rn

 

rnrnrnrn
rn
rn
rnrnrnrn

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

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

rnrnrnrn

升级内核固件

rnrnrnrn
pi@raspberrypi:/ $ sudo rpi-updatern *** Raspberry Pi firmware updater by Hexxeh, enhanced by AndrewS and Domrn *** Performing self-updatern  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Currentrn                                 Dload  Upload   Total   Spent    Left  Speedrn100 18058  100 18058    0     0  59794      0 --:--:-- --:--:-- --:--:-- 59794rn *** Relaunching after updatern *** Raspberry Pi firmware updater by Hexxeh, enhanced by AndrewS and Domrn *** We're running for the first timern *** Backing up files (this will take a few minutes)rn *** Backing up firmwarern *** Backing up modules 4.19.97-v7l+rn#############################################################rnWARNING: 'rpi-update' updates to pre-releases of the linux rnkernel tree and Videocore firmware.rnrn'rpi-update' should only be used if there is a specific rnreason to do so - for example, a request by a Raspberry Pi rnengineer.rnrnDO NOT use 'rpi-update' as part of a regular update process.rnrn##############################################################rnWould you like to proceed? (y/N)rn *** Downloading specific firmware revision (this will take a few minutes)rn  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Currentrn                                 Dload  Upload   Total   Spent    Left  Speedrn100   168  100   168    0     0   1083      0 --:--:-- --:--:-- --:--:--  1083rn100  115M    0  115M    0     0  2911k      0 --:--:--  0:00:40 --:--:-- 3233krn *** Updating firmwarern *** Updating kernel modulesrn *** depmod 4.19.108-v8+rn *** depmod 4.19.108-v7l+rn *** depmod 4.19.108+rn *** depmod 4.19.108-v7+rn *** Updating VideoCore librariesrn *** Using HardFP librariesrn *** Updating SDKrn *** Running ldconfigrn *** Storing current firmware revisionrn *** Deleting downloaded filesrn *** Syncing changes to diskrn *** If no errors appeared, your firmware was successfully updated to b524f5e7ace11ed7500fc39e63247fe9756fbddfrn *** A reboot is needed to activate the new firmwarern
rnrnrnrn

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

rnrnrnrn
gpu_mem=320
rnrnrnrn

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

rnrnrnrn
pi@raspberrypi:~ $ vcgencmd get_mem arm && vcgencmd get_mem gpuarm=704Mgpu=320M
rnrnrnrn

设置Docker硬件(可选)

rnrnrnrn


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

rnrnrnrn

开启硬件加速

rnrnrnrn
rn
rn
rnrnrnrn


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

rnrnrnrn
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))
rnrnrnrn

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

rnrnrnrn

https://www.liujason.com/article/656.html

rn