Spaces:
Sleeping
Sleeping
import cv2 | |
import logging | |
# Set up logging | |
logging.basicConfig(level=logging.INFO) | |
logger = logging.getLogger(__name__) | |
def get_video_properties(video_path): | |
try: | |
cap = cv2.VideoCapture(video_path) | |
if not cap.isOpened(): | |
logger.error("Failed to open video file") | |
return 0, 0, 0 | |
fps = cap.get(cv2.CAP_PROP_FPS) | |
width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH)) | |
height = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT)) | |
cap.release() | |
return fps, width, height | |
except Exception as e: | |
logger.error(f"Error getting video properties: {str(e)}") | |
return 0, 0, 0 |