Use webengine video and audio codecs(使用 webengine 视频和音频编解码器)
问题描述
对于我的 PyQt5 项目,我使用的是 QWebEngineView,但某些视频,例如 .mp4 视频无法播放.我可以使用 pip 安装编解码器,或者通过 QApplication() 或类似的方式传递某个参数来解决此问题吗?
For my PyQt5 project, I am using the QWebEngineView, but certain videos, such as .mp4 videos won't play. Can I install the codecs with pip, or pass a certain argument through QApplication() or something similar in order to fix this problem?
我是通过pip安装PyQt5的,所以我没有C:Qt...文件,只有PyQt5, pyqt5_tools 文件夹在 AppdataLocalProgramsPythonPython37Libsite-packages.
I installed PyQt5 through pip, so I don't have the C:Qt... files, only the PyQt5, pyqt5_tools folders in AppdataLocalProgramsPythonPython37Libsite-packages.
我正在使用 Python 3.7.2 和 PyQt5.11
推荐答案
pypi提供的pyqtwebengine没有开启use_proprietary_codecs标志,所以无法播放.mp4.
The pyqtwebengine provided by pypi does not enable the use_proprietary_codecs flag so you cannot play the .mp4.
如果你想获得一个播放 mp4 的 pyqtwebengine,你必须按照以下步骤操作:
If you want to get a pyqtwebengine that plays mp4 you must follow these steps:
您必须使用
WEBENGINE_CONFIG += use_proprietary_codecs标志编译 Qt 以启用播放 mp4 所需的编解码器(Qt WebEngine功能:音视频编解码器)
You must compile Qt with the
WEBENGINE_CONFIG += use_proprietary_codecsflag to enable the codecs needed to play mp4(Qt WebEngine Features: Audio and Video Codecs)
然后使用那个Qt你必须编译pyqtwebengine.
Then using that Qt you must compile pyqtwebengine.
这篇关于使用 webengine 视频和音频编解码器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:使用 webengine 视频和音频编解码器
基础教程推荐
- 对多索引数据帧的列进行排序 2022-01-01
- 比较两个文本文件以找出差异并将它们输出到新的文本文件 2022-01-01
- Python 中是否有任何支持将长字符串转储为块文字或折叠块的 yaml 库? 2022-01-01
- 在 Django Admin 中使用内联 OneToOneField 2022-01-01
- Python,确定字符串是否应转换为 Int 或 Float 2022-01-01
- matplotlib 设置 yaxis 标签大小 2022-01-01
- 究竟什么是“容器"?在蟒蛇?(以及所有的 python 容器类型是什么?) 2022-01-01
- 在 Python 中将货币解析为数字 2022-01-01
- Kivy 使用 opencv.调整图像大小 2022-01-01
- kivy 应用程序中的一个简单网页作为小部件 2022-01-01
