Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct


    Qt World Summit: Early-Bird Tickets

    Unsolved Is there a way to manipulate Qmediaplayer frames and display? Or Draw on it with a transparent widget which will not affect the video?

    Qt for Python
    1
    1
    501
    Loading More Posts
    • 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.
    • C
      codersmurf last edited by

      Hello, I have a desktop application on ubuntu which has a qmediaplayer. I am working with pyqt5.
      I am trying to manipulate frames of the video and show as an another video in real time. I have tried to use OpenCV but i was not able find a way to use those frames. So, I started to look other options and i have tried to draw on qmediaplayer but i couldn't do it properly. The pixmap was overriding the videoplayer element so i was not able to play video.

      here is the code snippet from this attempt:

      
              ###painter
            
              # convert image file into pixmap
              self.pixmap_image = QtGui.QPixmap("Empty.png")
      
              # create painter instance with pixmap
              self.painterInstance = QtGui.QPainter(self.pixmap_image)
      
              # set rectangle color and thickness
              self.penRectangle = QtGui.QPen(QtCore.Qt.red)
              self.penRectangle.setWidth(3)
      
              # draw rectangle on painter
              self.painterInstance.setPen(self.penRectangle)
              self.painterInstance.drawRect(10,10,10,10)
      
              self.label_imageDisplay = QLabel()
              # set pixmap onto the label widget
              self.label_imageDisplay.setPixmap(self.pixmap_image)
              self.label_imageDisplay.setAutoFillBackground(Qt.transparent)
              #self.label_imageDisplay.show()
      
              self.grid.addWidget(self.vidWidget, 1, 0, 12, 15 )  
      #vidWidget is the widget which has the control widgets and mediaplayer
              self.grid.addWidget(self.label_imageDisplay, 1, 0, 5, 5 )
      
      

      0_1568639046359_257451ae-6caf-4250-9396-897bda8408e7-image.png
      a screenshot of it (i changed the size so you can see what is happening)

      i tried to make it transparent but it didn't work out it was showing background of the window not the mediaplayer.

      So, I need your help.
      *Is there a way to manipulate and save/play frames of the video?
      OR

      • Is there a way to draw on a transparent widget which will now affect the video?
      1 Reply Last reply Reply Quote 0
      • First post
        Last post