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. Showing video from camera and capture frames in the same time
Qt 6.11 is out! See what's new in the release blog

Showing video from camera and capture frames in the same time

Scheduled Pinned Locked Moved Unsolved General and Desktop
17 Posts 3 Posters 6.1k 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.
  • P Offline
    P Offline
    przemek
    wrote on last edited by
    #1

    I would like to be able to show what camera records, but also in the same time grab frames from it to perform some processing.
    Right now I have two options, either:

    1. Implement QAbstractVideoSurface to get the frames or
    2. Use VideoWidget to show what is being recorded

    How can I achieve to have both? I would like to avoid duplicating quite some complicated code from VideoWidget. I would like my QAbstractVideoSurface to draw the frames in the same efficient way as VideoWidget does. Before I just used QLabel with setting a QPixmap and the difference is noticeable.
    I am aware of QVideoProbe but it doesn't work on Linux.

    Maybe is there a way to pass my VideoSurface to the internals of VideoWidget, so that I can just signal the incoming frame?

    I am also aware of this example:
    http://doc.qt.io/qt-4.8/qt-multimedia-videowidget-example.html

    Should I just use it, or is there better way to do it in qt5?

    Thanks in advance.

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

      Hi and welcome to devnet,

      QVideoProbe comes to mind for that.

      Hope it helps

      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
      • P Offline
        P Offline
        przemek
        wrote on last edited by przemek
        #3

        Yeah.... but it doesn't work. What I found is that VideoProbe and Camera only works on Android.
        setSource on QVideoProbe with QCamera returns false.
        So?

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

          What platform are you targeting ?

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

          P 1 Reply Last reply
          0
          • SGaistS SGaist

            What platform are you targeting ?

            P Offline
            P Offline
            przemek
            wrote on last edited by
            #5

            @SGaist Linux, Ubuntu 16.04

            1 Reply Last reply
            0
            • P Offline
              P Offline
              przemek
              wrote on last edited by
              #6

              Anyone can help me here?

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

                What processing do you have in mind ?

                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
                • P Offline
                  P Offline
                  przemek
                  wrote on last edited by
                  #8

                  I just need the frames from the video. I am using 3rd party library to recognize faces.

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

                    After a quick check in the sources, it seems that the gstreamer backend provides a QMediaVideoProbeControl through the camera service, did you try to retrieve it ?

                    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
                    • P Offline
                      P Offline
                      przemek
                      wrote on last edited by
                      #10

                      No. Can you guide me a little how to receive that from camera service?

                      1 Reply Last reply
                      0
                      • P przemek

                        I would like to be able to show what camera records, but also in the same time grab frames from it to perform some processing.
                        Right now I have two options, either:

                        1. Implement QAbstractVideoSurface to get the frames or
                        2. Use VideoWidget to show what is being recorded

                        How can I achieve to have both? I would like to avoid duplicating quite some complicated code from VideoWidget. I would like my QAbstractVideoSurface to draw the frames in the same efficient way as VideoWidget does. Before I just used QLabel with setting a QPixmap and the difference is noticeable.
                        I am aware of QVideoProbe but it doesn't work on Linux.

                        Maybe is there a way to pass my VideoSurface to the internals of VideoWidget, so that I can just signal the incoming frame?

                        I am also aware of this example:
                        http://doc.qt.io/qt-4.8/qt-multimedia-videowidget-example.html

                        Should I just use it, or is there better way to do it in qt5?

                        Thanks in advance.

                        joeQJ Offline
                        joeQJ Offline
                        joeQ
                        wrote on last edited by joeQ
                        #11

                        @przemek hi,friend,welcome

                        I also to learn QtMultimedia recently. and share a demonstration of a custom video widget to grab frames when play video.

                        you can find that in /Qt/Qt5.7.0/Examples/Qt-5.7/multimediawidgets/customvideosurface/customvideowidget

                        And, QVideoProbe return true on my Linux 16.04.

                        Just do it!

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

                          QMediaService *QCamera::mediaService
                          QMediaService
                          Specifically the templated version of QMediaService::requestControl

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

                          P 1 Reply Last reply
                          0
                          • joeQJ joeQ

                            @przemek hi,friend,welcome

                            I also to learn QtMultimedia recently. and share a demonstration of a custom video widget to grab frames when play video.

                            you can find that in /Qt/Qt5.7.0/Examples/Qt-5.7/multimediawidgets/customvideosurface/customvideowidget

                            And, QVideoProbe return true on my Linux 16.04.

                            P Offline
                            P Offline
                            przemek
                            wrote on last edited by
                            #13

                            @joeQ But does it return true when you previously called setSource to QCamera? I learned somewhere that it returns true for a video source, but for QCamera only on android.

                            joeQJ 1 Reply Last reply
                            0
                            • P przemek

                              @joeQ But does it return true when you previously called setSource to QCamera? I learned somewhere that it returns true for a video source, but for QCamera only on android.

                              joeQJ Offline
                              joeQJ Offline
                              joeQ
                              wrote on last edited by
                              #14

                              @przemek

                              in my Ubuntu Kylin 16.04 LTS and Qt 5.8.0

                              I used QVideoPlayer to play video file. it QVideoProbe::setSource can return true.

                              Just do it!

                              P 1 Reply Last reply
                              0
                              • joeQJ joeQ

                                @przemek

                                in my Ubuntu Kylin 16.04 LTS and Qt 5.8.0

                                I used QVideoPlayer to play video file. it QVideoProbe::setSource can return true.

                                P Offline
                                P Offline
                                przemek
                                wrote on last edited by
                                #15

                                @SGaist I will try that, thank you.
                                @joeQ exactly, but when you use QCamera it doesn't work.

                                1 Reply Last reply
                                0
                                • SGaistS SGaist

                                  QMediaService *QCamera::mediaService
                                  QMediaService
                                  Specifically the templated version of QMediaService::requestControl

                                  P Offline
                                  P Offline
                                  przemek
                                  wrote on last edited by przemek
                                  #16

                                  @SGaist unfrotunately this code:
                                  qobject_cast<QMediaVideoProbeControl*>(camera.service()->requestControl("org.qt-project.qt.mediavideoprobecontrol/5.0"));
                                  returns null :(

                                  Maybe because I run it on Raspberry Pi?

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

                                    Which version of Qt are you using on your Pi ?

                                    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