Python OpenCV
About Lesson

In this Python OpenCV lesson we are going to learn How to Read AVI Videos in Python OpenCV, so you can use an avi video or you can use camera, the same code will be implemented with camera or avi video.

 

 

This is the complete code for this lesson.

 

 

 

In here we are loading our avi video, make sure that you have already added a video in your working directory, if you are using camera you need to give 0 in cap = cv2.VideoCapture(‘samplevid.avi’).

 

 

We need to check if the video capture is opened, if that is opened we want to read the frame and show that.

 

 

 

If we press the q key we want to quite the window and video.

 

 

 

Run the code and you will see your avi video in thee window.

How to Read AVI Videos in Python OpenCV
How to Read AVI Videos in Python OpenCV