Created
February 27, 2020 11:52
-
-
Save imneonizer/7da5b3965dbaee8a27a9c153d9ce5e6c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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