hi, all of you today I am going to let you know how to play media such videos using programming . in this section we will be playing video using python programming language.
To playing such kind of media you need to install an open cv module in your system .open cv ( Open Source Computer Vision Library ) is an open-source computer vision and machine learning software library.
Before running the below code first check if your system has a cv2 module or not. if not open (command prompt, terminal, windows power shell ) and copy given below line and paste in your terminal and hit the enter button. pip install opencv-python (make sure you are in python installed folder(directory)).
Simple example of cv is given below:
import cv2 #give your own video path. cap = cv2.VideoCapture("D:\python programs\open cv\movie.mp4") while True: ret , frame=cap.read() if ret==True: cv2.imshow('video', frame) if cv2.waitKey(25) & 0xFF == ord('q'): break else: break cap.release() cv2.destroyAllWindows()
Now you are able to play video using python.