How to create x264 RTSP server with OpenCV Python with GStreamer backend

Viewed 4364

My goal is to create a RTSP server using OpenCV Python using the GStreamer backend. I have RGB images stored as OpenCV Mat, and I would like to create a VideoWriter which can write to a RTSP sink. The output video must be x264 encoded.

I believe this can be easily achieved using a GStreamer pipeline and providing the pipeline arguments to the VideoWriter constructor and then later pushing frames to the VideoWriter, but the issue is I have no experience working with GStreamer and I find it very confusing.

The answers I have found on SO are incomplete, use specific hardware decoders (ex for NVIDIA Jetson), or are overly complex. I'd like to find a more generic solution which works on CPU.

2 Answers

I have created a project something related to your requirement sometime ago. This could be a kickstarter and customize it based on your need. I'm attaching my github repository link below.

OpenCV RTSP Server

Any issues related to the project can be raised in the github itself and doubts can be cleared here.

SimpleRTSPServer, Not in Python but very simple to run and use. Start the server in another terminal and write your outputs to there. The server easy to configure as well. You can capture read frames easily from another Python script or VLC.

Related