PyQt5 - Can't play video using QVideoWidget

白昼怎懂夜的黑 提交于 2019-12-22 11:08:05

问题


from PyQt5.QtWidgets import *
from PyQt5.QtMultimedia import *
from PyQt5.QtMultimediaWidgets import *
from PyQt5.QtCore import *

import sys

app = QApplication(sys.argv)
w = QVideoWidget()
w.resize(300, 300)
w.move(0, 0)
w.show()

player = QMediaPlayer()
player.setMedia(QMediaContent(QUrl.fromLocalFile("/home/doflamingo    /Documents/Nisemono/got.avi")))
player.setVideoOutput(w)

player.play()

sys.exit(app.exec_())

This very simple code give the following output on ArchLinux :

GStreamer; Unable to pause - "file:///home/doflamingo/Documents/Nisemono/got.avi"
GStreamer; Unable to pause - "file:///home/doflamingo/Documents/Nisemono/got.avi"

Everything seems up-to-date and the codecs for GStreamer are installed.

来源:https://stackoverflow.com/questions/38170552/pyqt5-cant-play-video-using-qvideowidget

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