GStreamer RTSP server pipeline on Raspberry Pi 4B - gstreamer

I'm trying to set up a RTSP server for my camera on my Raspberry Pi 4B. I installed GStreamer and libgstrtspserver-1.0-dev (version 1.14.4), and am using the test-launch.c script, compiled with gcc test-launch.c -o test-launch $(pkg-config --cflags --libs gstreamer-1.0 gstreamer-rtsp-server-1.0)
I then try to use the pipeline
./test-launch "v4l2src ! 'video/x-raw, width=1280, height=400, framerate=20/1, format=GRAY8' \
! videoconvert ! 'video/x-raw, format=I420' ! v4l2h264enc ! 'video/x-h264, stream-format=byte-stream, \
alignment=au' ! h264parse ! rtph264pay name=pay0 pt=96"
but when I try to connect to it from my other computer (through VLC or OpenCV), I get the GStreamer-CRITICAL messages on the Raspi (I've set GST_DEBUG=4):
j#JRaspi:~/server $ ./test-launch "v4l2src device='/dev/video0' ! 'video/x-raw, width=1280, height=400, format=GRAY8, framerate=20/1' ! videoconvert ! 'video/x-raw, format=I420' ! v4l2h264enc ! 'video/x-h264, stream-format=byte-stream, alignment=au' ! h264parse ! rtph264pay name=pay0 pt=96"
stream ready at rtsp://127.0.0.1:8554/test
(test-launch:8246): GStreamer-CRITICAL **: 14:56:54.865: gst_element_make_from_uri: assertion 'gst_uri_is_valid (uri)' failed
(test-launch:8246): GStreamer-CRITICAL **: 14:56:54.865: gst_element_make_from_uri: assertion 'gst_uri_is_valid (uri)' failed
(test-launch:8246): GStreamer-CRITICAL **: 14:56:54.865: gst_element_make_from_uri: assertion 'gst_uri_is_valid (uri)' failed
and a failed connection.
I can confirm that
gst-launch-1.0 v4l2src ! 'video/x-raw, width=1280, height=400, framerate=20/1, format=GRAY8' \
! videoconvert ! 'video/x-raw, format=I420' ! autovideosink
works for me (displays the camera feed well), so I'm wondering what's wrong with the back of my pipeline or does the test-launch script not work on the Raspberry Pi for some reason?
I've got a similar pipeline working just fine on my Jetson Nano:
./test-launch "v4l2src ! video/x-raw, width=1280, height=400, framerate=20/1, format=GRAY8 \
! nvvidconv ! video/x-raw(memory:NVMM), format=(string)I420 ! omxh264enc ! video/x-h264, \
stream-format=byte-stream, alignment=au ! h264parse ! rtph264pay name=pay0 pt=96"
so I'm kind of lost what's wrong on the Raspberry Pi.
EDIT:
I did some further testing and this circuitous route works for me:
gst-launch-1.0 v4l2src ! 'video/x-raw, width=1280, height=400, \
format=GRAY8' ! videoconvert ! 'video/x-raw, format=I420'\
! v4l2h264enc ! 'video/x-h264, stream-format=byte-stream, alignment=au' \
! h264parse ! rtph264pay name=pay0 pt=96 ! rtph264depay ! h264parse \
! decodebin ! videoconvert ! autovideosink
so I'm wondering if it's a problem with test-launch and Raspberry Pi?
EDIT2:
So I ran G_DEBUG=fatal-criticals gdb -ex run --args test-launch "v4l2src ! 'video/x-raw, width=1280, height=400, format=GRAY8' ! videoconvert ! 'video/x-raw, format=I420' ! v4l2h264enc ! 'video/x-h264, stream-format=byte-stream, alignment=au' ! h264parse ! rtph264pay name=pay0 pt=96"
which printed out:
Reading symbols from test-launch...(no debugging symbols found)...done.
Starting program: /home/joel/Arducam-Stereo-RPI/server/test-launch v4l2src\ \!\ \'video/x-raw,\ width=1280,\ height=400,\ format=GRAY8\'\ \!\ videoconvert\ \!\ \'video/x-raw,\ format=I420\'\ \!\ v4l2h264enc\ \!\ \'video/x-h264,\ stream-format=byte-stream,\ alignment=au\'\ \!\ h264parse\ \!\ rtph264pay\ name=pay0\ pt=96
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
stream ready at rtsp://127.0.0.1:8554/test
[New Thread 0xb657b3a0 (LWP 2529)]
(test-launch:2524): GStreamer-CRITICAL **: 16:46:07.769: gst_element_make_from_uri: assertion 'gst_uri_is_valid (uri)' failed
(test-launch:2524): GStreamer-CRITICAL **: 16:46:07.787: gst_element_make_from_uri: assertion 'gst_uri_is_valid (uri)' failed
(test-launch:2524): GStreamer-CRITICAL **: 16:46:07.788: gst_element_make_from_uri: assertion 'gst_uri_is_valid (uri)' failed
[New Thread 0xb57743a0 (LWP 2530)]
(test-launch:2524): GStreamer-CRITICAL **: 16:46:27.960: gst_element_make_from_uri: assertion 'gst_uri_is_valid (uri)' failed
(test-launch:2524): GStreamer-CRITICAL **: 16:46:27.960: gst_element_make_from_uri: assertion 'gst_uri_is_valid (uri)' failed
(test-launch:2524): GStreamer-CRITICAL **: 16:46:27.960: gst_element_make_from_uri: assertion 'gst_uri_is_valid (uri)' failed
[Thread 0xb57743a0 (LWP 2530) exited]
[Thread 0xb657b3a0 (LWP 2529) exited]
^C
Thread 1 "test-launch" received signal SIGINT, Interrupt.
__GI___poll (timeout=-1, nfds=2, fds=0x2e7e0)
--Type <RET> for more, q to quit, c to continue without paging--
at ../sysdeps/unix/sysv/linux/poll.c:29
29 ../sysdeps/unix/sysv/linux/poll.c: No such file or directory.
(gdb) bt
#0 0xb6b4dcd0 in __GI___poll (timeout=-1, nfds=2, fds=0x2e7e0)
at ../sysdeps/unix/sysv/linux/poll.c:29
#1 0xb6b4dcd0 in __GI___poll (fds=0x2e7e0, nfds=2, timeout=-1)
at ../sysdeps/unix/sysv/linux/poll.c:26
#2 0xb6c45eb4 in () at /usr/lib/arm-linux-gnueabihf/libglib-2.0.so.0
(gdb)
So I tried sudo apt-get install --reinstall libglib2.0-0 but it didn't change anything

The extra single quotation marks in the pipeline caused the problem.
So a working pipeline would be:
./test-launch "v4l2src ! video/x-raw, width=1280, height=400, format=GRAY8 \
! videoconvert ! video/x-raw, format=I420 ! v4l2h264enc ! video/x-h264, \
stream-format=byte-stream, alignment=au ! h264parse ! rtph264pay name=pay0 pt=96"

Related

gstreamer fallbacksrc plugin can not link glimagesink

I want to use the gstreamer plugin fallbacksrc on linux.
fallbacksrc (with ximagesink) -> OK
gst-launch-1.0 fallbacksrc \
uri=https://www.freedesktop.org/software/gstreamer-sdk/data/media/sintel_trailer-480p.webm \
fallback-uri=file:///path/to/some/jpg \
! videoconvert \
! ximagesink
It works as expected.
fallbacksrc (with glimagesink) -> NG
gst-launch-1.0 fallbacksrc \
uri=https://www.freedesktop.org/software/gstreamer-sdk/data/media/sintel_trailer-480p.webm \
fallback-uri=file:///path/to/some/jpg \
! videoconvert \
! glimagesink
It does not work.
error message
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: Noformat', utils/fallbackswitch/src/fallbacksrc/imp.rs:1897:36
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
fatal runtime error: failed to initiate panic, error 5
It seems pad linking(capability) problem. But even if I inserted capsfilter video/x-raw before videoconvert, same error happens.
How to use fallbacksrc with glimagesink ?
Environment
gstreamer version
1.22 (installed by archlinux package repo)
gst-plugins-rs
0.9.7 (installed by archlinux user package repo)

Gstreamer warning: Failed to load plugin libgstcoreelemets.so

Undefined symbol: gst_type_find_helper_for_data_with_extension
Platform: Jetson Xavier NX, gstreamer version:1.0

GStreamer-CRITICAL **: 14:17:18.242: gst_element_make_from_uri: assertion 'gst_uri_is_valid (uri)' failed

I'm in Ubuntu 20.04 using Opencv 4.4.0 in C++. I can run the file but failure throwing the next message:
[ WARN:0] global /home/user/opencv-4.4.0/modules/videoio/src/cap_gstreamer.cpp (713) open OpenCV | GStreamer warning: Error opening bin: error de sintaxis
[ WARN:0] global /home/user/opencv-4.4.0/modules/videoio/src/cap_gstreamer.cpp (480) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created
Error opening video stream or file
I don't know what's the problem

Can raspistill connect with rtpjpegpay by pipeline

pi#raspberrypi:~ $ raspistill -w 800 -h 600 -tl 0 -t 0 -o - | test-launch "fdsrc ! image/jpeg ! jpegparse ! rtpjpegpay"
stream ready at rtsp://127.0.0.1:8554/test
But I failed to use vlc in win10 to connect with raspberry pi3. I dont know where the problem is. I can't get any error information. I success in running this command :
raspivid -t 0 -h 1920 -w 1080 -fps 30 -o - | ./test-launch " fdsrc ! h264parse ! rtph264pay name=pay0 pt=96 "
So, I think my command is okay. Could someone help me?Thanks.
HaHa, I think I have resolved my own question ( 哈哈哈,我认为我解决了自己的问题 )。Now, let me help you.
The server is
raspistill -w 800 -h 600 -tl 0 -t 0 -o - | test-launch "fdsrc ! image/jpeg,width=800,height=600 ! jpegparse ! rtpjpegpay name=pay0 pt=96"
The client is
gst-launch-1.0.exe rtspsrc location=rtsp://192.168.1.30:8554/test ! rtpjpegdepay ! jpegparse ! multifilesink location="%d.jpeg"
or
gst-launch-1.0.exe rtspsrc location=rtsp://192.168.1.30:8554/test ! rtpjpegdepay ! jpegparse ! jpegdec ! videoconvert ! autovideosink
vlc can't resolv the flow from server temporarily. So don't to use it !

GStreamer error in Qt5

When I try to launch my videowidget application it gives me the error:
(videowidget:9305): GLib-GObject-WARNING **: cannot register existing type 'GstObject'
(videowidget:9305): GLib-CRITICAL **: g_once_init_leave: assertion 'result != 0' failed
(videowidget:9305): GLib-GObject-CRITICAL **: g_type_register_static: assertion 'parent_type > 0' failed
(videowidget:9305): GLib-CRITICAL **: g_once_init_leave: assertion 'result != 0' failed
(videowidget:9305): GStreamer-CRITICAL **: gst_element_class_set_details_simple: assertion 'GST_IS_ELEMENT_CLASS (klass)' failed
(videowidget:9305): GStreamer-WARNING **: static caps 0xade3824c string is NULL
(videowidget:9305): GStreamer-CRITICAL **: gst_mini_object_unref: assertion 'mini_object != NULL' failed
(videowidget:9305): GStreamer-WARNING **: static caps 0xade3828c string is NULL
(videowidget:9305): GStreamer-CRITICAL **: gst_mini_object_unref: assertion 'mini_object != NULL' failed
(videowidget:9305): GStreamer-WARNING **: static caps 0xade3824c string is NULL
(videowidget:9305): GStreamer-CRITICAL **: gst_mini_object_unref: assertion 'mini_object != NULL' failed
I have two GStreamer versions installed on my target machine 0.10 and 1.0 which runs on Jessie 8.2.
I figured out that when I uninstall 1.0, 0.10 version requires an .so file from gstreamer1.0.
VideoWidget example from Qt example folder works fine, but the simple example from doc.qt.io/qt-5/videooverview.html won't work.
1.0 and 0.10 are parallel installable and I doubt one is trying to use a file from the other.
Those issues usually happen when the application was linked against both versions. While you can have both at your system, applications should link only against one of them.
when you construct an object ,it's parent should be Q_NULL_POINTER.
QFileDialog *pDlg = new QFileDialog();
instead of
QFileDialog *pDlg = new QFileDialog(this);