How to fix the Green artefacts when use 265 through UDP.

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

How to fix the Green artefacts when use 265 through UDP.

Erickson.LU
This post was updated on .
Hi All and Nicolas:

I use pipeline in my program to stream out my camera.

Sender:
#define DesktopUdpSink "appsrc name=mysource !"\
" video/x-raw,width=%d,height=%d ! videoconvert ! "\
" video/x-raw, format=(string)I420, width=(int)%d, height=(int)%d !"\
" x265enc ! rtph265pay ssrc=1 pt=96 config-interval=5
sprop-parameter-sets=\"12345\ !"\
" udpsink host=192.168.43.130 port=3220 sync=false async=false"

Receiver:
gst-launch-1.0 udpsrc port=3220 ! "application/x-rtp, media=(string)video,
clock-rate=(int)90000, encoding-name=(string)H265, payload=(int)96,
ssrc=(int)1" ! rtph265depay ! avdec_h265 ! videoconvert ! autovideosink
sync=false

The camera resolution is 640x480. When I use 127.0.0.1 stream it out and in
at the same pc. The receiver is ok.

But when I use another pc to do the receiver pipeline, the receiver always
gets a *green artefacts* and a big delay, I think it is caused by
*http://gstreamer-devel.966125.n4.nabble.com/GStreamer-CRITICAL-gst-segment-to-running-time-assertion-segment-gt-format-format-failed-tt4673363.html
*as @yannick inizan said.  The sender and the receiver connected by WIFI
2.4G.

Indeed the sender always log *GStreamer-CRITICAL **:
gst_segment_to_running_time: assertion 'segment->format == format' failed*.


Gst_handle::Gst_handle(char *pipeline_char) {

    gst_init(NULL, NULL);
    pipeline = (GstPipeline *) gst_parse_launch(pipeline_char, NULL);
    bus = gst_pipeline_get_bus(pipeline);
    bus_watch_id = gst_bus_add_watch(bus, (GstBusFunc)bus_message,this);
    gst_object_unref(bus);
    src = gst_bin_get_by_name (GST_BIN(pipeline), "mysource");
    g_object_set(G_OBJECT(src), "caps",
                 gst_caps_new_simple("video/x-raw",
                                     "format", G_TYPE_STRING, "BGR",
                                     "width", G_TYPE_INT, Stream_BGR_width,
                                     "height", G_TYPE_INT, Stream_BGR_height,
                                     "framerate", GST_TYPE_FRACTION, 30, 1,
                                     NULL), NULL);

    g_object_set(src, "is-live", FALSE, NULL);
    g_object_set(src, "do-timestamp", FALSE, NULL);

    loop = g_main_loop_new(NULL, FALSE);
}


When a new mat generated, it will be pushed by a new gst_buffer. And the push method like:

int Gst_handle::push_out_frame(cv::Mat mat) {

{
    buffer = gst_buffer_new();
    gst_buffer_remove_all_memory(buffer);
    wrapped_mem = gst_memory_new_wrapped((GstMemoryFlags) 0, (gpointer) mat.data,
                                         Stream_BGR_width*Stream_BGR_height*3, 0, Stream_BGR_width*Stream_BGR_height*3, NULL,NULL);
    gst_buffer_append_memory(buffer, wrapped_mem);
    g_signal_emit_by_name(this->src, "push-buffer", buffer, &ret);
    gst_buffer_unref(buffer);
}

So, I want to fix the green screen artefacts, how can I do that.



Thanks for every help from everywhere.





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

Re: How to fix the Green artefacts when use 265 through UDP.

Erickson.LU
Erickson.LU wrote

> Hi All and Nicolas:
>
> I use pipeline in my program to stream out my camera.
>
> Sender:
> #define DesktopUdpSink "appsrc name=mysource !"\
> " video/x-raw,width=%d,height=%d ! videoconvert ! "\
> " video/x-raw, format=(string)I420, width=(int)%d, height=(int)%d !"\
> " x265enc ! rtph265pay ssrc=1 pt=96 config-interval=5
> sprop-parameter-sets=\"12345\ !"\
> " udpsink host=192.168.43.130 port=3220 sync=false async=false"
>
> Receiver:
> gst-launch-1.0 udpsrc port=3220 ! "application/x-rtp, media=(string)video,
> clock-rate=(int)90000, encoding-name=(string)H265, payload=(int)96,
> ssrc=(int)1" ! rtph265depay ! avdec_h265 ! videoconvert ! autovideosink
> sync=false
>
> The camera resolution is 640x480. When I use 127.0.0.1 stream it out and
> in
> at the same pc. The receiver is ok.
>
> But when I use another pc to do the receiver pipeline, the receiver always
> gets a *green artefacts* and a big delay, I think it is caused by
> *http://gstreamer-devel.966125.n4.nabble.com/GStreamer-CRITICAL-gst-segment-to-running-time-assertion-segment-gt-format-format-failed-tt4673363.html
> *as @yannick inizan said.  The sender and the receiver connected by WIFI
> 2.4G.
>
> Indeed the sender always log *GStreamer-CRITICAL **:
> gst_segment_to_running_time: assertion 'segment->format == format'
> failed*.
>
>
> Gst_handle::Gst_handle(char *pipeline_char) {
>
>     gst_init(NULL, NULL);
>     pipeline = (GstPipeline *) gst_parse_launch(pipeline_char, NULL);
>     bus = gst_pipeline_get_bus(pipeline);
>     bus_watch_id = gst_bus_add_watch(bus, (GstBusFunc)bus_message,this);
>     gst_object_unref(bus);
>     src = gst_bin_get_by_name (GST_BIN(pipeline), "mysource");
>     g_object_set(G_OBJECT(src), "caps",
>                  gst_caps_new_simple("video/x-raw",
>                                      "format", G_TYPE_STRING, "BGR",
>                                      "width", G_TYPE_INT,
> Stream_BGR_width,
>                                      "height", G_TYPE_INT,
> Stream_BGR_height,
>                                      "framerate", GST_TYPE_FRACTION, 30,
> 1,
>                                      NULL), NULL);
>
>     g_object_set(src, "is-live", FALSE, NULL);
>     g_object_set(src, "do-timestamp", FALSE, NULL);
>
>     loop = g_main_loop_new(NULL, FALSE);
> }
>
>
> When a new mat generated, it will be pushed by a new gst_buffer. And the
> push method like:
>
> int Gst_handle::push_out_frame(cv::Mat mat) {
>
> {
>     buffer = gst_buffer_new();
>     gst_buffer_remove_all_memory(buffer);
>     wrapped_mem = gst_memory_new_wrapped((GstMemoryFlags) 0, (gpointer)
> mat.data,
>                                        
> Stream_BGR_width*Stream_BGR_height*3, 0,
> Stream_BGR_width*Stream_BGR_height*3, NULL,NULL);
>     gst_buffer_append_memory(buffer, wrapped_mem);
>     g_signal_emit_by_name(this->src, "push-buffer", buffer, &ret);
>     gst_buffer_unref(buffer);
> }
>
> So, I want to fix the green screen artefacts, how can I do that.
>
>
>
> Thanks for every help from everywhere.
>
>
>
>
>
> --
> Sent from: http://gstreamer-devel.966125.n4.nabble.com/
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel



I use tcpdump track the package at sender side. I found the UDP length is
not always 1400, did that mean the UDP package is corrupted. The receiver
will get Green artefacts?

15:10:35.159489 IP LY-PC.55990 > LY-PC.3220: UDP, length 1400
15:10:35.159535 IP LY-PC.55990 > LY-PC.3220: UDP, length 1400
15:10:35.159579 IP LY-PC.55990 > LY-PC.3220: UDP, length 1400
15:10:35.159625 IP LY-PC.55990 > LY-PC.3220: UDP, length 1400
15:10:35.159672 IP LY-PC.55990 > LY-PC.3220: UDP, length 1400
15:10:35.159718 IP LY-PC.55990 > LY-PC.3220: UDP, length 1057
15:10:35.230474 IP LY-PC.55990 > LY-PC.3220: UDP, length 1400
15:10:35.230549 IP LY-PC.55990 > LY-PC.3220: UDP, length 1400
15:10:35.230569 IP LY-PC.55990 > LY-PC.3220: UDP, length 1400
15:10:35.230586 IP LY-PC.55990 > LY-PC.3220: UDP, length 673
15:10:35.298551 IP LY-PC.55990 > LY-PC.3220: UDP, length 1400
15:10:35.298661 IP LY-PC.55990 > LY-PC.3220: UDP, length 993
15:10:35.362794 IP LY-PC.55990 > LY-PC.3220: UDP, length 1400
15:10:35.362828 IP LY-PC.55990 > LY-PC.3220: UDP, length 1400
15:10:35.362854 IP LY-PC.55990 > LY-PC.3220: UDP, length 58
15:10:35.433455 IP LY-PC.55990 > LY-PC.3220: UDP, length 1400
15:10:35.433502 IP LY-PC.55990 > LY-PC.3220: UDP, length 1400
15:10:35.433529 IP LY-PC.55990 > LY-PC.3220: UDP, length 139
15:10:35.503354 IP LY-PC.55990 > LY-PC.3220: UDP, length 1400
15:10:35.503422 IP LY-PC.55990 > LY-PC.3220: UDP, length 1400
15:10:35.503455 IP LY-PC.55990 > LY-PC.3220: UDP, length 1400




--
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: How to fix the Green artefacts when use 265 through UDP.

Arjen Veenhuizen
You are using UDP which does not guarantee delivery of packets. This means
that packets will get lost and packets will not always be delivered in the
order that thy were sent. The chance of a packet getting lost when streaming
over localhost (127.0.0.1) are just a lot lower than when streaming between
two devices.

To improve performance, you should start by tuning your encoder: reduce the
gop (i-frame) interval to e.g. a second, tune for zero latency and cap the
bitrate. Also, make sure that h265parse inserts headers at every GOP.

Secondly, use an rtpjitterbuffer to re-order out-of-order received UDP (RTP)
packets.

Thirdly, you could add RTCP to the mix to retransmit packets that got lost.



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