Last Updated : 11 Aug, 2025
Extracting individual frames from a video is a fundamental task in video processing. With OpenCV in Python, we can capture each frame sequentially from a video file or camera stream and save them as separate image files. This technique is widely used in applications such as motion analysis, object tracking and dataset creation for machine learning.
InstallationPrerequisites:
You can install OpenCV using pip:
Python Implementation Pythonpip install opencv-python
import cv2
vid = cv2.VideoCapture("C:\\Users\\Admin\\PycharmProjects\\project_1\\openCV.mp4")
count, success = 0, True
while success:
success, image = vid.read() # Read frame
if success:
cv2.imwrite(f"frame{count}.jpg", image) # Save frame
count += 1
vid.release()
Output:
Explanation:
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4