gstreamer rtsp unauthorized while VLC can play - gstreamer

I have a working pipeline begins with :
gst-launch-1.0 rtspsrc location=rtsp://Test_Map:T3$t1ng_2022_Map#x.x.x.x:zzzz/ISAPI/Streaming/Channels/101
which gives Unauthorized error. But vlc can open same stream .
any idea?
gst-launch should open the rtsp

You should use the user-id and user-pw argument with proper ""
than it will work.

Related

How can I choose which stream to display using gst-launch-1.0?

I have a parrot drone that has 4 cameras being streamed with RTSP. The 4 cameras are being streamed by the same location (rtsp://192.168.53.1:554/live). Is it possible to choose which stream I want to be displayed using gst-launch-1.0?
When I run:
gst-launch-1.0 rtspsrc location=rtsp://192.168.53.1:554/live latency=0 ! queue ! rtph264depay ! h264parse ! avdec_h264 ! videoconvert ! videoscale ! video/x-raw,width=1920,height=1080 ! autovideosink
I can see one of the streams, the problem is that the stream displayed is a random one from the four.
The output from the gst-launch-1.0 is the following:
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Progress: (open) Opening Stream
Progress: (connect) Connecting to rtsp://192.168.53.1:554/live
Progress: (open) Retrieving server options
Progress: (open) Retrieving media info
Progress: (request) SETUP stream 0
Progress: (request) SETUP stream 1
Progress: (request) SETUP stream 2
Progress: (request) SETUP stream 3
Progress: (open) Opened Stream
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Progress: (request) Sending PLAY request
Progress: (request) Sending PLAY request
Progress: (request) Sent PLAY request
The following images are frames that I extracted from 2 of the 4 streams where, one time the displayed stream was the one from the main camera and another time the one from stereo.
Frame of the main camera stream:
Frame of one stereo camera stream:

GStreamer and RTSP stream

I'm trying to view an rtsp stream trough gstreamer but when i run this command:
gst-launch-1.0 rtspsrc location=rtsp://admin:#192.168.1.27:554/ch0_0.264 ! videoconvert ! video/x-raw ! autovideosink
it blocks here and doesn't display anything.
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Progress: (open) Opening Stream
Pipeline is PREROLLED ...
Prerolled, waiting for progress to finish...
Progress: (connect) Connecting to rtsp://admin:#192.168.1.27:554/ch0_0.264
Progress: (open) Retrieving server options
Progress: (open) Retrieving media info
Progress: (request) SETUP stream 0
Progress: (request) SETUP stream 1
Progress: (open) Opened Stream
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Progress: (request) Sending PLAY request
Progress: (request) Sending PLAY request
Progress: (request) Sent PLAY request
Redistribute latency...
I'm new to gstreamer. Can someone hepl me with that?
Thanks in advice.
Using decodebin I found out that the H264 decoder was missing so I solved it by installing the package gst-libav

Gstreamer to html with busybox

I'm trying to stream video using gstreamer to html usign busybox in petalinux, within of a zynqmp based platform.
So the main idea is to stream a video pipeline into an embedded web server and open it from a external PC web browser (I'm using chrome).
The index.html file looks like that:
<!DOCTYPE html>
<html>
<p> video test ! </p>
<body>
<video autoplay controls width=1280 height=1024>
<source src="http://192.168.1.12:5000" type="video/mp4">
Your browser does not support the video tag.
</video>
</body>
</html>
And the testing pipeline is:
gst-launch-1.0 -v videotestsrc pattern=snow is-live=true ! video/x-raw,width=1280,height=1024 ! theoraenc ! oggmux ! tcpserversink host=192.168.1.12 port=5000
Also I tried to stream a video camera live from a C application like so:
appsrc -> queue -> omxh264 -> h264parser -> mp4mux (streamable=true fragment-duration = 100) -> queue -> tcpserversink (host=192.168.1.12 port=5000)
(Please note that the above line is a pseudo code to illustrate what the application is doing)
I'm expecting to see the video in the PC web browser but unfortunately I've got a grey box with the video controls instead.
Does anyone know if this would be possible using busybox? or is there something fundamentally wrong with this approach?

Gstreamer rtspsrc+decodebin vs uridecodebin

Consider the following gstreamer commands (I'm trying them in Windows):
gst-launch-1.0 rtspsrc location=rtsp://<path-to-stream> ! decodebin ! autovideosink
gst-launch-1.0 uridecodebin uri=rtsp://<path-to-stream> ! autovideosink
Both commands should play video on auto created window. But in my case first one can start playing only about in 1 of 5 attempts. Whereas second one works every time.
In case of failure first command prints out the following messages:
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Progress: (open) Opening Stream
Progress: (connect) Connecting to rtsp://<path-to-stream-here>
Progress: (open) Retrieving server options
Progress: (open) Retrieving media info
Progress: (request) SETUP stream 0
Progress: (request) SETUP stream 1
Progress: (open) Opened Stream
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Progress: (request) Sending PLAY request
Progress: (request) Sending PLAY request
Progress: (request) Sent PLAY request
WARNING: from element /GstPipeline:pipeline0/GstDecodeBin:decodebin0: Delayed linking failed.
Additional debug info:
./grammar.y(506): gst_parse_no_more_pads (): /GstPipeline:pipeline0/GstDecodeBin:decodebin0:
failed delayed linking some pad of GstDecodeBin named decodebin0 to some pad of
GstAutoVideoSink named autovideosink0
ERROR: from element /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0/GstUDPSrc:udpsrc0: Internal data flow error.
Additional debug info:
gstbasesrc.c(2948): gst_base_src_loop (): /GstPipeline:pipeline0/GstRTSPSrc:rtsp
src0/GstUDPSrc:udpsrc0:
streaming task paused, reason not-linked (-1)
Execution ended after 0:00:02.289918784
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...
What's the main difference between those commands from user's point of view?
Is it possible to make first command more reliable (i.e. works without errors like second one)?
Has you set other properoties, such as caps="application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264".
If the parameters don't match, it will report an error!

How to stream a video file from a amazon server using gstreamer to the internet

I have found the way to stream the videotestsrc element to the internet by calling these functions in the test-video.c file of gst-rtsp-server examples directory:
gst_rtsp_server_set_address(server,"10.xxx.xx.xxx");
gst_rtsp_server_set_service(server,"8555");
and unblocking the ports in the aws console.
But now replacing videotestsrc with the following in test-video.c, like below:
gst_rtsp_media_factory_set_launch (factory, "( "
"filesrc location=/home/ubuntu/DELTA.mpg ! mpeg2dec ! x264enc ! rtph264pay name=pay0 pt=96 "
")");
I am not able to get the stream visible on the vlc player.
Trying the below command produces following output:
ubuntu#ip-xx-xxx-xx-xxx:~/gst-rtsp-server-1.2.3/examples$ /usr/local/bin/gst-launch-1.0 playbin uri=rtsp://10.xxx.xx.xxx:8555/test
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Progress: (open) Opening Stream
Progress: (connect) Connecting to rtsp://10.185.10.118:8555/test
Progress: (open) Retrieving server options
Progress: (open) Retrieving media info
Progress: (request) SETUP stream 0
Progress: (open) Opened Stream
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Progress: (request) Sending PLAY request
Progress: (request) Sending PLAY request
Progress: (request) Sent PLAY request
(lt-test-video1:9027): GLib-CRITICAL **: unblock_source: assertion `!SOURCE_DEST
ROYED (source)' failed
WARNING: from element /GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0/GstRTSP
Src:source: Could not read from resource.
Additional debug info:
gstrtspsrc.c(4367): gst_rtspsrc_reconnect (): /GstPlayBin:playbin0/GstURIDecodeB
in:uridecodebin0/GstRTSPSrc:source:
Could not receive any UDP packets for 5.0000 seconds, maybe your firewall is blo
cking it. Retrying using a TCP connection.
♥handling interrupt.
Interrupt: Stopping pipeline ...
Execution ended after 0:00:22.473442001
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...
ubuntu#ip-10-xxx-xx-xxx:~/gst-rtsp-server-1.2.3/examples$
What am I doing wrong here ?