-i https://pypi.tuna.tsinghua.edu.cn/simple -i http://mirrors.aliyun.com/pypi/simple/ --index-url https://pypi.douban.com/simple -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
import time import cv2 import threading zhen = 20
def video(date): global ty if zhen != 0 and time.time() - date > 1/zhen: ty = True
else: ty = False
if __name__ == '__main__': url = 'rtsp://admin:wlcs1234@192.168.0.81/11' cap = cv2.VideoCapture(url) vid = True ty = False s = time.time()
while (cap.isOpened()): # Capture frame-by-frame ret, frame = cap.read() # Display the resulting frame if isinstance(vid, bool) or not vid.is_alive(): vid = threading.Thread(target=video, args=(s,)) vid.start()
if ty: cv2.imshow('frame', frame) s = time.time() # cv2.imshow('frame',frame) if cv2.waitKey(1) & 0xFF == ord('q'): break # When everything done, release the capture cap.release() cv2.destroyAllWindows()