1
00:00:00,120 --> 00:00:03,090
So welcome back to the section on working with video.

2
00:00:03,630 --> 00:00:06,550
So we're going to open the second book here to listen.

3
00:00:06,570 --> 00:00:08,790
But before I do, I just want you to note something.

4
00:00:09,210 --> 00:00:13,260
Notice that the first notebook we opened is in has a green icon here.

5
00:00:13,650 --> 00:00:17,040
This green icon indicates that it's still running right now.

6
00:00:17,070 --> 00:00:21,390
You can check it in your running tab and you can see it's still here, and you can resume this notebook

7
00:00:21,390 --> 00:00:25,420
by opening it, opening it here and going back to the lesson.

8
00:00:25,470 --> 00:00:28,740
When you close, the tab here doesn't actually terminate the notebook.

9
00:00:28,740 --> 00:00:29,730
It's still running.

10
00:00:30,240 --> 00:00:36,660
So if you wanted to shut it down, just press shut down here and you can see changes back to agree icon.

11
00:00:37,380 --> 00:00:42,570
So let's open the second book called Opening Video Files, and we'll take a look at this lesson.

12
00:00:43,140 --> 00:00:45,720
So let's zoom in a bit so you guys can see clearly.

13
00:00:46,230 --> 00:00:48,450
So in this lesson, what we're going to do?

14
00:00:48,480 --> 00:00:55,740
We're going to open this video here called Tramadol MPEG four, and we're just going to play it and

15
00:00:56,250 --> 00:01:02,190
notice that there's some could here that I'll explain to you now what is part of it?

16
00:01:02,250 --> 00:01:08,760
What his piece does is that remember, every time we read a frame from the video, that cup is opened.

17
00:01:09,570 --> 00:01:13,110
So every time we read a frame from this and while they do, the copies opened.

18
00:01:13,650 --> 00:01:18,300
We get the frame here and they get ripped as well.

19
00:01:18,810 --> 00:01:22,650
Read is a boolean that tells us whether or not the frame was read correctly.

20
00:01:23,220 --> 00:01:28,470
So if it wasn't read correctly, which means that we have come to the end of a video file, it would

21
00:01:28,470 --> 00:01:32,190
break the loop and exit and close the window and released a camera here.

22
00:01:33,060 --> 00:01:38,100
Alternatively, if we wanted to close this video, you can press Q.

23
00:01:38,400 --> 00:01:39,450
That's what it gives us.

24
00:01:39,450 --> 00:01:47,880
The it maps the key value to the actual digit of what we keys equates to being equal.

25
00:01:48,450 --> 00:01:52,020
And then once this is this condition is met, it breaks to loop here.

26
00:01:52,800 --> 00:01:56,190
So let's run this code and take a look at it.

27
00:01:56,730 --> 00:02:02,010
So again, the window opens behind the scene and this is a drummer, one of my favorite drummers.

28
00:02:02,010 --> 00:02:04,230
Matt, you got his last name, though.

29
00:02:07,160 --> 00:02:12,650
Matt McGuire, so you can look him up in YouTube, he's quite good and you can see this beach ball has

30
00:02:13,010 --> 00:02:18,050
come up again, and that's because a Mac systems, whenever we try to and this here doesn't actually

31
00:02:18,050 --> 00:02:18,830
close the window.

32
00:02:18,830 --> 00:02:19,940
So that's unfortunate.

33
00:02:19,940 --> 00:02:20,690
But that's OK.

34
00:02:20,870 --> 00:02:21,920
We can work with this for now.

35
00:02:22,460 --> 00:02:29,210
So here's another thing to think about how do you check a video stream or video file is correct?

36
00:02:29,210 --> 00:02:37,030
Or is it was off the correct format and loaded properly before actually playing the video?

37
00:02:37,070 --> 00:02:42,500
So what you can do is use the cap is opened for of function here.

38
00:02:43,190 --> 00:02:48,980
This tells us if it's not opened successfully, which means that we can't access a frame from the video

39
00:02:49,550 --> 00:02:50,840
it will exit the program.

40
00:02:51,140 --> 00:02:51,500
OK.

41
00:02:51,560 --> 00:02:55,280
Well, you can just review areas era as well is exception.

42
00:02:56,000 --> 00:03:02,750
However, whatever you prefer to use, I think in Python this is probably not the best coding practice

43
00:03:02,750 --> 00:03:05,810
to use, but nevertheless it works and we will use this here.

44
00:03:06,410 --> 00:03:12,410
So let's look this and you'll see the video again with Matt McGuire drumming his heart out.

45
00:03:12,440 --> 00:03:14,360
He's really, really impressive drumming.

46
00:03:14,390 --> 00:03:17,840
He actually drums for The Chainsmokers on tour right now.

47
00:03:19,220 --> 00:03:26,090
So you can see at the end here at the end of the file it, which is that there's no return false.

48
00:03:26,510 --> 00:03:29,450
So the stream is now stopped and you can see it's printed out here.

49
00:03:30,080 --> 00:03:31,700
So let's just quit these.

50
00:03:31,790 --> 00:03:32,240
No.

51
00:03:32,990 --> 00:03:35,740
This notebook will have to be restarted.

52
00:03:35,750 --> 00:03:37,340
Actually, it's restarts by itself.

53
00:03:37,760 --> 00:03:38,210
Great.

54
00:03:39,110 --> 00:03:41,070
So now let's take a look at the cup.

55
00:03:41,100 --> 00:03:41,930
Don't get it.

56
00:03:42,410 --> 00:03:43,160
What is that?

57
00:03:43,640 --> 00:03:48,310
This is a method where we can actually access information about the video file itself here.

58
00:03:49,340 --> 00:03:55,430
It has 18 elements in this list of capture, and we can see we can print them out right here.

59
00:03:56,060 --> 00:04:01,340
So you can see it includes all sorts of information about the video, and you can immediately see 640

60
00:04:01,340 --> 00:04:03,110
by it for 60 is a resolution.

61
00:04:03,830 --> 00:04:08,900
So if you wanted to actually see what each number denotes, you can check it out on the open TV documentation.

62
00:04:09,530 --> 00:04:11,130
However, for now, it would just take it.

63
00:04:11,170 --> 00:04:13,640
We just need to know that this is two frames per second.

64
00:04:14,600 --> 00:04:19,820
Some of these relate to bitrate as well and codec information, and a lot of these aren't really used.

65
00:04:19,820 --> 00:04:21,130
Consider just zeros here.

66
00:04:21,770 --> 00:04:22,370
So that's it.

67
00:04:22,370 --> 00:04:28,480
For this lesson, we'll stop there, and then we'll go on to saving and recording videos and open TV,

68
00:04:28,520 --> 00:04:31,670
which you would have seen before in the cloud, but notebooks that we use.

69
00:04:32,090 --> 00:04:34,190
However, we'll just define it here as well.
