qtwenengine simplebrowser 播放的 html5 视频在树莓派 2 上没有声音和卡顿

Posted

技术标签:

【中文标题】qtwenengine simplebrowser 播放的 html5 视频在树莓派 2 上没有声音和卡顿【英文标题】:html5 video played by qtwenengine simplebrowser has no sound and laggy on raspberry pi 2 【发布时间】:2016-08-03 14:48:49 【问题描述】:

我关注https://wiki.qt.io/RaspberryPi2EGLFS在raspberry pi2(raspbian-jessie)上交叉编译qt5.7 qtwebengine,并尝试使用qtwebengine/examples/webenginewidgets/demobrowser和simplebrowser玩html5 video tag

但是,有两个主要问题:

首先,视频没有声音,可以看到类似的问题qtwebengine no sound in embedded linux,视频播放了但是没有声音输出。

第二,视频卡顿,我认为它不是硬件加速的,因为一旦我执行程序,它会输出以下消息:

/simplebrowser
ble to query physical screen size, defaulting to 100 dpi.
To override, set QT_QPA_EGLFS_PHYSICAL_WIDTH and QT_QPA_EGLFS_PHYSICAL_HEIGHT (in millimeters).
[0803/134150:ERROR:browser_main_loop.cc(217)] Running without the SUID sandbox! See ttps://chromium.googlesource.com/chromium/src/+/master/docs/linux_suid_sandbox_development.md for more information on developing with the sandbox on.
[0803/134150:ERROR:surface_factory_qt.cpp(68)] Failed to load /opt/vc/lib/libGLESv2.so.2: /opt/vc/lib/libGLESv2.so.2: cannot open shared object file: No such file or directory
[0803/134150:ERROR:gl_surface_qt.cpp(414)] Trying to create surface with invalid display.
[0803/134150:ERROR:command_buffer_proxy_impl.cc(201)] Failed to initialize command buffer service.
[0803/134150:ERROR:webgraphicscontext3d_command_buffer_impl.cc(210)] CommandBufferProxy::Initialize failed.
[0803/134150:ERROR:webgraphicscontext3d_command_buffer_impl.cc(229)] Failed to initialize command buffer.
[0803/134150:ERROR:gl_surface_qt.cpp(414)] Trying to create surface with invalid display.
[0803/134150:ERROR:command_buffer_proxy_impl.cc(201)] Failed to initialize command buffer service.
[0803/134150:ERROR:webgraphicscontext3d_command_buffer_impl.cc(210)] CommandBufferProxy::Initialize failed.
[0803/134150:ERROR:webgraphicscontext3d_command_buffer_impl.cc(229)] Failed to initialize command buffer.
[0803/134150:ERROR:gl_surface_qt.cpp(414)] Trying to create surface with invalid display.
[0803/134150:ERROR:command_buffer_proxy_impl.cc(201)] Failed to initialize command buffer service.
[0803/134150:ERROR:webgraphicscontext3d_command_buffer_impl.cc(210)] CommandBufferProxy::Initialize failed.
[0803/134150:ERROR:webgraphicscontext3d_command_buffer_impl.cc(229)] Failed to initialize command buffer.
[0803/134150:ERROR:gl_surface_qt.cpp(414)] Trying to create surface with invalid display.
[0803/134150:ERROR:command_buffer_proxy_impl.cc(201)] Failed to initialize command buffer service.
[0803/134150:ERROR:webgraphicscontext3d_command_buffer_impl.cc(210)] CommandBufferProxy::Initialize failed.
[0803/134150:ERROR:webgraphicscontext3d_command_buffer_impl.cc(229)] Failed to initialize command buffer.
[0803/134153:ERROR:gl_surface_qt.cpp(414)] Trying to create surface with invalid display.
[0803/134153:ERROR:command_buffer_proxy_impl.cc(201)] Failed to initialize command buffer service.
[0803/134153:ERROR:webgraphicscontext3d_command_buffer_impl.cc(210)] CommandBufferProxy::Initialize failed.
[0803/134153:ERROR:webgraphicscontext3d_command_buffer_impl.cc(229)] Failed to initialize command buffer.
[0803/134153:ERROR:gl_surface_qt.cpp(414)] Trying to create surface with invalid display.
[0803/134153:ERROR:command_buffer_proxy_impl.cc(201)] Failed to initialize command buffer service.
[0803/134153:ERROR:webgraphicscontext3d_command_buffer_impl.cc(210)] CommandBufferProxy::Initialize failed.
[0803/134153:ERROR:webgraphicscontext3d_command_buffer_impl.cc(229)] Failed to initialize command buffer.
[0803/134153:ERROR:gl_surface_qt.cpp(414)] Trying to create surface with invalid display.
[0803/134153:ERROR:command_buffer_proxy_impl.cc(201)] Failed to initialize command buffer service.
[0803/134153:ERROR:webgraphicscontext3d_command_buffer_impl.cc(210)] CommandBufferProxy::Initialize failed.
[0803/134153:ERROR:webgraphicscontext3d_command_buffer_impl.cc(229)] Failed to initialize command buffer.
[0803/134153:ERROR:gl_surface_qt.cpp(414)] Trying to create surface with invalid display.
[0803/134153:ERROR:command_buffer_proxy_impl.cc(201)] Failed to initialize command buffer service.
[0803/134153:ERROR:webgraphicscontext3d_command_buffer_impl.cc(210)] CommandBufferProxy::Initialize failed.
[0803/134153:ERROR:webgraphicscontext3d_command_buffer_impl.cc(229)] Failed to initialize command buffer.
[0803/134153:ERROR:gl_surface_qt.cpp(414)] Trying to create surface with invalid display.
[0803/134153:ERROR:command_buffer_proxy_impl.cc(201)] Failed to initialize command buffer service.
[0803/134153:ERROR:webgraphicscontext3d_command_buffer_impl.cc(210)] CommandBufferProxy::Initialize failed.
[0803/134153:ERROR:webgraphicscontext3d_command_buffer_impl.cc(229)] Failed to initialize command buffer.
[0803/134153:ERROR:gl_surface_qt.cpp(414)] Trying to create surface with invalid display.
[0803/134153:ERROR:command_buffer_proxy_impl.cc(201)] Failed to initialize command buffer service.
[0803/134153:ERROR:webgraphicscontext3d_command_buffer_impl.cc(210)] CommandBufferProxy::Initialize failed.
[0803/134153:ERROR:webgraphicscontext3d_command_buffer_impl.cc(229)] Failed to initialize command buffer.
js: Refused to set unsafe header "User-Agent"
js: Refused to set unsafe header "User-Agent"
js: Refused to set unsafe header "User-Agent"

我认为是加载 libGLESv2.so.2 失败所以关闭了硬件加速。

有人对此有任何想法或经验吗?

非常感谢。

【问题讨论】:

【参考方案1】:

关于音频,我在您提到的链接中回答了 (QtWebEngine Quicknano has no Sound in Embedded Linux)。

关于视频,您是否启用了属性编解码器支持?我不知道它如何与 Broadcome cpu 一起工作,但在我的带有属性编解码器和一个铬补丁的飞思卡尔板上,我的音频和视频都很流畅。

注意: 没有 X11,只有 eglfs 和 alsa 用于音频。

【讨论】:

亲爱的 Wojciech Koprowski:关于视频部分,我确实启用了 WEBENGINE_CONFIG+=use_proprietary_codecs 来支持 h264 视频,你能把上面提到的 chromium 补丁分享给我吗?谢谢。 对不起,这个补丁是Qt商业版的一部分,所以我认为我不能分享它。但此补丁仅针对 Vivante GPU 设计,因为缺少 texture_rg 支持。所以这不应该是树莓派的问题。确保将所有硬件多媒体支持添加到您的 Linux 构建中(在您的情况下缺少 OpenGL 库)。

以上是关于qtwenengine simplebrowser 播放的 html5 视频在树莓派 2 上没有声音和卡顿的主要内容,如果未能解决你的问题,请参考以下文章