msojocs / bilibili-linux

基于哔哩哔哩官方客户端移植的Linux版本 支持漫游
MIT License
719 stars 34 forks source link

客户端硬件解码没有生效 #60

Closed DoveKi closed 1 year ago

DoveKi commented 1 year ago

@msojocs 最新更新的硬解支持在你那边测试正常工作吗,能提供一下你那边相关硬件和系统环境吗 我这边相同的环境前和flags提下,在chrome里硬解正常,在客户端里硬解并没有工作

chrome下测试 环境 ubuntu 22.04 gnome xorg/x11 a卡+vaapi 我这边wayland/xwayland下原版chrome好像不管怎么设置都不能正常硬解,改用xorg登录硬解正常

我的chrome用的flags /usr/bin/google-chrome-stable --ignore-gpu-blacklist --enable-gpu-rasterization --enable-zero-copy --disable-features=UseChromeOSDirectVideoDecoder --enable-features=VaapiVideoDecoder

进chrome://gpu里拉倒最底部 vaapi正确启用以后会显示所有支持的解码格式信息 Screenshot from 2023-02-15 06-57-54

播放测试任意4k60帧视频,比较容易观察cpu占用和是否掉帧 https://www.bilibili.com/video/BV1eQ4y127RB 4k最高画质,播放设置改为avc 验证检查chrome://media-internals/里当前播放视频页面的kIsPlatformVideoDecoder项是true,硬解正常 htop看cpu占用基本无负担 正常10%左右跳动

Screenshot from 2023-02-15 06-24-24

客户端播放器情况 和上面chrome测试同一个视频和一样的播放设置 cpu占用明显没硬解,是软解的 在客户端里我不知道怎么进chrome://media-internals/和chrome://gpu检查相关信息 Screenshot from 2023-02-15 06-45-24

我把所有app.commandLine.appendSwitch改成和我chrome的启动参数一样重新编译,一样没有任何效果

Screenshot from 2023-02-15 07-36-32

msojocs commented 1 year ago

不同平台参数应该不一致,我在Windows下跑的,我看能不能弄个自定义参数的支持。

DoveKi commented 1 year ago

windows下跑啥意思,WSL?

xiao-k233 commented 1 year ago

我看了看只需要在启动脚本内添加几行shell代码即可,不需要上游去做修改,请试着加入

#!/usr/bin/bash
XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-~/.config}
if [[ -f $XDG_CONFIG_HOME/bilibili-flags.conf ]]; then
  BILIBILI_USER_FLAGS="$(sed 's/#.*//' $XDG_CONFIG_HOME/bilibili-flags.conf | tr '\n' ' ')"
fi
env ELECTRON_FORCE_IS_PACKAGED=true electron17 /usr/share/bilibili/bilibili.asar "$@" $BILIBILI_USER_FLAGS
msojocs commented 1 year ago

不同平台参数应该不一致,我在Windows下跑的,我看能不能弄个自定义参数的支持

不是wsl,就是windows的安装包那个。

edit: Windows下我把参数全删了也有硬解。。。寄

DoveKi commented 1 year ago

不同平台参数应该不一致,我在Windows下跑的,我看能不能弄个自定义参数的支持

不是wsl,就是windows的安装包那个。

edit: Windows下我把参数全删了也有硬解。。。寄

windows下的chromium/electron默认缺省应该就有硬解 不需要再任何参数

xiao-k233 commented 1 year ago

不同平台参数应该不一致,我在Windows下跑的,我看能不能弄个自定义参数的支持

不是wsl,就是windows的安装包那个。

edit: Windows下我把参数全删了也有硬解。。。寄

windows下的chromium/electron默认缺省应该就有硬解 不需要再任何参数

对的

everything411 commented 1 year ago

electron chrome://gpu可以看默认参数下的硬件解码支持,arch里electron17默认关闭硬解,electron22默认打开硬解,但是用electron22执行客户端,也同样无法使用硬件解码。chrome和firefox都能正常硬解b站avc。

msojocs commented 1 year ago

已添加自定义参数

netphils commented 9 months ago

我这边wayland/xwayland下原版chrome好像不管怎么设置都不能正常硬解,改用xorg登录硬解正常

改成--enable-features=VaapiVideoDecodeLinuxGL试试? 我用chromium --ignore-gpu-blacklist --enable-features=VaapiVideoDecodeLinuxGL可以在chrome://gpu正常显示解码信息,但是这个软件里还是不行。

DoveKi commented 9 months ago

我这边wayland/xwayland下原版chrome好像不管怎么设置都不能正常硬解,改用xorg登录硬解正常

改成--enable-features=VaapiVideoDecodeLinuxGL试试? 我用chromium --ignore-gpu-blacklist --enable-features=VaapiVideoDecodeLinuxGL可以在chrome://gpu正常显示解码信息,但是这个软件里还是不行。

VaapiVideoDecodeLinuxGL这个参数是最近chromium的版本刚有的 我现在没折腾了你可以试试加进app.commandLine.appendSwitch里面编译试试