OPENCV push stream into RTSP server

Thank you DaneLLL.
I cannot do in another way, I alter the frame in Python and I have BGR Math frame.
So in order to encode it using nvv4l2h264enc I need to convert it in a compatible format before.
So I’ve added BGR to BGRx conversion.

The similar discussion: [Gstreamer] nvvidconv, BGR as INPUT
Was open by me…

I’m exploring the possibility to remove BGR conversion but I found a big problem: Opencv VideoWriter doesn’t support 16-bit depth images, so I cannot pass an RGBA (or other 16-bit format) directly to gstreamer.
I’m forced to pass an RGB or BGR frame and convert it in CPU using gstreamer, so no way to prevent CPU usage.

cv2.error: /home/nvidia/build_opencv/opencv/modules/videoio/src/cap_gstreamer.cpp:1740: error: (-210) cvWriteFrame() needs images with depth = IPL_DEPTH_8U and nChannels = 3. in function CvVideoWriter_GStreamer::writerFrame