Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. video doesn't display on LCD screen
Qt 6.11 is out! See what's new in the release blog

video doesn't display on LCD screen

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
24 Posts 2 Posters 8.3k Views 1 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #13

    How are you feeding your pipeline ?

    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
    • J Offline
      J Offline
      Jeffff
      wrote on last edited by Jeffff
      #14

      Seems that I cannot upload my source code here. It is pretty simple, first I use opencv to capture a image, and emit the frame.

          forever{
              try {
                  if (!normal_video.isOpened()) {
                      continue;
                  }
                  cv::Mat normal_frame;
                  normal_video >> normal_frame;
                  emit updateCameraFrame(normal_frame.clone());
              } 
      

      Then in another thread, the frame is handled:

      void VideoManager::frameReceived(const cv::Mat &frame) {
          if(mRunning){
              cv::Mat image(frame);
              mCameraProducer->updateFrame(Mat2QImage(image));
          }
      }
      ......
      void VideoProducer::updateFrame(QImage image)
      {
          if(image.size() != mFormat.frameSize())
          {
              qDebug() << "newSize: " << image.size();
              closeSurface();
              mFormat = QVideoSurfaceFormat( image.size(), QVideoFrame::PixelFormat::Format_RGB32);
              mSurface->start(mFormat);
          }
          mSurface->present( QVideoFrame( image ) );
      }
      

      As shown above, everything is working unless last step: mSurface->present(), which cannot really present the image/video on screen.

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

        @Jeffff said in video doesn't display on LCD screen:

        VideoProducer

        Is that one in a different thread than the main thread ?

        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
        • J Offline
          J Offline
          Jeffff
          wrote on last edited by
          #16

          Yes, sure. video capturing and displaying are 2 different threads, they are sync by signal.

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

            That I understood, my question is: does the displaying happen in the main thread of your application ? Not a secondary thread that you created.

            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
            • J Offline
              J Offline
              Jeffff
              wrote on last edited by
              #18

              Yes, it is the main thread of my application. As I've mentioned at the beginning, the same code can run on my Ubuntu.

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

                @Jeffff said in video doesn't display on LCD screen:

                multimedia.video: media object is QObject(0x0)

                This one looks pretty odd and is likely related to your 0 frame rate.

                Can you test with a minimal QVideoWidget to compare ?

                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
                • J Offline
                  J Offline
                  Jeffff
                  wrote on last edited by Jeffff
                  #20

                  I did some test by qmlvideo sample App, which runs good on same imx6 board. As qmlvideo runs smoothly, it means my running environment is good.
                  On the other hand, I found that if I use small resolution image frame(such as 480*270), it is working. All frames are display on preset windows(800*480), obviously, it should be gstreamer which enlarges the frame. The very weird thing is that other large resolutions, such as (640*360, 1280*720, 1920*1080), are not OK to be displayed, in replace, the area keeps dark.
                  With the logging enabled , I can also find the gstreamer plugin inserted as below figure shows even though video cannot be displayed.
                  7e2d9dad-38cd-4e3f-b8da-1e207af3e174-image.png

                  1 Reply Last reply
                  0
                  • J Offline
                    J Offline
                    Jeffff
                    wrote on last edited by
                    #21

                    For my own app and the qmlvideo app, I also dump their lib dependency as below:
                    e412ac39-a3b6-4070-9f16-3b438617981d-image.png
                    file:///mnt/hgfs/Share/Screenshot%20from%202021-12-01%2023-30-58.png
                    Another strange part to me: the Qt5Multimediea appears in my app, while it doesn't appear in qmlvideo example. As I described before, my app cannot display video frame, while qmlvideo can display...

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

                      @Jeffff said in video doesn't display on LCD screen:

                      qmlvideo

                      Can you give a link to that example ?

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

                      J 1 Reply Last reply
                      0
                      • SGaistS SGaist

                        @Jeffff said in video doesn't display on LCD screen:

                        qmlvideo

                        Can you give a link to that example ?

                        J Offline
                        J Offline
                        Jeffff
                        wrote on last edited by Jeffff
                        #23

                        @SGaist
                        Sorry I cannot get your idea.
                        The link here guides me to get the "qmlvideo" app. I havn't change any code of this app, it should be the original sample code of using QtMultimedia.

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

                          Ok, the sample does not link to the QtMultimedia library directly because it does not use it directly as is your C++ application.

                          The QVideoWidget class, if memory serves well does not support the same number of formats as the QtQuick Video item.

                          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