def main(): video_path = "Ajb08326.mp4" video_info = extract_video_info(video_path) if video_info: print(f"Video Information for {video_path}:") print(f"Width: {video_info['width']}") print(f"Height: {video_info['height']}") print(f"Frame Rate: {video_info['frame_rate']}") print(f"Duration: {video_info['duration']}")
return { 'width': width, 'height': height, 'frame_rate': frame_rate, 'duration': duration } except Exception as e: print(f"An error occurred: {e}") return None Ajb08326 mp4
def extract_video_info(video_path): try: probe = ffmpeg.probe(video_path) # Get video stream video_stream = next((stream for stream in probe['streams'] if stream['codec_type'] == 'video'), None) # Extract information width = video_stream['width'] height = video_stream['height'] frame_rate = video_stream.get('r_frame_rate', 'N/A') # Sometimes, frame rate might not be directly available duration = probe['format']['duration'] def main(): video_path = "Ajb08326