I am using a cv2.Videowriter to try and write the Left Camera stream to an RTSP server using python. But It dose not seem to be able to work.
Now I am able to view the left stream from the camera with
cv2.imshow(‘Image’, image_ocv)
But when I use
out_send.write(image_ocv)
to write to the RTSP server I get this error
WARN:0] global /home/joev/JEP/script/workspace/opencv-4.5.0/modules/videoio/src/cap_gstreamer.cpp (1631) writeFrame OpenCV | GStreamer warning: cvWriteFrame() needs images with depth = IPL_DEPTH_8U and nChannels = 3.
Here is my out send string
out_send = cv2.VideoWriter(‘appsrc ! videoconvert ! video/x-raw,format=YUY2 ! nvvidconv ! video/x-raw(memory:NVMM),format=(string)NV12,width=1280,height=720 !
nvv4l2h264enc bitrate=12000000 insert-sps-pps=1 idrinterval=1 insert-vui=1 ! video/x-h264
! rtph264pay pt=96 !
udpsink host=127.0.0.1 port=5400 async=false sync=0’,
cv2.CAP_GSTREAMER, 0, 30, (1280,720), True)
and here is my RTSP factory set launch string
factory.set_launch(“(udpsrc name=pay0 port=%d buffer-size=524288 caps="application/x-rtp, media=video, clock-rate=90000, encoding-name=(string)%s, payload=96 " )” % (updsink_port_num, codec))
I have tried numerous combinations for the
out_send = cv2.VideoWriter string
but nothing seems to get past the error