Details
-
Bug
-
Resolution: Out of scope
-
Not Evaluated
-
None
-
6.5.0
-
None
-
windows 11 22h2 (22621.1555)
Python 3.10.9
Description
When I use the following code to play this video and music, errors occur. The video sometimes plays properly, but other times not, and there is a chance that the video will display artifacts or noise.
import sys from PySide6.QtWidgets import QApplication, QWidget from PySide6.QtCore import QUrl from PySide6.QtMultimedia import QMediaPlayer, QAudioOutput from PySide6.QtMultimediaWidgets import QVideoWidget class Video(QWidget): def __init__(self): super().__init__() self.setMinimumSize(1280, 720) self.videoPlayer = QMediaPlayer(self) self.musicPlayer = QMediaPlayer(self) self.audioOutput = QAudioOutput(self) self.musicPlayer.setAudioOutput(self.audioOutput) self.videoWidget = QVideoWidget(self) self.videoPlayer.setVideoOutput(self.videoWidget) self.musicPlayer.mediaStatusChanged.connect(lambda state: self.stateChange(state)) self.musicPlayer.errorOccurred.connect(lambda error, errorString: self.playerError(error, errorString)) self.adj() def playerError(self, error, errorString): print(error) print(errorString) def adj(self): self.videoWidget.resize(self.width(), self.height()) self.videoWidget.move(0, 0) def play_(self): self.musicPlayer.setSource(QUrl.fromLocalFile(f"./cache/yt/GhkOc-B6W8c.mp3")) self.videoPlayer.setSource(QUrl.fromLocalFile(f"./cache/yt/GhkOc-B6W8c.webm")) self.musicPlayer.play() self.videoPlayer.play() def stateChange(self, state: QMediaPlayer): print(state) if __name__ == "__main__": app = QApplication(sys.argv) main_window = Video() main_window.show() main_window.play_() sys.exit(app.exec())
Furthermore, when I start playing the video, the following error appears on PowerShell:
qt.multimedia.ffmpeg.mediadataholder: AVStream duration -9223372036854775808 is invalid. Taking it from the metadata
qt.multimedia.ffmpeg.mediadataholder: AVStream duration -9223372036854775808 is invalid. Taking it from the metadata
[opus @ 000001674ADF4980] Could not update timestamps for skipped samples.
The error is reproducible in PySide6 6.5.0 and Python 3.10.9.
The videos were downloaded using yt_dlp. Here is the code used for downloading:
ydl_opts = { 'format': 'bestaudio/best', 'outtmpl': f'./cache/yt/{id}.webm', } with ytdl.YoutubeDL(ydl_opts) as ydl: ydl.download([video_url]) #download audio ydl_opts = { 'format': 'bestvideo/best', 'outtmpl': f'./cache/yt/{id}.webm', } with ytdl.YoutubeDL(ydl_opts) as ydl: ydl.download([video_url]) #download video
Moving the window while playing will cause the video to freeze, and the following error will continuously appear:
[AVHWFramesContext @ 000002B890CA6500] Static surface pool size exceeded. [vp9 @ 000002B891C87800] get_buffer() failed [vp9 @ 000002B891C87800] thread_get_buffer() failed
If the window continues to be moved, it may cause the entire program to crash.
Attachments
Issue Links
- relates to
-
QTBUG-113211 Windows: QMediaPlayer stuttering with some wave files
-
- Closed
-