问题
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:
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)Then using that Qt you must compile pyqtwebengine.
来源:https://stackoverflow.com/questions/59162435/use-webengine-video-and-audio-codecs