1
00:00:00,530 --> 00:00:07,939
I have this repeal here and in this repeal, I have this mean that's why file, which is empty and this

2
00:00:07,939 --> 00:00:15,740
video that MP for File, if you click vets rebels should normally be able to place if you click here.

3
00:00:16,940 --> 00:00:19,910
So this is a three seconds long video.

4
00:00:20,900 --> 00:00:27,380
It just a simple video, it doesn't have all do, and we don't need the old, you know, video processing

5
00:00:27,450 --> 00:00:32,880
could involve different activities such as you could extract frames.

6
00:00:32,880 --> 00:00:42,200
So to take individual images out of that video, you could resize the video, etc. And for each of these

7
00:00:42,200 --> 00:00:48,950
processing activities, you first need to know some basic information about the video.

8
00:00:49,010 --> 00:00:56,000
For example, if you want to recite the video from 180 pixels, you want to first know the resolution,

9
00:00:56,000 --> 00:01:00,320
so you want to get the information that this video is actually 180 pixels.

10
00:01:00,770 --> 00:01:07,010
So in this lecture, we're going to extract via Python the resolution of the video.

11
00:01:07,580 --> 00:01:15,230
In other words, the width so the number of pixels horizontally and the height, the number of pixels

12
00:01:15,230 --> 00:01:17,420
vertically, that's the resolution.

13
00:01:17,840 --> 00:01:26,150
We're also going to extract the number of frames, the total number of frames, because a video basically

14
00:01:26,150 --> 00:01:36,100
is just a bunch of images which the video player is stacking on top of each other, and it just shows

15
00:01:36,120 --> 00:01:37,520
one image after the other.

16
00:01:38,030 --> 00:01:47,990
Very quickly, and we see that video and each video has a number of images and also a video has frames

17
00:01:47,990 --> 00:01:51,740
per second, which is also related to the number of frames.

18
00:01:51,740 --> 00:02:00,290
So if this video is three seconds and the video has 90 images and 90 frames in total, that means this

19
00:02:00,290 --> 00:02:02,510
video has 30 frames per second.

20
00:02:02,570 --> 00:02:12,380
So let's see how we can load this video in open TV and then print out those pieces of information.

21
00:02:13,310 --> 00:02:18,080
So video would be a variable key to that.

22
00:02:18,770 --> 00:02:29,390
VIDEO Capture video capture is the class which expects as argument either the webcam source if we were

23
00:02:29,390 --> 00:02:32,600
using the webcam, but that's not the case here.

24
00:02:33,630 --> 00:02:40,080
The webcam you could define, it's either by zero if you want the main webcam of your computer or one

25
00:02:40,080 --> 00:02:44,340
if you want the secondary webcam, depending on how many webcams you have.

26
00:02:45,000 --> 00:02:54,420
So zero or one for webcam, for video files you do VIDEO That's MP for the path to your file and then

27
00:02:54,420 --> 00:02:55,980
you could get different.

28
00:02:58,530 --> 00:03:01,020
Parameters from your video, such as.

29
00:03:02,170 --> 00:03:04,480
Servitude that kept.

30
00:03:06,850 --> 00:03:09,290
Prop frame would.

31
00:03:09,670 --> 00:03:12,910
So that's a property of Creta.

32
00:03:13,180 --> 00:03:21,280
And if you supply this property to the gets methods and the get method points to the video object.

33
00:03:22,490 --> 00:03:24,830
That entire thing will give you the width.

34
00:03:25,610 --> 00:03:27,680
So let's test its print with.

35
00:03:31,810 --> 00:03:39,160
And that's the the ultimate silver width of this video is one, nine 20.

36
00:03:40,330 --> 00:03:42,170
So I would like to add something here.

37
00:03:42,250 --> 00:03:48,790
And indeed, since later on this number, we're going to need it as an integer.

38
00:03:49,180 --> 00:03:51,630
And similarly, you can get behind.

39
00:03:53,160 --> 00:03:55,300
VIDEO that get quite to do it.

40
00:03:56,910 --> 00:04:00,900
Cap prop frame height.

41
00:04:02,150 --> 00:04:12,260
Then the number of frames you can get to if we do not get to that cap prop frame count.

42
00:04:12,920 --> 00:04:19,610
And lastly, FP s, which stands from frames per second, is video dots.

43
00:04:20,120 --> 00:04:30,530
Get to that cap prop FP s and let's print all of them all to your height.

44
00:04:32,090 --> 00:04:37,160
Number of frames and fires run heights.

45
00:04:37,250 --> 00:04:38,570
Oh, I have a typo.

46
00:04:42,560 --> 00:04:43,490
And as a result.

47
00:04:43,670 --> 00:04:45,260
So the width.

48
00:04:46,510 --> 00:04:51,850
The hides, which also makes the resolution of the video advanced the resolution of video.

49
00:04:53,410 --> 00:04:58,810
90 frames in total make of that video, 30 frames per second.

50
00:04:58,870 --> 00:05:05,530
So the video is three seconds in total, 30 times three makes 90.

51
00:05:06,130 --> 00:05:15,220
So now that we have these four pieces of information, we can go ahead and perform other actions, specifically

52
00:05:15,220 --> 00:05:16,060
in the next video.

53
00:05:16,780 --> 00:05:25,690
We're going to get all the frames over 90 frames over the video and save each of them as a JPEG image

54
00:05:25,870 --> 00:05:26,290
file.

55
00:05:27,130 --> 00:05:27,940
So see you there.

