How to use cv2.VideoWriter to output rtsp stream?

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU)
• DeepStream Version
deepstream 6
• JetPack Version (valid for Jetson only)
• TensorRT Version
tesnorrt 8
• NVIDIA GPU Driver Version (valid for GPU only)
• Issue Type( questions, new requirements, bugs)

I want to read a mp4 file and output as rtsp stream. my code like this:

def gstreamer_pipeline_out():
    return (
        "appsrc ! "
        "video/x-raw, format=BGR ! "
        "queue ! "
        "videoconvert ! "
        "video/x-raw, format=BGRx ! "
        "nvvidconv ! "
        "omxh264enc ! "
        "video/x-h264, stream-format=byte-stream ! "
        "h264parse ! "
        "rtph264pay pt=96 config-interval=1 name=test! "
        "udpsink host= port=8554"
video_path = "demo.mp4"
capture = cv2.VideoCapture(video_path)

out = cv2.VideoWriter(gstreamer_pipeline_out(), 0, 60, (1280, 720))

while True:
    ret, frame =
    if not ret:
    img = cv2.blur(frame, (3, 3))

but ,I got error.

I already had a rtsp-simple-server at with port 8554

so, how to output rtsp stream?

and when I run vlc player ,how to got network url ?

• How to reproduce the issue ? (This is for bugs. Including which sample app is using, the configuration files content, the command line used and other details for reproducing)
• Requirement details( This is for new requirement. Including the module name-for which plugin or for which sample application, the function description)

Please refer to cv2.VideoWriter[Gstreamer + Opencv] using Hardware Encoder with python code - Jetson & Embedded Systems / Jetson Nano - NVIDIA Developer Forums

Thank u.The posted your refered is use videowriter to file,but I want output a rtsp ,any suggust for me?

This topic may help. Jetson TX2 RTSP Streaming, FFmpeg or Gstreamer? - Jetson & Embedded Systems / Jetson TX2 - NVIDIA Developer Forums

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.