The QMediaPlayer aways crash when play a video
-
Hi, there is a bug for the mediaplayer?
I have try different video files and test the mdiaplayer.
But just give a response: Process finished with exit code 132 (interrupted by signal 4: SIGILL)
The some response on:Mac OS 11.15.1
intel CPU, andWindows 10
on ThinkPad X13 Gen2. on Python3.8.2
,3.9.10
I install PyQt6 in virtualenv. version as:PyQt6 6.3.0 PyQt6-Qt6 6.3.0 PyQt6-sip 13.3.1
Here is my test code, It's can play audio (.mp3) normally. But crashed any video play:
#!/usr/bin/env python3 # encoding: utf-8 import sys from PyQt6.QtWidgets import QApplication from PyQt6.QtCore import QUrl from PyQt6.QtWidgets import QMainWindow from PyQt6.QtMultimedia import QMediaPlayer, QAudioOutput from PyQt6.QtMultimediaWidgets import QVideoWidget class MainWindow(QMainWindow): def __init__(self, parent=None): super(MainWindow, self).__init__(parent) self.resize(800, 600) self.setWindowTitle(self.tr('PyQt6 Video Player')) self.videoWidget = QVideoWidget() self.setCentralWidget(self.videoWidget) self.player = QMediaPlayer() self.audioOutput = QAudioOutput() self.player.setAudioOutput(self.audioOutput) self.player.setVideoOutput(self.videoWidget) self.player.mediaStatusChanged.connect(self.mediaStatusChanged) self.player.errorOccurred.connect(self.mediaErrorOccured) self.player.metaDataChanged.connect(self.metaChanged) self.audioOutput.setVolume(1.0) # http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4 media = r'/Users/leo/Movies/big_buck_bunny.mp4' source = QUrl.fromLocalFile(media) # any video when call the setSource # the application will be crashed immediately. self.player.setSource(source) def metaChanged(self, meta): print('meta:', meta) def mediaErrorOccured(self, error, message): print('error:', error, message) def mediaStatusChanged(self, status): print('status:', status) if status == QMediaPlayer.MediaStatus.LoadedMedia: self.videoWidget.show() self.player.play() if __name__ == '__main__': app = QApplication(sys.argv) window = MainWindow() window.show() app.exec()
There is my console output:
status: MediaStatus.LoadingMedia
Process finished with exit code 132 (interrupted by signal 4: SIGILL)
-
Hi and welcome to devnet,
Which version of PySide6 ?
On which platform ?
How did you install it ? -
Hi @SGaist
I have updated these information and on PyQt6.2.3 or PyQt6.3. There is a same result.
There was something wrong may be when the process reading the media file.
Even it cann't read or read error content, It killed itself.
I can receive the first signal from the mediaStatusChanged slot. and then crashed.
Thanks. -
Which version of Python are you using ?
-
I just tested your code on macOS 12.3.1, using python 3.10.4 (installed with conda but PyQt6 with pip) and the only issue is your metaChanged slot which signature is wrong. Other than that, it loaded the big buck bunny 10s 30MB video without issue.