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. How to use a Video Producer to write on frames being displayed?
Qt 6.11 is out! See what's new in the release blog

How to use a Video Producer to write on frames being displayed?

Scheduled Pinned Locked Moved Unsolved General and Desktop
12 Posts 2 Posters 3.3k Views 2 Watching
  • 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.
  • davecotterD Offline
    davecotterD Offline
    davecotter
    wrote on last edited by davecotter
    #3

    i saw that, but what i need is some sample code. it's not immediately obvious how to hook it up. or rather: it's no obvious after several hours of reading, researching, googling, and trying a dozen things.

    1 Reply Last reply
    0
    • davecotterD Offline
      davecotterD Offline
      davecotter
      wrote on last edited by
      #4

      also, i'm not using QML, so that doesn't apply to me. if it DOES apply, then the structure of that sentence does NOT make that clear.

      I miss "Inside Macintosh", the quality of that documentation has never been surpassed.

      1 Reply Last reply
      0
      • davecotterD Offline
        davecotterD Offline
        davecotter
        wrote on last edited by
        #5

        if it helps, here's some code that i have, i just can't figure out how to shoehorn the video producer thing in there:

        	QGridLayout		*layout = new QGridLayout;
        	QTimer			*timer = new QTimer(this);
        	
        	//AddSurface<Widget>(this, layout, timer, "Native", columnI++);
        	//AddSurface<GLWidget>(this, layout, timer, "OpenGL", columnI++);
        
        #if 1
        	{
        		#if OPT_MACOS
        			CFileRef		movieFile(CFileRef::kFolder_DESKTOP);
        		#else
        			CFileRef		movieFile("Z:\\Users\\davec\\Desktop");
        		#endif
        		
        		ERR(movieFile.GetChild("Movies/test.mp4", &existsB));
        		
        		if (!err && existsB) {
        			QMediaPlayer		*mediaPlayer = new QMediaPlayer(NULL, QMediaPlayer::VideoSurface);
        			QGraphicsVideoItem	*videoItem = new QGraphicsVideoItem();
        			QGraphicsView		*graphicsView = new QGraphicsView(new QGraphicsScene(this));
        			QSizeF				vidSize(340, 200);
        			
        		    videoItem->setSize(vidSize);
        		
        			#if 0	
        				mediaPlayer->setVideoOutput(videoItem);
        			#else
        				MyVideoSurface		*vidSurfaceP = new MyVideoSurface();
        				MyVideoProducer		*vidProducerP = new MyVideoProducer();
        
        				vidProducerP->setVideoSurface(vidSurfaceP);
        
        				QVideoRendererControl *rendererControl = mediaPlayer->requestControl<QVideoRendererControl *>();
        				
        				rendererControl->setSurface(vidProducerP);
        				
        //				mediaPlayer->setVideoOutput(vidSurfaceP);
        			#endif
        			
        			graphicsView->scene()->addItem(videoItem);
        			
        			SuperString		filePath(movieFile.path(true));
        			QUrl			fileUrl(QUrl::fromLocalFile(filePath));
        
        			mediaPlayer->setMedia(fileUrl);
        			mediaPlayer->play();
        			
        			layout->addWidget(graphicsView, 0, columnI++);
        		}
        	}
        #endif
        
        
        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #6

          What exactly are you trying to do ? Your code is not really clear on the aspect.

          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
          • davecotterD Offline
            davecotterD Offline
            davecotter
            wrote on last edited by
            #7

            just insert the video producer into the chain and have the movie still play. the goal is to be able to write to video frames while the movie is playing (eg: put a graphic badge on it, or draw some text over the movie, like subtitles)

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #8

              Then shouldn't you rather make use of video filters ?

              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
              • davecotterD Offline
                davecotterD Offline
                davecotter
                wrote on last edited by
                #9

                my app is C++ Widgets, not QML

                1 Reply Last reply
                0
                • davecotterD Offline
                  davecotterD Offline
                  davecotter
                  wrote on last edited by
                  #10

                  i think it just needs a wee bit more documentation, or better yet, a sample project? anyone?

                  1 Reply Last reply
                  0
                  • davecotterD Offline
                    davecotterD Offline
                    davecotter
                    wrote on last edited by
                    #11

                    please does ANYONE know how to use this? is there ANY more doc or sample code on this ?

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #12

                      After some thoughts, I'd check the VLC-Qt and VLC. I think it will likely be more powerful for the features you are looking for.

                      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

                      • Login

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