Hello. I have some code that sets up a GStreamer pipeline to stream video over RTSP from a CSI/MIPI camera using nvarguscamerasrc. The code uses nvv4l2h264enc to H.264 encode the video and then it sets up an RTSP stream using GstRTSPMediaFactory and rtph264pay.
We are using a Jetson TX2 on a Spacely carrier board from ConnectTech. The camera is LI-IMX274-MIPI-M12 from Leopard Imaging.
After restarting the rtsp_server process, the video stream looks fine again.
It is worth to mention that I have not been able to reproduce the issue when starting the rtsp server normally from the command line. It only happens sporadically (1 out of 3 or 4 times) when running it via systemd.
Can I please get some support on what may be the root cause of this issue? We are using similar code in an embedded product, but every few times the system is started the video stream is so full of artifacts that it is unusable.
Fiona: The GStreamer pipeline seems to sometimes end up in a bad state where the video is stuttering and full of artifacts even when connecting to the stream locally (or from a computer connected to the same Gigabit Ethernet switch). When the RTSP server is restarted the problem disappears and the video is smooth and without artifacts. So I don’t think this problem occurs due to packet loss. It occurs one out of every few times the RTSP server is started from systemd. I’m wondering if it could be a bug or a race condition in the camera driver or one of the GStreamer plugins.
The problem does not occur due to network issues. It occurs even when I try to view the stream on localhost. The video stream looks fine when the rtsp server is launched normally on the command line. The problem only occurs when the RTSP server is started automatically on startup via systemd. Then the video is stuttering and full of artifacts and it remains like that until the RTSP server process is restarted.
How can we proceed to resolve this issue? As I said, the issue appears even on localhost, so the issue is not caused by bandwidth/network issues. The GStreamer pipeline or camera driver seems to end up in a bad state every few times when it is started by systemd, where the video is completely stuttered and full of artifacts. It starts up in a bad state and remains like that until the process is restarted. After the process is restarted, the video stream is perfectly fine again and we see no issues until the system is rebooted.
To identify who caused the packet loss, you don’t need to run deepsteam app and the rtsp server. Just use some packet loss tool with systemd is enough.(e.g. iperf)
It has nothing to do with deepstream.
Or you can try to set smaller “iframeinterval” value with nvv4l2h264encoder to check whether it can help the case.
I have tried the code on at least 5 different boards. They all exhibit the same behavior.
Below you can see two screen captures. In the first one, I connect to the RTSP server (see code for reproducing the issue on GitHub) right after startup where the video stream is defective and full of artifacts.
Then another screen capture after restarting the server process with sudo systemctl restart rtsp-server and connecting to the RTSP server again. As you can see, the video stream now looks fine.