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. MediaPlayer VideoOutput SIGSEGV gst_v4l2_object_fill_format_list
Qt 6.11 is out! See what's new in the release blog

MediaPlayer VideoOutput SIGSEGV gst_v4l2_object_fill_format_list

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
14 Posts 3 Posters 3.4k 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.
  • JoeCFDJ Offline
    JoeCFDJ Offline
    JoeCFD
    wrote on last edited by JoeCFD
    #2

    try from command line:
    gst-launch-1.0 v4l2src device=/dev/video2 ! capsfilter caps=video/x-raw,width=720,height=480,framerate=25/1 | autovideosink
    or
    gst-launch-1.0 v4l2src device=/dev/video2 ! capsfilter caps=video/x-raw,width=720,height=480,framerate=25/1 | waylandsink
    to see if your pipeline works or not at first.

    If not, show the output here.
    gst-launch-1.0 -v v4l2src device=/dev/video2 ! capsfilter caps=video/x-raw,width=720,height=480,framerate=25/1 | autovideosink

    P 1 Reply Last reply
    0
    • JoeCFDJ JoeCFD

      try from command line:
      gst-launch-1.0 v4l2src device=/dev/video2 ! capsfilter caps=video/x-raw,width=720,height=480,framerate=25/1 | autovideosink
      or
      gst-launch-1.0 v4l2src device=/dev/video2 ! capsfilter caps=video/x-raw,width=720,height=480,framerate=25/1 | waylandsink
      to see if your pipeline works or not at first.

      If not, show the output here.
      gst-launch-1.0 -v v4l2src device=/dev/video2 ! capsfilter caps=video/x-raw,width=720,height=480,framerate=25/1 | autovideosink

      P Offline
      P Offline
      petero3
      wrote on last edited by
      #3

      Hi @JoeCFD thank you for replying. Yes pipeline works from the command line each time:

      gst-launch-1.0 v4l2src device=/dev/video2 ! capsfilter caps=video/x-raw,width=720,height=480,framerate=25/1 ! autovideosink

      JoeCFDJ 1 Reply Last reply
      0
      • P petero3

        Hi @JoeCFD thank you for replying. Yes pipeline works from the command line each time:

        gst-launch-1.0 v4l2src device=/dev/video2 ! capsfilter caps=video/x-raw,width=720,height=480,framerate=25/1 ! autovideosink

        JoeCFDJ Offline
        JoeCFDJ Offline
        JoeCFD
        wrote on last edited by
        #4

        @petero3 What is your Qt version?

        P 1 Reply Last reply
        0
        • JoeCFDJ JoeCFD

          @petero3 What is your Qt version?

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

          @JoeCFD Qt 6.8.3

          JoeCFDJ 1 Reply Last reply
          0
          • P petero3

            @JoeCFD Qt 6.8.3

            JoeCFDJ Offline
            JoeCFDJ Offline
            JoeCFD
            wrote on last edited by
            #6

            @petero3 I guess Qt6 might have removed this feature of running a gstreamer pipeline. This feature is only available in Qt5.

            SGaistS P 2 Replies Last reply
            0
            • JoeCFDJ JoeCFD

              @petero3 I guess Qt6 might have removed this feature of running a gstreamer pipeline. This feature is only available in Qt5.

              SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #7

              @JoeCFD that feature was removed.
              Also, unless explicitly selected, the default backend uses ffmpeg.

              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
              • JoeCFDJ JoeCFD

                @petero3 I guess Qt6 might have removed this feature of running a gstreamer pipeline. This feature is only available in Qt5.

                P Offline
                P Offline
                petero3
                wrote on last edited by
                #8

                @JoeCFD @SGaist

                IIRC gstreamer pipelines were removed in the first Qt 6 versions, but are present in later ones.

                The following works fine with Qt 6.8.3:

                player.source = "gstreamer-pipeline: videotestsrc ! capsfilter caps=video/x-raw,width=720,height=480,framerate=25/1"

                As long as source is set dynamically onCompleted as per:
                https://bugreports.qt.io/browse/QTBUG-134554

                and:

                player.source = "gstreamer-pipeline: v4l2src device=/dev/video2 ! capsfilter caps=video/x-raw,width=720,height=480,framerate=25/1"

                does not always fail. If gst_v4l2_object_fill_format_list is going to segfault, it does so early. If it doesn't segfault, then it works.

                So present, but flaky for some reason.

                We are also trying qml6glsink, but so far that just gives a white screen on our device.

                JoeCFDJ 1 Reply Last reply
                0
                • P petero3

                  @JoeCFD @SGaist

                  IIRC gstreamer pipelines were removed in the first Qt 6 versions, but are present in later ones.

                  The following works fine with Qt 6.8.3:

                  player.source = "gstreamer-pipeline: videotestsrc ! capsfilter caps=video/x-raw,width=720,height=480,framerate=25/1"

                  As long as source is set dynamically onCompleted as per:
                  https://bugreports.qt.io/browse/QTBUG-134554

                  and:

                  player.source = "gstreamer-pipeline: v4l2src device=/dev/video2 ! capsfilter caps=video/x-raw,width=720,height=480,framerate=25/1"

                  does not always fail. If gst_v4l2_object_fill_format_list is going to segfault, it does so early. If it doesn't segfault, then it works.

                  So present, but flaky for some reason.

                  We are also trying qml6glsink, but so far that just gives a white screen on our device.

                  JoeCFDJ Offline
                  JoeCFDJ Offline
                  JoeCFD
                  wrote on last edited by JoeCFD
                  #9

                  @petero3 What env settings in main() you have?
                  Show me the code how qml sink is applied.

                  P 1 Reply Last reply
                  0
                  • JoeCFDJ JoeCFD

                    @petero3 What env settings in main() you have?
                    Show me the code how qml sink is applied.

                    P Offline
                    P Offline
                    petero3
                    wrote on last edited by
                    #10

                    @JoeCFD thank you.
                    Below is the code for the MediaPlayer/VideoOutput with the intermittent segfault.
                    Will ask my colleague to share the code for the qml6glsink
                    We also have this gstreamer post re that:
                    https://discourse.gstreamer.org/t/qmlsink-example-on-imx8qxp-board-doesnt-render-videotstsrc-only-white-screen/4579

                    #include <QGuiApplication>
                    #include <QQmlApplicationEngine>
                    #include <QFile>
                    
                    int main(int argc, char *argv[])
                    {   
                        qputenv("GST_DEBUG", "4");
                        qputenv("GST_DEBUG_DUMP_DOT_DIR", "/appdata/");
                        qputenv("QT_LOGGING_RULES", "*.multimedia.*=true");
                          
                        QGuiApplication app(argc, argv);
                        
                        QQmlApplicationEngine engine;
                        QObject::connect(
                            &engine, &QQmlApplicationEngine::objectCreationFailed, &app,
                            []() { QCoreApplication::exit(-1); }, Qt::QueuedConnection);
                        engine.loadFromModule("video", "Main");
                        
                        return app.exec();
                    }
                    
                    import QtQuick
                    import QtMultimedia
                    
                    Window {
                        width: 1280
                        height: 768
                        visible: true
                        title: qsTr("Hello World")
                    
                        Item {
                            anchors.fill: parent
                    
                            MediaPlayer {
                                id: player
                                videoOutput: videoOutput
                            }
                    
                            VideoOutput {
                                id: videoOutput
                                anchors.fill: parent
                            }
                    
                            Component.onCompleted: {
                                // works
                                //player.source = "gstreamer-pipeline: videotestsrc ! capsfilter caps=video/x-raw,width=720,height=480,framerate=25/1"
                    
                                // segfaults intermittently
                                player.source = "gstreamer-pipeline: v4l2src device=/dev/video2 ! capsfilter caps=video/x-raw,width=720,height=480,framerate=25/1"
                    
                                player.play()
                            }
                        }
                    }
                    
                    1 Reply Last reply
                    0
                    • P Offline
                      P Offline
                      petero3
                      wrote on last edited by
                      #11

                      PS. For the qml6glsink white screen issue, the code is the standard qmlsink example:
                      https://gitlab.freedesktop.org/gstreamer/gstreamer/-/tree/main/subprojects/gst-plugins-good/tests/examples/qt6/qmlsink?ref_type=heads
                      https://discourse.gstreamer.org/t/qmlsink-example-on-imx8qxp-board-doesnt-render-videotstsrc-only-white-screen/4579

                      JoeCFDJ 1 Reply Last reply
                      0
                      • P petero3

                        PS. For the qml6glsink white screen issue, the code is the standard qmlsink example:
                        https://gitlab.freedesktop.org/gstreamer/gstreamer/-/tree/main/subprojects/gst-plugins-good/tests/examples/qt6/qmlsink?ref_type=heads
                        https://discourse.gstreamer.org/t/qmlsink-example-on-imx8qxp-board-doesnt-render-videotstsrc-only-white-screen/4579

                        JoeCFDJ Offline
                        JoeCFDJ Offline
                        JoeCFD
                        wrote on last edited by
                        #12

                        @petero3 does your code work on Ubuntu or Redhat?
                        Is wayland applied in Yocto? If yes, the following envs are needed.

                        #ifdef YOCTO
                            setenv( "DISPLAY",         ":0",      1 );
                            setenv( "GDK_BACKEND",     "wayland", 1 );
                            setenv( "QT_QPA_PLATFORM", "wayland", 1 );
                        
                            setenv( "XDG_RUNTIME_DIR", "/run/user/1000",            1 );
                            setenv( "WAYLAND_DISPLAY", "wayland-1",                 1 );
                            setenv( "QT_QPA_FONTDIR",  "/usr/share/fonts/truetype", 1 );
                        #endif
                        
                        1 Reply Last reply
                        0
                        • P Offline
                          P Offline
                          petero3
                          wrote on last edited by
                          #13

                          In case anyone encounters the same issue, what worked for us is to use:
                          https://gitlab.freedesktop.org/gstreamer/gstreamer/-/blob/main/subprojects/gst-plugins-good/tests/examples/qt6/qmlsink/main.cpp
                          but change:
                          QQuickWindow::BeforeSynchronizingStage to QQuickWindow::NoStage
                          Not sure why that was necessary, but that's what worked.
                          https://discourse.gstreamer.org/t/qmlsink-example-on-imx8qxp-board-doesnt-render-videotstsrc-only-white-screen/4579/5

                          1 Reply Last reply
                          0
                          • L LawrenceLee referenced this topic on
                          • P Offline
                            P Offline
                            petero3
                            wrote on last edited by
                            #14

                            With
                            player.source = "gstreamer-pipeline:v4l2src device=/dev/video4 ! capsfilter caps=video/x-raw,width=720,height=480,framerate=30/1"

                            Segfault
                            1 format_cmp_func gstv4l2object.c 1328 0xffffcf22524c
                            2 g_slist_insert_sorted_real gslist.c 862 0xfffff6143070
                            3 g_slist_insert_sorted gslist.c 913 0xfffff6143a5c
                            4 gst_v4l2_object_fill_format_list gstv4l2object.c 1376 0xffffcf2243a4
                            5 gst_v4l2_object_get_format_list gstv4l2object.c 1425 0xffffcf224874
                            6 gst_v4l2_object_probe_caps gstv4l2object.c 5446 0xffffcf230414
                            7 gst_v4l2_object_get_caps gstv4l2object.c 5635 0xffffcf230a74
                            8 gst_base_src_default_query gstbasesrc.c 1373 0xffffe16fae8c
                            9 gst_pad_query gstpad.c 4252 0xffffe15c0d28
                            10 gst_pad_query_caps gstutils.c 3117 0xffffe160af8c
                            11 gst_v4l2src_negotiate gstv4l2src.c 788 0xffffcf23b584
                            12 gst_base_src_negotiate_unlocked gstbasesrc.c 3502 0xffffe16f543c
                            13 gst_base_src_loop gstbasesrc.c 2920 0xffffe16f7780
                            14 gst_task_func gsttask.c 399 0xffffe15fb354
                            15 g_thread_pool_thread_proxy gthreadpool.c 336 0xfffff615325c
                            16 g_thread_proxy gthread.c 890 0xfffff6152b40
                            17 start_thread pthread_create.c 448 0xfffff656085c
                            18 thread_start clone3.S 76 0xfffff65c40cc

                            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