JeffyCN / libv4l-rkmpp

A rockchip-mpp V4L2 wrapper plugin for chromium V4L2 VDA/VEA
GNU Lesser General Public License v2.1
79 stars 26 forks source link

是否可以在Electron中使用vpu进行视频解码 #13

Closed iyangsheng closed 1 year ago

iyangsheng commented 1 year ago

Electron是基于chromium的桌面端开发框架,Electron也支持给上游的chromium打补丁https://www.electronjs.org/zh/docs/latest/development/patches

JeffyCN commented 1 year ago

没有计划支持,理论上可行,有兴趣可以自行尝试移植和调试

iyangsheng commented 1 year ago

我用chromium_95.0.4638中的补丁编译了chromium_95.0.4638,通过查看chrome://gpu 显示已经开启视频硬件解码,但是不能播放视频,启动命令 chromium-browser --no-sandbox --gpu-sandbox-start-early --ignore-gpu-blacklist --ignore-gpu-blocklist --enable-accelerated-video-decode --enable-features=VaapiVideoDecoder image image

控制台有报错

image

JeffyCN commented 1 year ago

--use-gl=egl

iyangsheng commented 1 year ago

还是不能播放 完整日志 pi@SOM-RK3399v2:~$ chromium-browser --no-sandbox --gpu-sandbox-start-early --ignore-gpu-blacklist --ignore-gpu-blocklist --enable-accelerated-video-decode --enable-features=VaapiVideoDecoder --use-gl=egl [2164567:2164567:0224/102645.727058:ERROR:power_monitor_device_source_stub.cc(11)] Not implemented reached in virtual bool base::PowerMonitorDeviceSource::IsOnBatteryPower() [2164567:2164605:0224/102646.123501:ERROR:bus.cc(392)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix") [2164567:2164605:0224/102646.123581:ERROR:bus.cc(392)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix") [2164567:2164605:0224/102646.245727:ERROR:bus.cc(392)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix") [2164567:2164605:0224/102646.246008:ERROR:bus.cc(392)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix") [2164621:2164621:0224/102646.254802:ERROR:gpu_init.cc(453)] Passthrough is not supported, GL is egl, ANGLE is [2164567:2164599:0224/102646.386867:ERROR:login_database.cc(693)] Password store database is too new, kCurrentVersionNumber=31, GetCompatibleVersionNumber=33 [2164567:2164599:0224/102646.388114:ERROR:password_store_impl.cc(455)] Could not create/open login database. [2164567:2164601:0224/102646.400270:ERROR:login_database.cc(693)] Password store database is too new, kCurrentVersionNumber=31, GetCompatibleVersionNumber=33 [2164567:2164601:0224/102646.417919:ERROR:password_store_impl.cc(455)] Could not create/open login database. [2164567:2164605:0224/102646.551810:ERROR:bus.cc(392)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix") [2164567:2164605:0224/102646.552202:ERROR:bus.cc(392)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix") [2164567:2164601:0224/102646.942742:ERROR:top_sites_backend.cc(80)] Failed to initialize database. [2164567:2164664:0224/102653.212343:ERROR:chrome_browser_main_extra_parts_metrics.cc(230)] crbug.com/1216328: Checking Bluetooth availability started. Please report if there is no report that this ends. [2164567:2164664:0224/102653.212812:ERROR:chrome_browser_main_extra_parts_metrics.cc(233)] crbug.com/1216328: Checking Bluetooth availability ended. [2164567:2164664:0224/102653.214793:ERROR:chrome_browser_main_extra_parts_metrics.cc(236)] crbug.com/1216328: Checking default browser status started. Please report if there is no report that this ends. [2164567:2164664:0224/102653.408014:ERROR:chrome_browser_main_extra_parts_metrics.cc(240)] crbug.com/1216328: Checking default browser status ended.

JeffyCN commented 1 year ago

此类功能依赖较多,请使用rockchip官方 buildroot/debian/yocto SDK

JeffyCN commented 1 year ago

基本流程是: chromium检测/dev/video-dec0 /dev/video-enc0文件,然后调用libv4l-utils,触发里面的libv4l-rkmpp,然后走到rockchip mpp和mpp驱动去解码, 解码的图像通过egl导入纹理进行渲染 里面任何一个环节异常都会导致软解

总体流程比较复杂,如果不方便调试可以使用sdk调好的环境 创建虚拟设备节点:

                # Create dummy video node for V4L2 VDA/VEA with rkmpp plugin
                echo dec > /dev/video-dec0
                echo enc > /dev/video-enc0