TX1 issues decoding and displaying a 4k30 RTSP H265 stream via Gstreamer

I am trying to decode a 50Mbit RTSP stream with as low latency as possible, however I am getting huge decoding errors and what seems to be half of the actual frame rate, though this is difficult to discern due to the deco.

I am using the following decoding command:

gst-launch-1.0 rtspsrc buffer-mode=3 retry=200 timeout=0 latency=500 ntp-sync=false drop-on-latency=false max-size-buffers=20000 max-size-bytes=61440000 max-size-time=10000000000 probation=200 do-retransmission=true max-rtcp-rtp-time-diff=-1 name=rtsp_Home udp-buffer-size=61440000 location=rtsp://192.168.3.141/stream.mp4 ! rtpjitterbuffer ! rtph265depay ! h265parse ! omxh265dec skip-frames=0 output-buffers=16 ! queue ! nvoverlaysink -e

I assume that being directly connected via ethernet and streaming at 50Mbit should not be an issue. And that the TX1 should be able to decode 4k30. Though I am still getting massive and frequent decoding errors. I have verified that the stream works as expected on two separate computes, though I am not using Gstreamer on either of those.

Assistance in what is causing my issues would be greatly appreciated.

Hi tristan.slaney,
Have you tried local playback of stream.mp4 ?

I created a video file using the RTSP stream and verified the playback works on other systems.
It is formated as 4k30fps, HEVC,YUV420 so within the bounds of what the TX1 should be capable of.
However the playback is worse than when I am streaming the video. Typically only 1/20 of each frame is decoded.

gst-launch-1.0 filesrc location=MOV_265_60M.ts do-timestamp=true ! h265parse ! omxh265dec skip-frames=0 output-buffers=16 ! queue ! nvoverlaysink -e

Okay I have solved my local playback issue thanks to this thread

So my command for local playback is:

gst-launch-1.0 filesrc location=MOV_265_60M.ts ! tsdemux ! queue ! h265parse ! omxh265dec ! nvvidconv ! nvoverlaysink -e

And that causes the video to playback at 30fps with no decoding errors.

I’ll see if I can apply that to the rtsp stream.

I still haven’t solved the streaming issue.

Local playback plays at 4k30fps.

The best I have obtained streaming is 4k28fps, which is useless since there are decoding errors every second.

Below is the command which gives the best result

gst-launch-1.0 rtspsrc location=rtsp://192.168.3.141/z3-1.mp4 latency=300 ! rtph265depay ! queue ! h265parse ! omxh265dec ! nvvidconv interpolation-method=0 tnr=0 output-buffers=30 ! nvoverlaysink sync=true async=false -e

Clearly I am still missing something, I would appreciate assistance in figuring this out.

Can you try

gst-launch-1.0 rtspsrc location=rtsp://192.168.3.141/z3-1.mp4 latency=300 ! rtph265depay ! queue ! h265parse ! omxh265dec ! nvoverlaysink sync=false -e

I am not sure how [latency=300] takes effect. You can try with it and without it.

Hi DaneLLL,

Removing nvvidconv stage and the async=false argument as you suggested does help.

Gstreamer can now keep the 4k29.97fps video almost consistently at the specified framerate. However every 10-30 seconds the frame rate droops slightly (down to as low as 28.5fps, typically 29.7) and the output is a very obvious decoding errors.

I have tried experimenting with the latency (how much video, in ms, is being stored before passing it on to the next stage of the pipeline) and increasing it to the default 2000ms does not cause any appreciable difference over 300ms, decreasing below 300ms does make the encoding errors more frequent.

I have already called

sudo ./jetson_clocks.sh

So the system trying to scale the GPU and CPU down shouldn’t be causing the issues.

Here is the output of $top

nvidia    20   0 1497804  61064  35484 S  26.9  1.5   5:31.24 gst-launch-1.0

And the output of $sudo ./tegrastats

RAM 602/3983MB (lfb 518x4MB) cpu [17%,2%,7%,0%]@1734 EMC 5%@1600 APE 25 NVDEC 716 GR3D 0%@998

If that will help shed any light on anything.

Hello Sir,

what is your video source? Are you do you have gstreamer pipeline for generating H265 RTSP stream?
I am able to generate H264 RTSP stream however H265 streams I cannot play back.

Please refer to below posts:
[url]https://devtalk.nvidia.com/default/topic/1018689/jetson-tx2/vlc-playing-gstreamer-flow/post/5187270/#5187270[/url]
[url]https://devtalk.nvidia.com/default/topic/1014789/jetson-tx1/-the-cpu-usage-cannot-down-use-cuda-decode-/post/5188538/#5188538[/url]
[url]https://devtalk.nvidia.com/default/topic/1043770/jetson-tx2/problems-minimizing-latency-and-maximizing-quality-for-rtsp-and-mpeg-ts-/post/5295828/#5295828[/url]