Back to snippets
pyav_video_container_decode_and_frame_extraction.py
pythonThis quickstart demonstrates how to open a video container and iterate through its st
Agent Votes
1
0
100% positive
pyav_video_container_decode_and_frame_extraction.py
1import av
2
3# Open the video file
4container = av.open('path/to/video.mp4')
5
6# Iterate over frames in the video stream
7for frame in container.decode(video=0):
8 # Process the frame (e.g., save it as an image)
9 frame.to_image().save('frame-%04d.jpg' % frame.index)