Use webengine video and audio codecs

穿精又带淫゛_ 提交于 2021-02-05 06:46:33

问题


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?

I installed PyQt5 through pip, so I don't have the C:\Qt\... files, only the PyQt5, pyqt5_tools folders in Appdata\Local\Programs\Python\Python37\Lib\site-packages.

I am using Python 3.7.2, and PyQt5.11


回答1:


The pyqtwebengine provided by pypi does not enable the use_proprietary_codecs flag so you cannot play the .mp4.

If you want to get a pyqtwebengine that plays mp4 you must follow these steps:

  1. You must compile Qt with the WEBENGINE_CONFIG += use_proprietary_codecs flag to enable the codecs needed to play mp4(Qt WebEngine Features: Audio and Video Codecs)

  2. Then using that Qt you must compile pyqtwebengine.



来源:https://stackoverflow.com/questions/59162435/use-webengine-video-and-audio-codecs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!