Unable to run video with QT Mediaplayer in one of my computers
-
I am using 2 computers with the same aplication to show videos with QT Mediaplayer.
One of the computers run the video properly while the other one just show a white screen.I checked and the QT Mediaplayer in both computers are the same.
This is the code I am runing:def put_video_in_layout(self, color, video_path):
print("Input video in layout")
Video_url1 = QUrl.fromLocalFile(video_path)
print("!!!!!!!!!!!!!!!")
print("Video path:", video_path)
print("File exists:", os.path.exists(video_path))video_widget = QVideoWidget() if color == "w": video_widget.setStyleSheet("background-color: rgb(255, 255, 255); border-radius: 10px") else: video_widget.setStyleSheet("background-color: rgb(77, 70, 210); border-radius: 10px") video_widget.setFixedSize(380, 500) video_widget.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) video_widget.setAspectRatioMode(Qt.KeepAspectRatio) media_player = QMediaPlayer(None, QMediaPlayer.VideoSurface) media_player.setVideoOutput(video_widget) video_content = QMediaContent(Video_url1) media_player.setMedia(video_content) # Debugging output print("Video widget created:", video_widget) print("Media player created:", media_player) print("Media content set:", video_content.isNull()) # Connect signals for debugging def handle_media_status(status): print("Media status changed:", status) if status == QMediaPlayer.LoadedMedia: print("Media loaded successfully") def handle_error(error): print("Media player error:", error, media_player.errorString()) media_player.mediaStatusChanged.connect(handle_media_status) media_player.error.connect(handle_error)
I will apriciate any help,
Thanks !! -
Hi and welcome to devnet,
Are you using PySide2, PySide6, PyQt5, PyQt6 ?
Which version ?
On which OS ?
What kind of video is that ? Container format ? Video codec ? Audio codec ? -
Are you sure that you have the codec required on that other computer ?
Can you share the video codec used for that file ? -
i just chevked and this are the codec that i have in both of the computers:
c:\windows\system32\imaadp32.acm Microsoft Corporation OK C:\WINDOWS\system32\IMAADP32.ACM 10.0.22621.2506 61.92 KB (63,408 bytes) 25/01/2024 06:34
c:\windows\system32\l3codeca.acm Fraunhofer Institut Integrierte Schaltungen IIS Fraunhofer IIS MPEG Layer-3 Codec OK C:\WINDOWS\system32\L3CODECA.ACM 1.9.0.401 112.00 KB (114,688 bytes) 07/05/2022 08:20
c:\windows\system32\msadp32.acm Microsoft Corporation OK C:\WINDOWS\system32\MSADP32.ACM 10.0.22621.2506 57.89 KB (59,280 bytes) 25/01/2024 06:34
c:\windows\system32\msg711.acm Microsoft Corporation OK C:\WINDOWS\system32\MSG711.ACM 10.0.22621.2506 49.80 KB (51,000 bytes) 25/01/2024 06:34
c:\windows\system32\msgsm32.acm Microsoft Corporation OK C:\WINDOWS\system32\MSGSM32.ACM 10.0.22621.2506 65.96 KB (67,544 bytes) 25/01/2024 06:34 -
You're welcome !
What was the issue ?