Gstreamer pipeline stop when idle and back playing when connect

In general we launch a RTSP server through test-launch. It is a simple sample based on

For launching a single pipeline you can run like:

nvarguscamerasrc! nvv4l2h264enc ! h264parse ! rtph264pay name=pay0 pt=96

We have reference steps in Jetson Nano FAQ

Your use-case is complicated. One possible solution is to register a signal to inform you that clients are connected so that you can launch the camera pipeline. Signals are listed in