Video camera and Qt under Linux. How can I display a camera video in a Qt app?
-
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?
-
@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.