import cv2 """识别视频信息""" def get_video_size(video_url): try: videoCapture = cv2.VideoCapture(video_url) if not videoCapture.isOpened(): return None width = int(videoCapture.get(cv2.CAP_PROP_FRAME_WIDTH)) height = int(videoCapture.get(cv2.CAP_PROP_FRAME_HEIGHT)) size = (width, height) return size except Exception as e: print(format(e)) return None # 可以是本地地址,也可以是远程地址 url = 'input.mp4' info = get_video_size(url) print(info)
01-27
4101
07-02
8473