<div>why not try </div><h1 class="title" style="margin: 0px 0px 15px; padding: 0px 5px 0px 0px; font-family: 'Open Sans', sans-serif; font-size: 18px; line-height: 1.2; color: rgb(54, 53, 52); box-sizing: border-box;">QMediaPlayer in PyQt5 ?</h1><div><a href="http://qt-project.org/doc/qt-5/qmediaplayer.html">http://qt-project.org/doc/qt-5/qmediaplayer.html</a></div><div><br></div><div><div><span style="font-family: sans-serif; font-size: small; line-height: 19px;">Phonon was dropped since Qt5.</span></div><div style="font-size: 12px;font-family: Arial Narrow;padding:2px 0 2px 0;">------------------ 原始邮件 ------------------</div><div style="font-size: 12px;background:#efefef;padding:8px;"><div><b>发件人:</b> "Sebastian Eckweiler";<sebastian.eckweiler@twt-gmbh.de>;</div><div><b>发送时间:</b> 2014年6月3日(星期二) 晚上7:12</div><div><b>收件人:</b> "pyqt"<pyqt@riverbankcomputing.com>; <wbr></div><div></div><div><b>主题:</b> [PyQt] Phonon VideoPlayer causes python to crash</div></div><div><br></div><font size="2" face="sans-serif">Hello,</font>
<br>
<br><font size="2" face="sans-serif">I'm having an issue using the Phonon
VideoPlayer.</font>
<br><font size="2" face="sans-serif">Loading or starting to play a video
file causes the python executable to crash, leaving me only with a windows
dialog saying that "python.exe has stopped working".</font>
<br>
<br><font size="2" face="sans-serif">I've boiled it down to the following,
minimalistic example:</font>
<br>
<br><tt><font size="2">import sys</font></tt>
<br>
<br><tt><font size="2">from PyQt4.phonon import Phonon</font></tt>
<br><tt><font size="2">from PyQt4 import QtGui, QtCore</font></tt>
<br><tt><font size="2">import PyQt4.QtCore</font></tt>
<br>
<br><tt><font size="2">import os</font></tt>
<br>
<br><tt><font size="2">class TestPlayer(QtGui.QMainWindow):</font></tt>
<br><tt><font size="2"> def __init__(self):</font></tt>
<br><tt><font size="2"> QtGui.QMainWindow.__init__(self)</font></tt>
<br><tt><font size="2"> widget = QtGui.QWidget()</font></tt>
<br><tt><font size="2"> layout = QtGui.QVBoxLayout()</font></tt>
<br><tt><font size="2"> widget.setLayout(layout)</font></tt>
<br>
<br><tt><font size="2"> self.setCentralWidget(widget)</font></tt>
<br>
<br><tt><font size="2"> self.player = Phonon.VideoPlayer()</font></tt>
<br><tt><font size="2"> layout.addWidget(self.player)</font></tt>
<br>
<br><tt><font size="2"> start = QtGui.QPushButton('Start')</font></tt>
<br><tt><font size="2"> start.clicked.connect(self.select_and_play)</font></tt>
<br><tt><font size="2"> layout.addWidget(start)</font></tt>
<br>
<br><tt><font size="2"> self.mediaSource = None</font></tt>
<br>
<br><tt><font size="2"> def select_and_play(self):</font></tt>
<br><tt><font size="2"> f = QtGui.QFileDialog.getOpenFileName(None,
'File :-)')</font></tt>
<br><tt><font size="2"> f = os.path.normpath(unicode(f))</font></tt>
<br><tt><font size="2"> print 'playing: %s' %
f</font></tt>
<br><tt><font size="2"> self.mediaSource = Phonon.MediaSource(f)</font></tt>
<br><tt><font size="2"> self.player.load(self.mediaSource)</font></tt>
<br><tt><font size="2"> self.player.play()</font></tt>
<br>
<br><tt><font size="2">if __name__ == '__main__':</font></tt>
<br><tt><font size="2"> print 'pyqt: %s' % PyQt4.QtCore.PYQT_VERSION_STR</font></tt>
<br><tt><font size="2"> print 'qt: %s' % PyQt4.QtCore.QT_VERSION_STR</font></tt>
<br><tt><font size="2"> print 'py version: %s' % sys.version</font></tt>
<br>
<br><tt><font size="2"> app = QtGui.QApplication([])</font></tt>
<br><tt><font size="2"> tester = TestPlayer()</font></tt>
<br><tt><font size="2"> tester.show()</font></tt>
<br><tt><font size="2"> app.exec_()</font></tt>
<br>
<br>
<br><font size="2" face="sans-serif">This gives:</font>
<br>
<br><tt><font size="2">pyqt: 4.10.4</font></tt>
<br><tt><font size="2">qt: 4.8.5</font></tt>
<br><tt><font size="2">py version: 2.7.6 (default, Nov 10 2013, 19:24:18)
[MSC v.1500 32 bit (Intel)]</font></tt>
<br><tt><font size="2">playing: C:\Users\Public\Videos\Sample Videos\Wildlife.wmv</font></tt>
<br>
<br><font size="2" face="sans-serif">This is on a Windows 7 64bit System
using the portable python distribution:</font>
<br><a href="ftp://ftp.nluug.nl/pub/languages/python/portablepython/v2.7/PortablePython_2.7.6.1.exe"><font size="2" color="blue" face="sans-serif">ftp://ftp.nluug.nl/pub/languages/python/portablepython/v2.7/PortablePython_2.7.6.1.exe</font></a>
<br><font size="2" face="sans-serif">I tried this with PyQt versions from
4.9.6, 4.10.4 to the latest as of yesterday using "normal" python
installations as well, without any success.</font>
<br><font size="2" face="sans-serif">The video file should be available on
any windows 7 installation.</font>
<br>
<br><font size="2" face="sans-serif">Remarkably, all the Phonon examples
included in PyQt are working just fine - though no Video example is included
therein.</font>
<br>
<br><font size="2" face="sans-serif">Any hints on where to start looking
for the issue here?</font>
<br>
<br><font size="2" face="sans-serif">Cheers</font>
<br><font size="2" face="sans-serif">Sebastian</font></div>