Search code examples
pythonopencvgstreamernvidia-jetson-nano

RTSP Streaming with Gstreamer and OpenCV (Python)


I know there's lots of similar questions out there, however, I couldn't find any working solution to my problem. So I've been trying to run a Gstreamer pipeline inside OpenCV's VideoCapture() object. I've tried:

cap = cv2.VideoCapture('v4l2src ! xvimagesink')

but that results in get an Assertion Failed error.

I will actually use rtsp stream from IP camera but for simplicity, I gave the basic USB webcam pipeline as example. My cv2.getBuildInformation() output states YES for Gstreamer.

I am working on Nvidia Jetson Nano with Python3 and OpenCV 4.1 installed afterwards. It would be great if I could achieve this so I can carry on with processing the stream etc.

Thanks in advance!


Solution

  • Shouldn't it be something like:

    cap = cv2.VideoCapture('v4l2src ! videoconvert ! appsink', cv2.CAP_GSTREAMER)