OpenCV frame capture with no output and errors (gstreamer)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

OpenCV frame capture with no output and errors (gstreamer)

1,029 Views
9ghtX
Contributor I

I'm trying to get frames via Python OpenCV from my MIPI camera with gstreamer pipeline, but there is no any output messages like warnings, errors or cv2.imshow() frames.

Here is code that I'm trying to execute (found it in Internet):

import cv2

def receive():
    cap_receive = cv2.VideoCapture('udpsrc port=5000 caps = "application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, payload=(int)96" ! rtph264depay ! decodebin ! videoconvert ! appsink', cv2.CAP_GSTREAMER)

    if not cap_receive.isOpened():
        print('VideoCapture not opened')
        exit(0)

    while True:
        ret,frame = cap_receive.read()

        if not ret:
            print('empty frame')
            break

        cv2.imshow('receive', frame)
        if cv2.waitKey(1)&0xFF == ord('q'
            break

    #cap_receive.release()

if __name__ == '__main__':
    receive()
    
    cv2.destroyAllWindows()
Labels (1)
0 Kudos
1 Reply

1,019 Views
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Hello 9ghtX,

Is the code compile? you are trying to do a videocapture form UDP, is porbably that opencv detec that is not activate.

Regards

 

0 Kudos