Source from usbcam and sink to rtsp

Hello, All

I’d like to get streaming from usbcam, and sink it into rtsp.
I read the code of “” under usbcam and “” under deepstream-test1-rtsp-out, and mixed the code together.

The main flow of the processing is as below:

source = Gst.ElementFactory.make(“v4l2src”, “usb-cam-source”)
decoder = Gst.ElementFactory.make(“nvv4l2decoder”, “nvv4l2-decoder”)
vidconvsrc = Gst.ElementFactory.make(“videoconvert”, “convertor_src1”)
nvvidconvsrc = Gst.ElementFactory.make(“nvvideoconvert”, “convertor_src2”)
caps_vidconvsrc = Gst.ElementFactory.make(“capsfilter”, “nvmm_caps”)
decoder = Gst.ElementFactory.make(“nvv4l2decoder”, “nvv4l2-decoder”)
streammux = Gst.ElementFactory.make(“nvstreammux”, “Stream-muxer”)
pgie = Gst.ElementFactory.make(“nvinfer”, “primary-inference”)
nvvidconv = Gst.ElementFactory.make(“nvvideoconvert”, “convertor”)
nvosd = Gst.ElementFactory.make(“nvdsosd”, “onscreendisplay”)
nvvidconv_postosd = Gst.ElementFactory.make(“nvvideoconvert”, “convertor_postosd”)
caps = Gst.ElementFactory.make(“capsfilter”, “filter”)
encoder = Gst.ElementFactory.make(“nvv4l2h264enc”, “encoder”)
rtppay = Gst.ElementFactory.make(“rtph264pay”, “rtppay”)
sink = Gst.ElementFactory.make(“udpsink”, “udpsink”)

sinkpad = streammux.get_request_pad("sink_0")
if not sinkpad:
    sys.stderr.write(" Unable to get the sink pad of streammux \n")

srcpad = caps_vidconvsrc.get_static_pad("src")
if not srcpad:
    sys.stderr.write(" Unable to get source pad of decoder \n")

The above flow can pass and run, but the weird thing is that the camera will get stuck at the first frame and as I move the camera, I cannot see the video get updated and be pushed to the rtsp server.

Where did I do wrong?
BTW, I am running on deepstream-sdk 5.0 on jetson nano


Can you run the USB cam app and RTSP app and confirm it can work well separately?

Also pls fill your setup info.

Thanks, I’ve solved the problem.