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 camera and Qt under Linux. How can I display a camera video in a Qt app?
Forum Updated to NodeBB v4.3 + New Features

Video camera and Qt under Linux. How can I display a camera video in a Qt app?

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
3 Posts 2 Posters 593 Views
  • 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.
  • M Offline
    M Offline
    martindenion
    wrote on last edited by
    #1

    I have Qt 5.12.12 and GStreamer V1.16.2 and an analog rear view camera under Linux.

    I can simply start a window playing video from the camera using this command:

    gst-launch-1.0 v4l2src device=/dev/video3 ! videoconvert ! waylandsink
    

    I can also do the exact same thing from my Qt application using the GStreamer library.

    The problem is that when I start reading the pipeline it creates a window on my Qt application (I assume it's because of the Wayland sink)

    What I would like is for this video camera to be played in my Qt application (in a QWidget for example, I cannot use QML).

    I also tried using QCamera but QCameraInfo::availableCameras() returns an empty list.

    Here are the sink I have on my Linux:

    video4linux2:  v4l2sink: Video (video4linux2) Sink
    autodetect:  autoaudiosink: Auto audio sink
    autodetect:  autovideosink: Auto video sink
    multifile:  splitmuxsink: Split Muxing Bin
    multifile:  multifilesink: Multi-File Sink
    alsa:  alsasink: Audio sink (ALSA)
    ossaudio:  osssink: Audio Sink (OSS)
    soup:  souphttpclientsink: HTTP client sink
    app:  appsink: AppSink
    opengl:  glsinkbin: GL Sink Bin
    opengl:  glimagesinkelement: OpenGL video sink
    opengl:  glimagesink: GL Sink Bin
    tcp:  multisocketsink: Multi socket sink
    tcp:  multifdsink: Multi filedescriptor sink
    tcp:  tcpserversink: TCP server sink
    tcp:  tcpclientsink: TCP client sink
    debug:  testsink: Test plugin
    pulseaudio:  pulsesink: PulseAudio Audio Sink
    qmlgl:  qmlglsink: Qt Video Sink
    udp:  dynudpsink: UDP packet sender
    udp:  multiudpsink: UDP packet sender
    udp:  udpsink: UDP packet sender
    playback:  playsink: Player Sink
    gdkpixbuf:  gdkpixbufsink: GdkPixbuf sink
    gio:  giostreamsink: GIO stream sink
    gio:  giosink: GIO sink
    coreelements:  filesink: File Sink
    coreelements:  fdsink: Filedescriptor Sink
    coreelements:  fakesink: Fake Sink
    waylandsink:  waylandsink: wayland video sink
    kms:  kmssink: KMS video sink
    

    What method should I use to do that?

    JoeCFDJ 1 Reply Last reply
    0
    • M martindenion

      I have Qt 5.12.12 and GStreamer V1.16.2 and an analog rear view camera under Linux.

      I can simply start a window playing video from the camera using this command:

      gst-launch-1.0 v4l2src device=/dev/video3 ! videoconvert ! waylandsink
      

      I can also do the exact same thing from my Qt application using the GStreamer library.

      The problem is that when I start reading the pipeline it creates a window on my Qt application (I assume it's because of the Wayland sink)

      What I would like is for this video camera to be played in my Qt application (in a QWidget for example, I cannot use QML).

      I also tried using QCamera but QCameraInfo::availableCameras() returns an empty list.

      Here are the sink I have on my Linux:

      video4linux2:  v4l2sink: Video (video4linux2) Sink
      autodetect:  autoaudiosink: Auto audio sink
      autodetect:  autovideosink: Auto video sink
      multifile:  splitmuxsink: Split Muxing Bin
      multifile:  multifilesink: Multi-File Sink
      alsa:  alsasink: Audio sink (ALSA)
      ossaudio:  osssink: Audio Sink (OSS)
      soup:  souphttpclientsink: HTTP client sink
      app:  appsink: AppSink
      opengl:  glsinkbin: GL Sink Bin
      opengl:  glimagesinkelement: OpenGL video sink
      opengl:  glimagesink: GL Sink Bin
      tcp:  multisocketsink: Multi socket sink
      tcp:  multifdsink: Multi filedescriptor sink
      tcp:  tcpserversink: TCP server sink
      tcp:  tcpclientsink: TCP client sink
      debug:  testsink: Test plugin
      pulseaudio:  pulsesink: PulseAudio Audio Sink
      qmlgl:  qmlglsink: Qt Video Sink
      udp:  dynudpsink: UDP packet sender
      udp:  multiudpsink: UDP packet sender
      udp:  udpsink: UDP packet sender
      playback:  playsink: Player Sink
      gdkpixbuf:  gdkpixbufsink: GdkPixbuf sink
      gio:  giostreamsink: GIO stream sink
      gio:  giosink: GIO sink
      coreelements:  filesink: File Sink
      coreelements:  fdsink: Filedescriptor Sink
      coreelements:  fakesink: Fake Sink
      waylandsink:  waylandsink: wayland video sink
      kms:  kmssink: KMS video sink
      

      What method should I use to do that?

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

      @martindenion said in Video camera and Qt under Linux. How can I display a camera video in a Qt app?:

      in a QWidget for example, I cannot use QML

      in a QWidget for example, I cannot use QML)
      You can use QML with QQuickWidget. This is what I am doing with customized gstreamer pipelines and works fine.

      JoeCFDJ 1 Reply Last reply
      0
      • JoeCFDJ JoeCFD

        @martindenion said in Video camera and Qt under Linux. How can I display a camera video in a Qt app?:

        in a QWidget for example, I cannot use QML

        in a QWidget for example, I cannot use QML)
        You can use QML with QQuickWidget. This is what I am doing with customized gstreamer pipelines and works fine.

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

        @JoeCFD also check this out if you prefer using widget
        https://forum.qt.io/topic/154779/qt6-qtwayland-problem-with-gstreamer-waylandsink-a-qwidget-not-showing-video-stream/6?_=1710172168973

        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