UDP Stream starting order of sender and receiver

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

UDP Stream starting order of sender and receiver

Chr0n0s
Hello,

I am trying to stream a camera image via a udp connection with minimal
latency (< 200 ms required for real time operations).

I got a prototype with gst-launch working, but I need to start the receiving
player (either of: VLC, MPV or GStreamer) first. Otherwise the stream opens
and the shown image is completely grayish, one can barley see movements and
even after some time the picture does not get normal. What can I do in order
to start sender and receiver independently?
I am using an IDS Camera with a special GStreamer Source plugin. This is my
starting command:

gst-launch-1.0 idsueyesrc
config-file="C:\\stream_720p_24fps_AutoExp_AES114_RGB24H.ini" !
videoconvert ! queue ! x264enc speed-preset=superfast tune=zerolatency !
h264parse ! mpegtsmux ! rndbuffersize max=1316 min=1316 ! udpsink
host=<hostIP> port=5200

Regards Chr0n0s



--
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: UDP Stream starting order of sender and receiver

Tim Müller
On Mon, 2019-05-20 at 02:48 -0500, Chr0n0s wrote:

Hi,

> gst-launch-1.0 idsueyesrc
> config-file="C:\\stream_720p_24fps_AutoExp_AES114_RGB24H.ini" !
> videoconvert ! queue ! x264enc speed-preset=superfast
> tune=zerolatency !
> h264parse ! mpegtsmux ! rndbuffersize max=1316 min=1316 ! udpsink
> host=<hostIP> port=5200

Try h264parse config-interval=-1 (if you have recent-enough GStreamer,
otherwise config -interval=1).

Cheers
 Tim

--
Tim Müller, Centricular Ltd - http://www.centricular.com

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

Re: UDP Stream starting order of sender and receiver

Marc Leeman
In reply to this post by Chr0n0s
From what you describe, the sps/pps data is inserted in your RTP
stream with long intervals. For streaming, you need to insert it
periodically, see 'config-interval' in the rtph264pay payloader.

This will insert the configuration data just before an I-Frame so that
decoders can pick in on a stream on the network.


On Mon, 20 May 2019 at 09:55, Chr0n0s <[hidden email]> wrote:

>
> Hello,
>
> I am trying to stream a camera image via a udp connection with minimal
> latency (< 200 ms required for real time operations).
>
> I got a prototype with gst-launch working, but I need to start the receiving
> player (either of: VLC, MPV or GStreamer) first. Otherwise the stream opens
> and the shown image is completely grayish, one can barley see movements and
> even after some time the picture does not get normal. What can I do in order
> to start sender and receiver independently?
> I am using an IDS Camera with a special GStreamer Source plugin. This is my
> starting command:
>
> gst-launch-1.0 idsueyesrc
> config-file="C:\\stream_720p_24fps_AutoExp_AES114_RGB24H.ini" !
> videoconvert ! queue ! x264enc speed-preset=superfast tune=zerolatency !
> h264parse ! mpegtsmux ! rndbuffersize max=1316 min=1316 ! udpsink
> host=<hostIP> port=5200
>
> Regards Chr0n0s
>
>
>
> --
> Sent from: http://gstreamer-devel.966125.n4.nabble.com/
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel



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

Re: UDP Stream starting order of sender and receiver

Chr0n0s
Tim Müller wrote:
> Try h264parse config-interval=-1 (if you have recent-enough GStreamer,
> otherwise config -interval=1).

Thanks for the advice but I have tried config-interval=1 before asking here,
but it didn't change anything. Now I have also tried setting it to -1 but
this didn't help either. I have GStreamer Core Library version 1.16.0

Marc Leemann wrote:
> see 'config-interval' in the rtph264pay payloader.

As stated above, I tried this with h264parse. As I unterstand rtph264pay
corretly I changed (and reduced for testing) my sending command to the
following:

gst-launch-1.0 idsueyesrc
config-file="C:\\stream_720p_24fps_AutoExp_AES114_RGB24H.ini" !
videoconvert ! queue ! x264enc tune=zerolatency ! rtph264pay
config-interval=-1 !  udpsink host=127.0.0.1 port=5200

With this sending command, receiving with MPV or VLC does not work anymore
("Failed to recognize file format."). Therfore I used Gstreamer for
receiving as well:

gst-launch-1.0 -v udpsrc port=5200 ! application/x-rtp ! rtph264depay !
avdec_h264 ! videoconvert ! autovideosink sync=false async=false

Starting the sender before the receiver works, but starting the receiver
first leaves me with the same strange gray/green image. In both cases the
verbose output is the same:
https://pastebin.com/raw/6JEuzjsv

Regards,
Chr0n0s
 








--
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: UDP Stream starting order of sender and receiver

Nicolas Dufresne-5
In reply to this post by Chr0n0s


Le lun. 20 mai 2019 03 h 55, Chr0n0s <[hidden email]> a écrit :
Hello,

I am trying to stream a camera image via a udp connection with minimal
latency (< 200 ms required for real time operations).

I got a prototype with gst-launch working, but I need to start the receiving
player (either of: VLC, MPV or GStreamer) first. Otherwise the stream opens
and the shown image is completely grayish, one can barley see movements and
even after some time the picture does not get normal. What can I do in order
to start sender and receiver independently?
I am using an IDS Camera with a special GStreamer Source plugin. This is my
starting command:

gst-launch-1.0 idsueyesrc
config-file="C:\\stream_720p_24fps_AutoExp_AES114_RGB24H.ini" !
videoconvert ! queue ! x264enc speed-preset=superfast tune=zerolatency !

For that use case, you should insert key-frames regularly, see key-int-max property on x264enc, it's in frames.

h264parse ! mpegtsmux ! rndbuffersize max=1316 min=1316 ! udpsink
host=<hostIP> port=5200

Regards Chr0n0s



--
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: UDP Stream starting order of sender and receiver

Vinod Kesti
SPS and PPS alone are not sufficient to stat decoding. SPS, PPS followed by I
is required.
add key-int-max=28 to x264enc property

e.g
gst-launch-1.0 idsueyesrc
config-file="C:\\stream_720p_24fps_AutoExp_AES114_RGB24H.ini" !
videoconvert ! queue ! x264enc speed-preset=superfast tune=zerolatency
key-int-max=28 !



--
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: UDP Stream starting order of sender and receiver

Chr0n0s
> Vinod Kesti wrote
> SPS and PPS alone are not sufficient to stat decoding. SPS, PPS followed
> by I
> is required.
> add key-int-max=28 to x264enc property

That makes totally sense, but it didn't work (reiceiving with MPV or
Gstreamer). The send command was:

gst-launch-1.0 idsueyesrc
config-file="C:\\stream_720p_24fps_AutoExp_AES114_RGB24H.ini" !
videoconvert ! queue ! x264enc tune=zerolatency key-int-max=28 ! h264parse
config-interval=-1 ! mpegtsmux ! udpsink host=127.0.0.1 port=5200

The receiving command:
gst-launch-1.0 -ve udpsrc port=5200 ! tsparse ! tsdemux ! h264parse !
avdec_h264 ! videoconvert ! autovideosink sync=false

No difference between config-interal=-1 or just 1



--
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: UDP Stream starting order of sender and receiver

Kaj-Michael Lang
On Tue, 2019-05-21 at 03:46 -0500, Chr0n0s wrote:
> config-interval=-1 ! mpegtsmux ! udpsink host=127.0.0.1 port=5200

Try this (adjusting for your source):

gst-launch-1.0 v4l2src ! queue ! x264enc tune=zerolatency key-int-
max=28 ! h264parse ! mpegtsmux ! rtpmp2tpay ! udpsink port=5002

Then you can view with vlc using:
vlc rtp://@:5002

Or gst with

gst-launch-1.0 udpsrc port=5002 ! application/x-
rtp,payload=33,media=video,clock-rate=90000 ! rtpmp2tdepay ! queue !
decodebin ! autovideosink


--
Kaj-Michael Lang <[hidden email]>

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

Re: UDP Stream starting order of sender and receiver

Chr0n0s
> Kaj-Michael Lang wrote
> Try this (adjusting for your source):
> gst-launch-1.0 v4l2src ! queue ! x264enc tune=zerolatency key-int-
> max=28 ! h264parse ! mpegtsmux ! rtpmp2tpay ! udpsink port=5002

Thanks for the advice, I adjusted my command as supposed to:
gst-launch-1.0 idsueyesrc
config-file="C:\\stream_720p_24fps_AutoExp_AES114_RGB24H.ini" ! videoconvert
! queue ! x264enc tune=zerolatency key-int-max=28 ! h264parse ! mpegtsmux !
rtpmp2tpay ! udpsink host=127.0.0.1 port=5200

Same effect as before. VLC has to be started first, otherwise grey/pink
image. Gst won't launch with your command at all:

> ERROR: from element /GstPipeline:pipeline0/GstUDPSrc:udpsrc0: Internal
> data stream error.
> Additional debug info:
> ../libs/gst/base/gstbasesrc.c(3072): gst_base_src_loop ():
> /GstPipeline:pipeline0/GstUDPSrc:udpsrc0:
> streaming stopped, reason not-negotiated (-4)




--
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: UDP Stream starting order of sender and receiver

Kaj-Michael Lang
On Tue, 2019-05-21 at 05:22 -0500, Chr0n0s wrote:
> Same effect as before. VLC has to be started first, otherwise
> grey/pink
> image. Gst won't launch with your command at all:
>
> > ERROR: from element /GstPipeline:pipeline0/GstUDPSrc:udpsrc0:
> Internal

That is strange, it starts perfectly on my Mint Linux install,
gstreamer version 1.8.3

--
Kaj-Michael Lang <[hidden email]>

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

Re: UDP Stream starting order of sender and receiver

Chr0n0s
Kaj-Michael Lang wrote
> That is strange, it starts perfectly on my Mint Linux install,
> gstreamer version 1.8.3

Maybe its a windows thing - I will try it on Ubuntu later this month.

In the meantime I was able to find a medium good working workaround.
According to this post on Stackoverflow
https://stackoverflow.com/questions/51326357/gstreamer-v1-0-udp-multicast-streaming-not-properly-decoded-if-client-starts-aft
one needs to disable cabac with the cabac=false option for the x264enc part
of the pipeline.

Indeed, I can now start the receiver after the sender and it works. The
downside is a big increase in the CPU usage (20%->70%) and also a sightly
bigger transferrate.

Can anyone explain why it works with this options and if there is maybe a
way to still cabacs with its benefits in efficiency?

Chr0n0s



--
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: UDP Stream starting order of sender and receiver

Nicolas Dufresne-5
Le dimanche 02 juin 2019 à 07:14 -0500, Chr0n0s a écrit :

> Kaj-Michael Lang wrote
> > That is strange, it starts perfectly on my Mint Linux install,
> > gstreamer version 1.8.3
>
> Maybe its a windows thing - I will try it on Ubuntu later this month.
>
> In the meantime I was able to find a medium good working workaround.
> According to this post on Stackoverflow
> https://stackoverflow.com/questions/51326357/gstreamer-v1-0-udp-multicast-streaming-not-properly-decoded-if-client-starts-aft
> one needs to disable cabac with the cabac=false option for the x264enc part
> of the pipeline.
>
> Indeed, I can now start the receiver after the sender and it works. The
> downside is a big increase in the CPU usage (20%->70%) and also a sightly
> bigger transferrate.
>
> Can anyone explain why it works with this options and if there is maybe a
> way to still cabacs with its benefits in efficiency?

Possibly that the selected H264 profile was not supported by your
receiver. You can add a caps filter afer your encoder to select that
profile and level.

Example for the web (baseline profiles disables cabac iirc):

  ... ! video/x-h264,profile=constrained-baseline ! ....

>
> Chr0n0s
>
>
>
> --
> 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