So welcome back to the section on working with video.
So we're going to open the second book here to listen.
But before I do, I just want you to note something.
Notice that the first notebook we opened is in has a green icon here.
This green icon indicates that it's still running right now.
You can check it in your running tab and you can see it's still here, and you can resume this notebook
by opening it, opening it here and going back to the lesson.
When you close, the tab here doesn't actually terminate the notebook.
It's still running.
So if you wanted to shut it down, just press shut down here and you can see changes back to agree icon.
So let's open the second book called Opening Video Files, and we'll take a look at this lesson.
So let's zoom in a bit so you guys can see clearly.
So in this lesson, what we're going to do?
We're going to open this video here called Tramadol MPEG four, and we're just going to play it and
notice that there's some could here that I'll explain to you now what is part of it?
What his piece does is that remember, every time we read a frame from the video, that cup is opened.
So every time we read a frame from this and while they do, the copies opened.
We get the frame here and they get ripped as well.
Read is a boolean that tells us whether or not the frame was read correctly.
So if it wasn't read correctly, which means that we have come to the end of a video file, it would
break the loop and exit and close the window and released a camera here.
Alternatively, if we wanted to close this video, you can press Q.
That's what it gives us.
The it maps the key value to the actual digit of what we keys equates to being equal.
And then once this is this condition is met, it breaks to loop here.
So let's run this code and take a look at it.
So again, the window opens behind the scene and this is a drummer, one of my favorite drummers.
Matt, you got his last name, though.
Matt McGuire, so you can look him up in YouTube, he's quite good and you can see this beach ball has
come up again, and that's because a Mac systems, whenever we try to and this here doesn't actually
close the window.
So that's unfortunate.
But that's OK.
We can work with this for now.
So here's another thing to think about how do you check a video stream or video file is correct?
Or is it was off the correct format and loaded properly before actually playing the video?
So what you can do is use the cap is opened for of function here.
This tells us if it's not opened successfully, which means that we can't access a frame from the video
it will exit the program.
OK.
Well, you can just review areas era as well is exception.
However, whatever you prefer to use, I think in Python this is probably not the best coding practice
to use, but nevertheless it works and we will use this here.
So let's look this and you'll see the video again with Matt McGuire drumming his heart out.
He's really, really impressive drumming.
He actually drums for The Chainsmokers on tour right now.
So you can see at the end here at the end of the file it, which is that there's no return false.
So the stream is now stopped and you can see it's printed out here.
So let's just quit these.
No.
This notebook will have to be restarted.
Actually, it's restarts by itself.
Great.
So now let's take a look at the cup.
Don't get it.
What is that?
This is a method where we can actually access information about the video file itself here.
It has 18 elements in this list of capture, and we can see we can print them out right here.
So you can see it includes all sorts of information about the video, and you can immediately see 640
by it for 60 is a resolution.
So if you wanted to actually see what each number denotes, you can check it out on the open TV documentation.
However, for now, it would just take it.
We just need to know that this is two frames per second.
Some of these relate to bitrate as well and codec information, and a lot of these aren't really used.
Consider just zeros here.
So that's it.
For this lesson, we'll stop there, and then we'll go on to saving and recording videos and open TV,
which you would have seen before in the cloud, but notebooks that we use.
However, we'll just define it here as well.