Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import cv2
def VideoCapture(uri, width, height, latency):
gst_str = ('rtspsrc location={} latency={} ! '
'rtph264depay ! h264parse ! omxh264dec ! '
'nvvidconv ! '
'video/x-raw, width=(int){}, height=(int){}, '
'format=(string)BGRx ! '
'videoconvert ! appsink').format(uri, latency, width, height)
return cv2.VideoCapture(gst_str, cv2.CAP_GSTREAMER)
cap = VideoCapture("rtsp://admin:@192.168.0.178", 1920, 1080, 200)
while True:
success, frame = cap.read()
if not success: break
cv2.imshow("frame", frame)
if cv2.waitKey(1) == ord('q'): break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment