Converting Color video to grayscale using OpenCV in Python Last Updated : 15 Jul, 2025 Comments Improve Suggest changes Like Article Like Report OpenCV is a huge open-source library for computer vision, machine learning, and image processing. It can process images and videos to identify objects, faces, or even the handwriting of a human. In this article, we will see how to convert a colored video to a gray-scale format. Approach: Import the cv2 module.Read the video file to be converted using the cv2.VideoCapture() method.Run an infinite loop.Inside the loop extract the frames of the video using the read() method.Pass the frame to the cv2.cvtColor() method with cv2.COLOR_BGR2GRAY as a parameter to convert it into gray-scale.Display the frame using the cv2.imshow() method. Example: Suppose we have the video file CountdownTimer.mov as the input. Python3 # importing the module import cv2 # reading the video source = cv2.VideoCapture('Countdown Timer.mov') # running the loop while True: # extracting the frames ret, img = source.read() # converting to gray-scale gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) # displaying the video cv2.imshow("Live", gray) # exiting the loop key = cv2.waitKey(1) if key == ord("q"): break # closing the window cv2.destroyAllWindows() source.release() Output: Comment More infoAdvertise with us Next Article How to convert a grayscale image to RGB in OpenCV D dlokeshram Follow Improve Article Tags : Machine Learning AI-ML-DS OpenCV python Python-OpenCV +1 More Practice Tags : Machine Learningpython Similar Reads Color Identification in Images using Python - OpenCV An open-source library in Python, OpenCV is basically used for image and video processing. Not only supported by any system, such as Windows, Linux, Mac, etc. but also it can be run in any programming language like Python, C++, Java, etc. OpenCV also allows you to identify color in images. Donât you 3 min read Python | Denoising of colored images using opencv Denoising of an image refers to the process of reconstruction of a signal from noisy images. Denoising is done to remove unwanted noise from image to analyze it in better form. It refers to one of the major pre-processing steps. There are four functions in opencv which is used for denoising of diffe 1 min read How to convert a grayscale image to RGB in OpenCV In image processing, images can be categorized into grayscale and RGB formats. Grayscale images contain varying shades of gray, representing intensity levels, while RGB images use red, green, and blue channels to depict a wider range of colors. Converting grayscale images to RGB is crucial for appli 5 min read Convert OpenCV image to PIL image in Python OpenCV is a huge open-source library for computer vision, machine learning, and image processing. OpenCV supports a wide variety of programming languages like Python, C++, Java, etc. It can process images and videos to identify objects, faces, or even the handwriting of a human. When it is integrate 3 min read Multiple Color Detection in Real-Time using Python-OpenCV For a robot to visualize the environment, along with the object detection, detection of its color in real-time is also very important. Why this is important? : Some Real-world ApplicationsIn self-driving car, to detect the traffic signals.Multiple color detection is used in some industrial robots, t 4 min read Multiple Color Detection in Real-Time using Python-OpenCV For a robot to visualize the environment, along with the object detection, detection of its color in real-time is also very important. Why this is important? : Some Real-world ApplicationsIn self-driving car, to detect the traffic signals.Multiple color detection is used in some industrial robots, t 4 min read Like