Raspberry - gst-rtsp-server

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

Raspberry - gst-rtsp-server

horai
Dear all,

I found your article about GST-RTSP-SERVER
http://gstreamer-devel.966125.n4.nabble.com/RTSP-server-problems-with-uvch264src-H-W-encoded-H-264-output-td4659582.html
which is very useful as I am trying to create the same on Raspberry Pi
slightly different way and I would like to kindly ask anyone of you for a
help.
Actually,I have this pipeline for server:
./examples/test-launch "( v4l2src device=/dev/video0 !
video/x-raw,width=1280,height=720,framerate=30/1 ! videoconvert !  x264enc !
rtph264pay name=pay0 pt=96 )"

And this for client:
gst-launch-1.0 rtspsrc location="rtsp://127.0.0.1:8554/test" latency=0 !
rtph264depay ! decodebin ! videoconvert ! autovideosink

I also tried adding h264parse element, but seems have no influence.
The server starts and while connecting to it with client, it lights up
camera LED diode, but the client finishes yielding following error message
simultaneously switching off the camera LED diode:

Pipeline is live and does not need PREROLL ...
Progress: (open) Opening Stream
Progress: (connect) Connecting to rtsp://127.0.0.1:8554/test
Progress: (open) Retrieving server options
Progress: (open) Retrieving media info
ERROR: from element /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0: Could not
read from resource.
Additional debug info:
gstrtspsrc.c(5637): gst_rtspsrc_send ():
/GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0:
Got error response: 503 (Service Unavailable).
ERROR: pipeline doesn't want to preroll.
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...

Exactly the same pipelines work on Ubuntu 14.04. Gst-rtsp-Server version
1.4, I also tried version 1.2, with no luck.
Actually this guy here is using another approach bypassing v4l2src element,
but I desprately need v4l2src.
https://www.stev.org/post/raspberrypisimplertspserver

Thank you very much for your help

Best regards,
Ivo



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Raspberry - gst-rtsp-server

Nicolas Dufresne-5
Le mercredi 06 décembre 2017 à 11:06 -0700, horai a écrit :

> Dear all,
>
> I found your article about GST-RTSP-SERVER
> http://gstreamer-devel.966125.n4.nabble.com/RTSP-server-problems-with
> -uvch264src-H-W-encoded-H-264-output-td4659582.html
> which is very useful as I am trying to create the same on Raspberry
> Pi
> slightly different way and I would like to kindly ask anyone of you
> for a
> help.
> Actually,I have this pipeline for server:
> ./examples/test-launch "( v4l2src device=/dev/video0 !
> video/x-raw,width=1280,height=720,framerate=30/1 ! videoconvert
> !  x264enc !
> rtph264pay name=pay0 pt=96 )"
On the Pi, you should try and replace x264enc with omxh264enc.
specially the default setting of x264enc will be too heavy for the Pi
and may cause issues / timeout on the receiver.

>
> And this for client:
> gst-launch-1.0 rtspsrc location="rtsp://127.0.0.1:8554/test"
> latency=0 !
> rtph264depay ! decodebin ! videoconvert ! autovideosink
>
> I also tried adding h264parse element, but seems have no influence.
> The server starts and while connecting to it with client, it lights
> up
> camera LED diode, but the client finishes yielding following error
> message
> simultaneously switching off the camera LED diode:
>
> Pipeline is live and does not need PREROLL ...
> Progress: (open) Opening Stream
> Progress: (connect) Connecting to rtsp://127.0.0.1:8554/test
> Progress: (open) Retrieving server options
> Progress: (open) Retrieving media info
> ERROR: from element /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0: Could
> not
> read from resource.
> Additional debug info:
> gstrtspsrc.c(5637): gst_rtspsrc_send ():
> /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0:
> Got error response: 503 (Service Unavailable).
> ERROR: pipeline doesn't want to preroll.
> Setting pipeline to PAUSED ...
> Setting pipeline to READY ...
> Setting pipeline to NULL ...
> Freeing pipeline ...
>
> Exactly the same pipelines work on Ubuntu 14.04. Gst-rtsp-Server
> version
> 1.4, I also tried version 1.2, with no luck.
> Actually this guy here is using another approach bypassing v4l2src
> element,
> but I desprately need v4l2src.
> https://www.stev.org/post/raspberrypisimplertspserver
>
> Thank you very much for your help
>
> Best regards,
> Ivo
>
>
>
> --
> Sent from: http://gstreamer-devel.966125.n4.nabble.com/
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

signature.asc (201 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Raspberry - gst-rtsp-server

horai
Actually, I am using OMX codecs, not CPU intensive ones.



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Raspberry - gst-rtsp-server

horai
Just to note:

Actually, what I am trying to do is to implement this pattern of a
server/client pipelines into gst-rtsp-server. Both pipelines are running on
the same Raspberry Pi Zero just for testing purposes. The server is done
very simply since I am using the enclosed examples written by the gods of
gstreamer. Maybe the problem is that I am not following the right way of
implementing the pipelines but on Ubuntu 14.04 and different hardware it
works properly! BUT if I change omx encoding codec omxh264enc to x264enc,
the entire server and client start to cooperate and I see window with video
opened! I really really really don't understand what is going on here, why
changing encoding codec at that point helps. it's just a different (this
case not hardware encoding way) way of encoding, right?
If anyone could help me, I would be very grateful since I cannot use
x264enc, it's just way too much slow, i really need omxh264enc and I am
going slighly mad


Server:
gst-launch-1.0 v4l2src device=/dev/video0 !
video/x-raw,width=1280,height=720,framerate=30/1 ! videoconvert !
omxh264enc ! h264parse ! rtph264pay ! udpsink host=127.0.0.1 port=8554


Gst-rtsp-server side:
./test-launch  "( v4l2src device=/dev/video0 !
video/x-raw,width=1280,height=720,framerate=30/1 ! videoconvert ! x264enc !
h264parse ! rtph264pay name=pay0 pt=96 )"

Client:
gst-launch-1.0 -v udpsrc port=8554 caps="application/x-rtp,
media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264" !
rtph264depay ! h264parse ! oxmh264dec ! videoconvert ! autovideosink

Gst-rts-client side:
gst-launch-1.0 rtspsrc location="rtsp://localhost:8554/test" latency=0 !
rtph264depay ! h264parse ! omxh264dec ! videoconvert ! autovideosink




--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

RE: Raspberry - gst-rtsp-server

North48
Hi,

I'm anything but an expert on GStreamer, but I've managed to make something work similar to what you are doing and might be able to help.  

Is the problem that it works fine with x264enc on a Pi, but fails when you try to use omxh264enc?  If that is the case, the issue might have to do more with how you have installed the libraries responsible for implementing the GPU on the Pi.

A simple test to isolate the problem.  On a Raspberry Pi3, running Stretch and Gstreamer 1.12.3 the first line with x264enc uses about 24% of the CPU (an entire core), while with omxh264enc it uses about 4% of the cpu.  Do you get similar results?

gst-launch-1.0 videotestsrc is-live=true ! x264enc ! mpegtsmux ! hlssink
gst-launch-1.0 videotestsrc is-live=true ! omxh264enc ! mpegtsmux ! hlssink

Cheers,

Dayle

-----Original Message-----
From: gstreamer-devel [mailto:[hidden email]] On Behalf Of horai
Sent: Saturday, December 9, 2017 3:41 PM
To: [hidden email]
Subject: Re: Raspberry - gst-rtsp-server

Just to note:

Actually, what I am trying to do is to implement this pattern of a server/client pipelines into gst-rtsp-server. Both pipelines are running on the same Raspberry Pi Zero just for testing purposes. The server is done very simply since I am using the enclosed examples written by the gods of gstreamer. Maybe the problem is that I am not following the right way of implementing the pipelines but on Ubuntu 14.04 and different hardware it works properly! BUT if I change omx encoding codec omxh264enc to x264enc, the entire server and client start to cooperate and I see window with video opened! I really really really don't understand what is going on here, why changing encoding codec at that point helps. it's just a different (this case not hardware encoding way) way of encoding, right?
If anyone could help me, I would be very grateful since I cannot use x264enc, it's just way too much slow, i really need omxh264enc and I am going slighly mad


Server:
gst-launch-1.0 v4l2src device=/dev/video0 !
video/x-raw,width=1280,height=720,framerate=30/1 ! videoconvert !
omxh264enc ! h264parse ! rtph264pay ! udpsink host=127.0.0.1 port=8554


Gst-rtsp-server side:
./test-launch  "( v4l2src device=/dev/video0 !
video/x-raw,width=1280,height=720,framerate=30/1 ! videoconvert ! x264enc !
h264parse ! rtph264pay name=pay0 pt=96 )"

Client:
gst-launch-1.0 -v udpsrc port=8554 caps="application/x-rtp,
media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264" !
rtph264depay ! h264parse ! oxmh264dec ! videoconvert ! autovideosink

Gst-rts-client side:
gst-launch-1.0 rtspsrc location="rtsp://localhost:8554/test" latency=0 !
rtph264depay ! h264parse ! omxh264dec ! videoconvert ! autovideosink




--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

RE: Raspberry - gst-rtsp-server

horai
Dear sir,

Thank you for your kind reply.
Actually, I am able to run pipelines with omxh264enc,  utilizing hardware
CPU core I did not examine much deeper, but I assumed using raspberry suited
omxh264enc codec:
in Raspbian:
gstreamer1.0-omx-rpi install
gstreamer1.0-omx-rpi-config install

I enable GPU hardware accelerated H264 encoding.
I can also run gst-launch-1.0 pipelines which are using omxh264enc without
any problems, but I encountered a problem while using almost the same
pipepine (I described working gst-launch-1.0 pipelines in previous posts)
within one example (test-launch) packed with  gst-rtsp-server-1.0 library
which is based on top of Gstreamer libraries, it is called gst-launch and is
able to accept general gstreamer pipelines, it works perfectly with x264enc,
but when using omxh264enc within the same pipeline for test-launch example,
the server client yields an error (but server looks like nothing happened,
only light of camera starts and then stops therefore I guess it starts for
some time, but stopps almost immediately):

Setting pipeline to PAUSED ...
libva info: VA-API version 0.35.0
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_0_35
libva info: va_openDriver() returns 0
Pipeline is live and does not need PREROLL ...
Progress: (open) Opening Stream
Progress: (connect) Connecting to rtsp://127.0.0.1:8554/test
Progress: (open) Retrieving server options
Progress: (open) Retrieving media info
ERROR: from element /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0: Could not
read from resource.
Additional debug info:
gstrtspsrc.c(4994): gst_rtspsrc_try_send ():
/GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0:
Could not receive message. (Timeout while waiting for server response)
ERROR: pipeline doesn't want to preroll.
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...


I narrowed down the problem that I swap omxh264enc to x264enc it works
therefore basically, I guess it is the same problem you have that it crashes
the pipeline, but I have to confirm this assumption once I debug the
gst-rtsp-server library and track down this line:
element = gst_parse_launch (priv->launch, &error); I hope this is the key
line in pipeline construction,  but probably considering that the light of
camera starts and stops therefore I guess the pipeline was started.
BUT anyway it does not make any sense for me why just changing codec could
cause such a dramatic change, but currently, it's just a blackbox to me.





--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

RE: Raspberry - gst-rtsp-server

horai
Sorry made 2 mistakes:

1)"CPU hardware core" -> "GPU hardware core"
2) "it is called gst-launch" -> "it is called test-launch"





--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

RE: Raspberry - gst-rtsp-server

North48
Hi horai

I'm relatively new to GStreamer too, if anyone more experienced wants to chime in, please do.

If you are convinced that omxh264enc is installed properly and working, then try building the server pipeline as a dynamic one rather than static.  My understanding is that for the elements to connect correctly the video format needs to be known and that isn't made available until after it starts receiving the video.

This is a great starting point.

https://gstreamer.freedesktop.org/documentation/tutorials/basic/dynamic-pipelines.html


Cheers,
Dayle

-----Original Message-----
From: gstreamer-devel [mailto:[hidden email]] On Behalf Of horai
Sent: Monday, December 11, 2017 3:17 PM
To: [hidden email]
Subject: RE: Raspberry - gst-rtsp-server

Sorry made 2 mistakes:

1)"CPU hardware core" -> "GPU hardware core"
2) "it is called gst-launch" -> "it is called test-launch"





--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

RE: Raspberry - gst-rtsp-server

horai
Thank you very much for your info.
You might be right, but according to example given here:
https://www.stev.org/post/raspberrypisimplertspserver
Moreover, the camera light really starts and then stops therefore I guess
the pipeline is started, but for some reason also stopped therefore the
client is waiting for data until timeout is reached.

I guess the static pipelines are also possible.





--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

RE: Raspberry - gst-rtsp-server

North48
My understanding is you can use a static pipeline if you know the video format detail ahead of time and include that information in the caps filter.  This way each element knows what source pad to use.  In that post, they are using the rpicamera, which he was able to set some properties such as bitrate and keyframe-interval because he had some insight on the source he was using.  In your case, it looks like you are using a webcam, which will be different.  Dynamic pipelines enable GStreamer to determine the nature of the video first and then it sets its own caps filter.

This might help understand it better.
https://gstreamer.freedesktop.org/documentation/application-development/basics/pads.html#pads




-----Original Message-----
From: gstreamer-devel [mailto:[hidden email]] On Behalf Of horai
Sent: Tuesday, December 12, 2017 2:58 PM
To: [hidden email]
Subject: RE: Raspberry - gst-rtsp-server

Thank you very much for your info.
You might be right, but according to example given here:
https://www.stev.org/post/raspberrypisimplertspserver
Moreover, the camera light really starts and then stops therefore I guess the pipeline is started, but for some reason also stopped therefore the client is waiting for data until timeout is reached.

I guess the static pipelines are also possible.





--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

RE: Raspberry - gst-rtsp-server

horai
Actually, I guess I am using the same camera. Raspberry foundation offers two
types 5MPx and 8Mpx.
My camera is definitely not a webcam, it works with rpicamsrc also. (if we
don't count Raspicam as a webcam)
I am using 5MPx accessible via v4l2src driver (Gstreamer-good plugin).
If I understand you properly, you might be right, but I know that I am
obtaining video from camera with requested video format:
video/x-raw,width=1280,height=720,framerate=30/1
What more should I request or if there would be a format mismatch on pads, I
guess the pipeline would not start at all or would print out some debug
ERROR while debugging set to appropriate level.






--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

RE: Raspberry - gst-rtsp-server

horai
In reply to this post by North48
I also found one problem while compiling gst-rtsp-server library from sources
as on Raspbian 8 there is no package with GST-RTSP-SERVER version 1.0.
This library requests gstreamer-plugins-good and yields this output while
configuring pre-build:
checking for GST_PLUGINS_GOOD... no
configure: No package 'gstreamer-plugins-good-1.0' found
configure: no gstreamer-plugins-good-1.0 >= 1.2.3 (GStreamer Good Plugins)
found
Package gstreamer-plugins-good-1.0 was not found in the pkg-config search
path.
Perhaps you should add the directory containing
`gstreamer-plugins-good-1.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gstreamer-plugins-good-1.0' found
configure: Using GStreamer Good Plugins in
checking for GST_CHECK... yes

I assumed this might be some sort of a problem as this bunch of plugins
covers also shared object library:
/usr/lib/arm-linux-gnueabihf/gstreamer-1.0/libgstvideo4linux2.so
Which I assume to be the library related to v4l2src driver.
Unfortunately, according to this post:
http://gstreamer-devel.966125.n4.nabble.com/there-is-no-gstreamer-plugins-good-1-0-pc-td4675518.html
It is not a fatal problem problem (I also think that camera light on meas
that hardware was started). The same output is with
gstreamer-plugins-good-1.0 from repository.
But this would blame the v4l2src which seems to be working fine with x264enc
codec, BUT seems like this works on Raspbian version 9. On version 8 I am
not able to run the server no matter if I use x264enc or omxh264enc.I also
tried compiling latest gstreamer-plugins-good-1.0 and omx plugin from
sources, but it's far more complicated as it also requests aproppriate
version of other gstreamer parts.
in order to symplify matter I'll test it later on Rasbian version 9 which
already has GST-RTSP-SERVER-1.0.0 present in repository, hopefully, it'll
reveal a bit more.

Thank you very much for your kind help

Ivo



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel