Sending UDP stream from RPi 4 to PC (over ethernet)

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

Sending UDP stream from RPi 4 to PC (over ethernet)

etne
Hello !

For our project, we need to send a GStream stream over udp from a RPi4
connected to a PC via ethernet. The RPi4 address is 10.42.0.18 and the PC
address is 10.42.0.1.

We have successfully tried with TCP using the following sender pipeline :
appsrc fromat=(string)\"BGR\" ! videoconvert ! x264enc tune=zerolatency
speed-preset=ultrafast !  mpegtsmux !  tcpserversink host=10.42.0.18
port=6969

And the following receiver pipeline:
gst-launch-1.0 -v tcpclientsrc port=6969 host=10.42.0.18  ! tsdemux !
h264parse ! avdec_h264 ! videoconvert ! xvimagesink

On the sender pipeline, we are using appsrc because we are writing our
frames with OpenCV VideoWriter. The problem is the latency, thus why we need
to use UDP.

We tried with the following sender pipeline:
appsrc fromat=(string)\"BGR\" ! videoconvert ! x264enc tune=zerolatency
speed-preset=ultrafast !  rtph264pay config-interval=0 pt=96 ! udpsink
host=10.42.0.1 port=6969

And the following receiving pipeline:
gst-launch-1.0 -v udpsrc address=10.42.0.1 port=6969 caps =
"application/x-rtp, media=(string)video, clock-rate=(int)90000,
encoding-name=(string)H264, format=BGR, payload=(int)96" ! rtph264depay !
avdec_h264 lowres=1 ! videoconvert ! autovideosink

Using tcpdump -n udp port 6969 on the PC, we can see that we are receiving
our packets but no video is displaying.

Using these two pipelines on a localhost network (no RPi), it works like a
charm.

How can we stream our frames from the RPi to the PC using UDP?

Thanks.



--
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: Sending UDP stream from RPi 4 to PC (over ethernet)

Marc Leeman
This should do it:

appsrc fromat=(string)\"BGR\" ! videoconvert ! x264enc tune=zerolatency
speed-preset=ultrafast !  h264parse ! rtph264pay config-interval=1 !
rtpsink uri=rtp://239.1.2.3:1234

gst-launch-1.0 -v rtpsrc uri=rtp://239.1.2.3:1234?encoding-name=H264 !
rtph264depay ! h264parse !
avdec_h264 lowres=1 ! videoconvert ! autovideosink

On Fri, 18 Dec 2020 at 12:30, etne <[hidden email]> wrote:

>
> Hello !
>
> For our project, we need to send a GStream stream over udp from a RPi4
> connected to a PC via ethernet. The RPi4 address is 10.42.0.18 and the PC
> address is 10.42.0.1.
>
> We have successfully tried with TCP using the following sender pipeline :
> appsrc fromat=(string)\"BGR\" ! videoconvert ! x264enc tune=zerolatency
> speed-preset=ultrafast !  mpegtsmux !  tcpserversink host=10.42.0.18
> port=6969
>
> And the following receiver pipeline:
> gst-launch-1.0 -v tcpclientsrc port=6969 host=10.42.0.18  ! tsdemux !
> h264parse ! avdec_h264 ! videoconvert ! xvimagesink
>
> On the sender pipeline, we are using appsrc because we are writing our
> frames with OpenCV VideoWriter. The problem is the latency, thus why we need
> to use UDP.
>
> We tried with the following sender pipeline:
> appsrc fromat=(string)\"BGR\" ! videoconvert ! x264enc tune=zerolatency
> speed-preset=ultrafast !  rtph264pay config-interval=0 pt=96 ! udpsink
> host=10.42.0.1 port=6969
>
> And the following receiving pipeline:
> gst-launch-1.0 -v udpsrc address=10.42.0.1 port=6969 caps =
> "application/x-rtp, media=(string)video, clock-rate=(int)90000,
> encoding-name=(string)H264, format=BGR, payload=(int)96" ! rtph264depay !
> avdec_h264 lowres=1 ! videoconvert ! autovideosink
>
> Using tcpdump -n udp port 6969 on the PC, we can see that we are receiving
> our packets but no video is displaying.
>
> Using these two pipelines on a localhost network (no RPi), it works like a
> charm.
>
> How can we stream our frames from the RPi to the PC using UDP?
>
> Thanks.
>
>
>
> --
> 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: Sending UDP stream from RPi 4 to PC (over ethernet)

etne
Thanks for your answer.

Using this pipeline:

appsrc format=(string)\"BGR\" ! videoconvert ! x264enc tune=zerolatency
speed-preset=ultrafast !  h264parse ! rtph264pay config-interval=1 !
rtpsink uri=rtp://239.1.2.3:1234

I get the following error on the RPi:
x264 [error]: baseline profile doesn't support 4:4:4
Is it a format image error?





--
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: Sending UDP stream from RPi 4 to PC (over ethernet)

Peter Maersk-Moller-2
A video codec usually encoded using a YUV format as input. I'm guessing from your results that your pipeline when no video format has been been set for input to x264enc and no video profile has been set for x264enc output and original raw video is BGR/RGB, the pipeline selects baseline as H.264 profile and Y444 as video format. These two are not combinable in the H.264 world

Try the following

    videoconvert ! video/x-raw,format=I420 ! x264enc ...

Alternatively

    x264enc tune=zerolatency speed-preset=ultrafast !  video/h-264,profile=high-4:4:4 ! h264parse ...

Note that the above can have a large impact on CPU-load, bandwidth and quality

Best regards
Peter Maersk-Moller

 

On Sat, Dec 19, 2020 at 10:09 AM etne <[hidden email]> wrote:
Thanks for your answer.

Using this pipeline:

appsrc format=(string)\"BGR\" ! videoconvert ! x264enc tune=zerolatency
speed-preset=ultrafast !  h264parse ! rtph264pay config-interval=1 !
rtpsink uri=rtp://239.1.2.3:1234

I get the following error on the RPi:
x264 [error]: baseline profile doesn't support 4:4:4
Is it a format image error?





--
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: Sending UDP stream from RPi 4 to PC (over ethernet)

Michael Gruner
In reply to this post by etne
Maybe you can try sending key frames more periodically. Set the key-int-max property of the x264enc to something like 30 to see if it makes a difference.

Michael

> On 19 Dec 2020, at 03:09, etne <[hidden email]> wrote:
>
> Thanks for your answer.
>
> Using this pipeline:
>
> appsrc format=(string)\"BGR\" ! videoconvert ! x264enc tune=zerolatency
> speed-preset=ultrafast !  h264parse ! rtph264pay config-interval=1 !
> rtpsink uri=rtp://239.1.2.3:1234
>
> I get the following error on the RPi:
> x264 [error]: baseline profile doesn't support 4:4:4
> Is it a format image error?
>
>
>
>
>
> --
> 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