<div dir="ltr">Hello,<div><br></div><div>For me, it sounds like, it does not have enough hardware resources. Can you run 'top' upon 3x720p streams and with 2x1080p and compare results. One more place, to look at is network bandwidth. Stated 100Mbps, not always means that there are real 100Mbps. </div><div><br></div><div>Best regards,</div><div>Anton.    </div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jun 26, 2020 at 2:35 PM kaladin <<a href="mailto:pausanchez1998@gmail.com">pausanchez1998@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hey!<br>
<br>
I'm developing a program based on Gstreamer and webrtc and I've finally got<br>
something that works, my issue now is improving it's performance.<br>
<br>
The program is divided in two parts, the first one gets the stream from a<br>
camera through rtsp-h264, this stream is processed through opencv (we<br>
implemented this manually copying the buffer to avoid appsrc/apsink<br>
bottlenecks when working with opencv) and then streams this video through<br>
udp. <br>
<br>
The second part of the program is a websocket server that using webrtcbin<br>
grabs that udp stream and sends it to several clients. This was implemented<br>
using centicular's webrtc examples and libboost/beast for the websocket<br>
protocol. <br>
<br>
Right now, the first element can run a 1080p video at 30 stable fps<br>
perfectly fine, but when connecting the second element and trying to stream<br>
to clients it starts lagging and losing a lot of fps. The best stable<br>
performance we've archieved is a 720p video which remains stable at +20 fps<br>
for up to 3 clients.<br>
<br>
We'd like to archieve those 3 stable browser clients at least in 1080p but<br>
we've run out of ideas to improve the code. If any of you have an advice for<br>
us that would be great! (both in stuff to improve and tools that might help<br>
us find the bottlenecks and fix them)<br>
<br>
All of this was done in an Nvidia Jetson TX2 with Jetpack 4.4, Opencv 4.1,<br>
CUDA 10.2 and Gstreamer 1.16.2<br>
<br>
I can't share the whole code but here's the main parts of it:<br>
<br>
videoProcessing.cpp<br>
<<a href="http://gstreamer-devel.966125.n4.nabble.com/file/t379483/videoProcessing.cpp" rel="noreferrer" target="_blank">http://gstreamer-devel.966125.n4.nabble.com/file/t379483/videoProcessing.cpp</a>>  <br>
This is part of the code that captures the rtsp stream, processes it (there<br>
isn't much processing in this segment but it would be there) and streams it<br>
through udp.<br>
<br>
webrtcServer.cpp<br>
<<a href="http://gstreamer-devel.966125.n4.nabble.com/file/t379483/webrtcServer.cpp" rel="noreferrer" target="_blank">http://gstreamer-devel.966125.n4.nabble.com/file/t379483/webrtcServer.cpp</a>>  <br>
This is the full code for the websocket protocol implementation and the<br>
webrtc stuff for sending to clients the udp stream.<br>
<br>
Both of them are in the code above but the pipelines used are the following:  <br>
<br>
/"rtspsrc location=rtsp://<a href="http://192.168.0.153:8554/video" rel="noreferrer" target="_blank">192.168.0.153:8554/video</a> ! queue ! rtph264depay !<br>
video/x-h264, stream-format=byte-stream ! h264parse ! nvv4l2decoder !<br>
nvvidconv name=myconv !  video/x-raw(memory:NVMM), format=RGBA ! nvvidconv !<br>
video/x-raw(memory:NVMM), format=NV12 !  nvv4l2vp8enc ! video/x-vp8 !<br>
rtpvp8pay ! udpsink host=224.1.1.1 port=5000 sync=false <br>
auto-multicast=true";/<br>
/<br>
"udpsrc multicast-group=224.1.1.1 auto-multicast=true port=5000 ! queue !<br>
application/x-rtp,media=video,clock-rate=90000,encoding-name=VP8,payload=96,<br>
framerate=20/1 ! webrtcbin name=sendrecv";/<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
--<br>
Sent from: <a href="http://gstreamer-devel.966125.n4.nabble.com/" rel="noreferrer" target="_blank">http://gstreamer-devel.966125.n4.nabble.com/</a><br>
_______________________________________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.freedesktop.org" target="_blank">gstreamer-devel@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br>
</blockquote></div>