How to use cv2.VideoWriter to output rtsp stream?

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU)
1080Ti
• DeepStream Version
deepstream 6
• JetPack Version (valid for Jetson only)
• TensorRT Version
tesnorrt 8
• NVIDIA GPU Driver Version (valid for GPU only)
370
• 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=127.0.0.1 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 = capture.read()
    if not ret:
        break
    img = cv2.blur(frame, (3, 3))
   
    cv2.waitKey(30)
    out.write(img)

but ,I got error.

I already had a rtsp-simple-server at 127.0.0.1 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

@Fiona.Chen
Thank u.The posted your refered is use videowriter to file,but I want output a rtsp stream.so ,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.