Extract width, height, and fps from video file.
(video_path: str)
| 48 | |
| 49 | |
| 50 | def get_video_properties(video_path: str) -> Tuple[int, int, int]: |
| 51 | """Extract width, height, and fps from video file.""" |
| 52 | cap = cv2.VideoCapture(video_path) |
| 53 | if not cap.isOpened(): |
| 54 | raise ValueError(f"Cannot open video file: {video_path}") |
| 55 | width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH)) |
| 56 | height = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT)) |
| 57 | fps = int(cap.get(cv2.CAP_PROP_FPS)) |
| 58 | cap.release() |
| 59 | return width, height, fps |
| 60 | |
| 61 | |
| 62 | def get_R_T( |