gstreamerrtpgst-launch-1.0

gstreamer test with H264, RTP, UDP. What's wrong?


I'm relatively new to gstreamer, looking for some debugging ideas. I'm looking at video streaming with H264, RTP, UDP and set up some test send and receive scripts as a proof of concept. Instead of actual network I used localhost and kept all code on a single PC.

Sender

gst-launch-1.0 videotestsrc ! video/x-raw,width=640,height=480 !\
timeoverlay !\
x264enc tune=zerolatency byte-stream=true bitrate=3000 !\
h264parse  !\
rtph264pay !\
udpsink host=localhost port=5200

Receiver

gst-launch-1.0 udpsrc port=5200 !\
application/x-rtp,encodingname=H264,payload=96 !\
rtph264depay !\
h264parse !\
avdec_h264 !\
autovideosink

This nearly works. The test video is shown, but after a few seconds most of the image (the colour blocks) disappears and only the noise box is shown bottom right. Then a few seconds later it flickers back, and so on.

I can see it's likely to be something with queuing or buffering or sync or bandwidth? It's not lost content on actual network because I'm going through localhost for the UDP traffic. Kinda thrashing about here, adding and removing various parameters and not making much difference. And yes, some of this is copypasta and I may not know quite what I'm doing.

If there's nothing obvious, how can I go about debugging this?

I don't think it's raw CPU power, as top doesn't indicate I'm close to 100% CPU.


Solution

  • You may try adding rtpjitterbuffer in receiver:

    gst-launch-1.0 udpsrc port=5200 ! application/x-rtp,encoding-name=H264,payload=96 ! rtpjitterbuffer latency=0 ! rtph264depay ! h264parse ! avdec_h264 ! autovideosink