Converting Color video to grayscale using OpenCV in Python Last Updated : 11 Dec, 2025 Comments Improve Suggest changes 1 Likes 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. Python 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 if cv2.waitKey(25) & 0xFF == ord('q'): break # closing the window cv2.destroyAllWindows() source.release() Output: Create Quiz Comment D dlokeshram Follow 1 Improve D dlokeshram Follow 1 Improve Article Tags : Machine Learning AI-ML-DS OpenCV python Python-OpenCV +1 More Explore Machine Learning BasicsIntroduction to Machine Learning8 min readTypes of Machine Learning7 min readWhat is Machine Learning Pipeline?6 min readApplications of Machine Learning3 min readPython for Machine LearningMachine Learning with Python Tutorial5 min readNumPy Tutorial - Python Library3 min readPandas Tutorial4 min readData Preprocessing in Python4 min readEDA - Exploratory Data Analysis in Python6 min readFeature EngineeringWhat is Feature Engineering?5 min readIntroduction to Dimensionality Reduction4 min readFeature Selection Techniques in Machine Learning4 min readSupervised LearningSupervised Machine Learning7 min readLinear Regression in Machine learning14 min readLogistic Regression in Machine Learning10 min readDecision Tree in Machine Learning8 min readRandom Forest Algorithm in Machine Learning5 min readK-Nearest Neighbor(KNN) Algorithm8 min readSupport Vector Machine (SVM) Algorithm9 min readNaive Bayes Classifiers6 min readUnsupervised LearningWhat is Unsupervised Learning5 min readK means Clustering â Introduction6 min readHierarchical Clustering in Machine Learning6 min readDBSCAN Clustering in ML - Density based clustering6 min readApriori Algorithm6 min readFrequent Pattern Growth Algorithm5 min readECLAT Algorithm - ML5 min readPrincipal Component Analysis (PCA)7 min readModel Evaluation and TuningEvaluation Metrics in Machine Learning9 min readRegularization in Machine Learning5 min readCross Validation in Machine Learning5 min readHyperparameter Tuning5 min readUnderfitting and Overfitting in ML3 min readBias and Variance in Machine Learning6 min readAdvanced TechniquesReinforcement Learning9 min readSemi-Supervised Learning in ML5 min readSelf-Supervised Learning (SSL)6 min readEnsemble Learning8 min readMachine Learning PracticeMachine Learning Interview Questions and Answers15+ min read100+ Machine Learning Projects with Source Code5 min read Like