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. Analog cameras, qt and gstreamer
Forum Updated to NodeBB v4.3 + New Features

Analog cameras, qt and gstreamer

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
11 Posts 4 Posters 5.4k Views 4 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.
  • mrdebugM Offline
    mrdebugM Offline
    mrdebug
    wrote on last edited by
    #2

    Hi. In order to manage v4l video cameras I'm using OpenCV, to manage rtsp video cameras and movies (to read and to create) I'm using ffmpeg.
    What do you have to do? My approach is more complicated than use gstreamer but if it is very great and works everywhere.

    Need programmers to hire?
    www.labcsp.com
    www.denisgottardello.it
    GMT+1
    Skype: mrdebug

    1 Reply Last reply
    1
    • N Offline
      N Offline
      naggety
      wrote on last edited by
      #3

      I'm so sorry, I was testing some possible workarounds and I forgot this thread.

      What I've finally done is using Gstreamer (alone, not QTGstreamer) with qmlglsink element. In my case, I needed some fixes in Gstreamer that are going to be included in version 1.15 but it's working.

      About Camera QML element I still don't know if it's supposed to work with analog cameras. I think yes, but I haven't it working yet because I think my driver is a bit buggy, I'll try to fix it.

      I have tested using the QML example from Gstreamer, but modifying the pipeline to use my cameras instead of videotestsrc.

      This is the original example: https://cgit.freedesktop.org/gstreamer/gst-plugins-good/tree/tests/examples/qt/qmlsink?id=b03df1abf828514b0966db058388bf974ed0cf4f

      And this is the pipeline I've used:

          // Pipeline object
          GstElement *pipeline = gst_pipeline_new (NULL);
      
          // v4l2 src, selecting device /dev/video1
          GstElement *src = gst_element_factory_make("v4l2src", NULL);
          g_object_set (src, "device", "/dev/video1", NULL);
      
          // caps selection: format, width, height...
          GstElement *capsfilter = gst_element_factory_make("capsfilter", NULL);
          GstCaps *caps = gst_caps_new_simple("video/x-raw",
                          "format", G_TYPE_STRING, "NV12",
                          "width", G_TYPE_INT, 720,
                          "height", G_TYPE_INT, 576,
                          "framerate", GST_TYPE_FRACTION, 5, 1, NULL);
          g_object_set (capsfilter, "caps", caps, NULL);
      
          // convert to GL texture (as qmlglsink expects, also this force processing the video accelerated by the GPU)
          GstElement *glupload = gst_element_factory_make ("glupload", NULL);
      
          // convert from original video format NV12 to format accepted by qmlglsink (RGBA)
          GstElement *glcolorconvert = gst_element_factory_make ("glcolorconvert", NULL);
      
          // QML element sink
          /* the plugin must be loaded before loading the qml file to register the
           * GstGLVideoItem qml item */
          GstElement *sink = gst_element_factory_make ("qmlglsink", NULL);
          g_object_set (sink, "sync", false, NULL);
      
          // link the elements in the pipeline
          gst_bin_add_many (GST_BIN (pipeline), src, capsfilter, glupload, glcolorconvert, sink, NULL);
          gst_element_link_many (src, capsfilter, glupload, glcolorconvert, sink, NULL);
      
      
      Pablo J. RoginaP 1 Reply Last reply
      1
      • N naggety

        I'm so sorry, I was testing some possible workarounds and I forgot this thread.

        What I've finally done is using Gstreamer (alone, not QTGstreamer) with qmlglsink element. In my case, I needed some fixes in Gstreamer that are going to be included in version 1.15 but it's working.

        About Camera QML element I still don't know if it's supposed to work with analog cameras. I think yes, but I haven't it working yet because I think my driver is a bit buggy, I'll try to fix it.

        I have tested using the QML example from Gstreamer, but modifying the pipeline to use my cameras instead of videotestsrc.

        This is the original example: https://cgit.freedesktop.org/gstreamer/gst-plugins-good/tree/tests/examples/qt/qmlsink?id=b03df1abf828514b0966db058388bf974ed0cf4f

        And this is the pipeline I've used:

            // Pipeline object
            GstElement *pipeline = gst_pipeline_new (NULL);
        
            // v4l2 src, selecting device /dev/video1
            GstElement *src = gst_element_factory_make("v4l2src", NULL);
            g_object_set (src, "device", "/dev/video1", NULL);
        
            // caps selection: format, width, height...
            GstElement *capsfilter = gst_element_factory_make("capsfilter", NULL);
            GstCaps *caps = gst_caps_new_simple("video/x-raw",
                            "format", G_TYPE_STRING, "NV12",
                            "width", G_TYPE_INT, 720,
                            "height", G_TYPE_INT, 576,
                            "framerate", GST_TYPE_FRACTION, 5, 1, NULL);
            g_object_set (capsfilter, "caps", caps, NULL);
        
            // convert to GL texture (as qmlglsink expects, also this force processing the video accelerated by the GPU)
            GstElement *glupload = gst_element_factory_make ("glupload", NULL);
        
            // convert from original video format NV12 to format accepted by qmlglsink (RGBA)
            GstElement *glcolorconvert = gst_element_factory_make ("glcolorconvert", NULL);
        
            // QML element sink
            /* the plugin must be loaded before loading the qml file to register the
             * GstGLVideoItem qml item */
            GstElement *sink = gst_element_factory_make ("qmlglsink", NULL);
            g_object_set (sink, "sync", false, NULL);
        
            // link the elements in the pipeline
            gst_bin_add_many (GST_BIN (pipeline), src, capsfilter, glupload, glcolorconvert, sink, NULL);
            gst_element_link_many (src, capsfilter, glupload, glcolorconvert, sink, NULL);
        
        
        Pablo J. RoginaP Offline
        Pablo J. RoginaP Offline
        Pablo J. Rogina
        wrote on last edited by
        #4

        @naggety great that you found a solution. If your issue is solved please don't forget to mark your post as such. Thanks

        Upvote the answer(s) that helped you solve the issue
        Use "Topic Tools" button to mark your post as Solved
        Add screenshots via postimage.org
        Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

        1 Reply Last reply
        0
        • N Offline
          N Offline
          naggety
          wrote on last edited by
          #5

          Hi @Pablo-J-Rogina, it still remains the question about Camera element from QML. I'd wish to maintain open the post for some days more to see if I solve it and/or anybody can give me some help about it. If not, I will mark as solved in some days.

          Pablo J. RoginaP 1 Reply Last reply
          0
          • N naggety

            Hi @Pablo-J-Rogina, it still remains the question about Camera element from QML. I'd wish to maintain open the post for some days more to see if I solve it and/or anybody can give me some help about it. If not, I will mark as solved in some days.

            Pablo J. RoginaP Offline
            Pablo J. RoginaP Offline
            Pablo J. Rogina
            wrote on last edited by
            #6

            @naggety fair enough

            Upvote the answer(s) that helped you solve the issue
            Use "Topic Tools" button to mark your post as Solved
            Add screenshots via postimage.org
            Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

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

              Hi,

              Might be silly question but, are you sure your pipeline is running properly ?

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

                Hi @SGaist.

                Sorry, I didn't see your reply. I've changed my forum settings to receive an email when someone replies to my posts.

                I guess that the pipeline is not running properly, but I can't know since I didn't made the pipeline. In my original post, I was using Camera QML element, and I have no control over the pipeline it tries to create.

                In my later reply, I show a pipeline made by me that is working. But it's still no possible to use Camera QML element, which is supposed to handle all this automatically.

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

                  Did you consider using the QtGStreamer module directly ?

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

                  N 1 Reply Last reply
                  0
                  • SGaistS SGaist

                    Did you consider using the QtGStreamer module directly ?

                    N Offline
                    N Offline
                    naggety
                    wrote on last edited by naggety
                    #10

                    @SGaist I was considering it, but I read this:

                    The QtGStreamer C++ bindings are very out of date and unmaintained

                    here: https://gstreamer.freedesktop.org/bindings/qt.html

                    Do you think it worth to use it?

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

                      Do you mean the qmlglsink ? Worth a try yes

                      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