Not sure for your case, but it may be an H264 profile issue.
You may try this python RTSP server:
import gi
gi.require_version('Gst','1.0')
gi.require_version('GstVideo','1.0')
gi.require_version('GstRtspServer','1.0')
from gi.repository import GObject, Gst, GstVideo, GstRtspServer
Gst.init(None)
mainloop = GObject.MainLoop()
server = GstRtspServer.RTSPServer()
mounts = server.get_mount_points()
factory = GstRtspServer.RTSPMediaFactory()
# Using NVENC - baseline H264 profile
#factory.set_launch('( videotestsrc is-live=1 ! video/x-raw,format=YUY2,width=640,height=480,framerate=30/1 ! nvvidconv ! nvv4l2h264enc insert-sps-pps=1 idrinterval=30 insert-vui=1 ! rtph264pay name=pay0 )')
# Using legacy omxh264enc - baseline H264 profile
#factory.set_launch('( videotestsrc is-live=1 ! video/x-raw,format=YUY2,width=640,height=480,framerate=30/1 ! nvvidconv ! video/x-raw(memory:NVMM),format=I420 ! omxh264enc insert-sps-pps=1 idrinterval=30 insert-vui=1 ! h264parse ! rtph264pay name=pay0 )')
# Using x264enc with I420 or NV12 - baseline H264 profile
#factory.set_launch('( videotestsrc is-live=1 ! video/x-raw,format=YUY2,width=640,height=480,framerate=30/1 ! videoconvert ! video/x-raw,format=I420 ! x264enc key-int-max=30 tune=zerolatency ! video/x-h264,stream-format=byte-stream,profile=main ! h264parse config-interval=1 ! rtph264pay name=pay0 )')
# Using x264enc with Y42B - implies main H264 profile
factory.set_launch('( videotestsrc is-live=1 ! video/x-raw,format=YUY2,width=640,height=480,framerate=30/1 ! videoconvert ! x264enc key-int-max=30 tune=zerolatency ! video/x-h264,stream-format=byte-stream,profile=main ! h264parse config-interval=1 ! rtph264pay name=pay0 )')
mounts.add_factory("/test", factory)
server.attach(None)
print ("stream ready at rtsp://127.0.0.1:8554/test")
mainloop.run()
The first 3 pipelines would encode into H264 baseline profile, so you can decode with:
gst-launch-1.0 -v rtspsrc location=rtsp://127.0.0.1:8554/test latency=0 ! rtph264depay ! tee name=tee ! queue ! fakesink tee. ! queue ! h264parse ! nvv4l2decoder disable-dpb=true ! fakesink dump=1
For the 4th case, it would encode into H264 main profile, so you would decode with:
gst-launch-1.0 -v rtspsrc location=rtsp://127.0.0.1:8554/test latency=0 ! rtph264depay ! video/x-h264,profile=main ! tee name=tee ! queue ! fakesink tee. ! queue ! h264parse ! nvv4l2decoder disable-dpb=true ! fakesink dump=1