Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Unable to run video with QT Mediaplayer in one of my computers
QtWS25 Last Chance

Unable to run video with QT Mediaplayer in one of my computers

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 2 Posters 324 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Shahar
    wrote on 21 Jun 2024, 19:10 last edited by
    #1

    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 !!

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 21 Jun 2024, 19:16 last edited by
      #2

      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 ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • S Offline
        S Offline
        Shahar
        wrote on 21 Jun 2024, 19:35 last edited by
        #3

        hi i am using PYqt5
        pyqt version 5.15.10
        qt version 5.15.2
        OS WINDOWS 11
        i try to run mp4 videos

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 21 Jun 2024, 19:37 last edited by
          #4

          Are you sure that you have the codec required on that other computer ?
          Can you share the video codec used for that file ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • S Offline
            S Offline
            Shahar
            wrote on 21 Jun 2024, 19:47 last edited by
            #5

            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

            1 Reply Last reply
            0
            • S Offline
              S Offline
              Shahar
              wrote on 21 Jun 2024, 20:14 last edited by
              #6

              when i run the code i showed you above
              this is what it prints in the computer that shows the video:
              media status changed: 6
              and this is what it prints in the computer that dosent show the video:
              Media status changed: 8
              Media player error: 1

              1 Reply Last reply
              0
              • S Offline
                S Offline
                Shahar
                wrote on 22 Jun 2024, 15:36 last edited by
                #7

                hi, thanks for your time.
                i manged to solve the problam

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on 22 Jun 2024, 20:41 last edited by
                  #8

                  You're welcome !

                  What was the issue ?

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0

                  8/8

                  22 Jun 2024, 20:41

                  • Login

                  • Login or register to search.
                  8 out of 8
                  • First post
                    8/8
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved