Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

python - Use webengine video and audio codecs

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 AppdataLocalProgramsPythonPython37Libsite-packages.

I am using Python 3.7.2, and PyQt5.11

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...