All right.
Hi, and welcome back to the seventh chapter in this section called looking at videos where we're going
to import a YouTube video and process it using open TV.
So let's take a look at that notebook's let's open it up.
I already had it open here, but it's very open it anyway.
And this one is an interesting lesson.
So let's zoom in.
So we're going to use two libraries here called Puffy and YouTube.
Download the demo.
Two different things.
Puffy is the one that we're going to use to load a YouTube stream of life here.
So to do that, we import Puffy.
We pointed YouTube URL.
That's the URL for the video that you want to open.
Pointed to puffy dot new here.
So this is this creates this video object, which has functions called Get this get.
This gives you the highest quality YouTube video encoding for that video because remember, it is true
p 480p seven 2010 and sometimes even 4K sometimes and different frame rates.
So again, this allows you to get the highest quality stream of that video, and you can set a preferred
type to MPEG four as well, because that's easy to process with OpenCV.
And then what we do, we create a video capture object here and we use to capture that open and we feed
this in best of URL here.
And that allows us know to use capture that read to read frames from that video as it plays in the back
end.
So let's run all of this code and see what happens.
And probably, OK, it's working right now.
However, that's because I edited some files in dysfunction.
Normally, you should have seen an error, most likely.
That said, an error error related to dislike count.
And that's because YouTube recently changed their dislike like they removed.
The display can be a feature from the videos, so people can can see no longer see dislikes because
apparently it was creating negativity but different video videos.
And I'm not sure exactly what the social aspect of that was and what the reason.
I don't fully agree with it because I think it's good to have that data, but nevertheless it was removed
from YouTube.
But the Party Library didn't update, so to do that, I had to open this file in the party library called
back in YouTube.
Download and use the text editor in Mac.
You can open this with any text, and it's all you want, like sublime or atom or voice could just use
this one for simplicity, and there's a line of code here called Dislikes, which you will need to comment
out here.
So it does with commented out here now.
It wasn't commented up before, but that's because it was using previous saved version of party in his
library.
So you need to come and out there.
Take a look at that file again.
You can scroll down this link is going to delete this line or this comment out the line if you want,
and that should allow this library to work.
So now let's use that sympathy to get metadata from this video.
So let's take a look at this so you can see the title.
The video we playing is video for by Param Local in it fun.
It's pretty nice songs, and you can check it out.
It's not the best song, but it's just one I was listening to at a time when I created this lesson.
You can get to reading, which is pretty cool.
The view count, which is 146 million water lengths and seconds duration in terms of like minutes and
seconds as well.
So you can do a lot of analytics here.
You can imagine processing different videos, getting the average song length for an artist, average
rating for different songs, so it's pretty cool to use this to extract that information.
So let's take a look at the streams, because remember, I told you we were getting the best stream.
So let's take a look at this.
What is this we're doing to us here?
This is returning the URL for that bass stream right now.
So the best stream for that video was 6:40.
This is recording here and this is a file size, so this allows us to inspect the streams in more detail
in case you wanted to risk, resize accordingly.
OK.
And how do you get the highest quality stream?
Remember to we got get bass.
This gives us here the outputs of what the best resolution is and the best extension.
So and this is the best direct URL for that video as well.
And you can download videos as well quite easily get just download them here.
Quiet equals false means it's going to download in the background of let's take a look to have a find
a way to open the way to it.
So let me just navigate to that screen and I'll bring it back to you here.
So you can see it would have downloaded this video here, so this video wasn't downloaded today is actually
was.
I'm not sure why it's is 2019.
It didn't do that that long ago, but yeah, it would have downloaded that video here, but actually
do believe you need it to run these prior.
And that's it.
So, no, you can actually get it done with audio from streams so you can extract the audio here by
running that and you can actually get the bitrate of them there.
So and if you wants to download it, you can just run the stream if you want.
There are different streams because there are different audio recordings as well, and this would allow
us to download the stream here.
So that's this is one of these is yeah, this is a video audio streaming system, Web M file.
So that's it for this lesson.
I hope you enjoyed these lessons here.
They were quite enjoyable to do for me to make, and I do use them occasionally in my computer vision
work.
And I hope you do too and your projects so in your work place or whatever you're doing.
I hope you enjoy it.
And if you have any questions, feel free to contact me where this more.
This concludes the open sea view section of this course.
We may occasionally go back to simple functions in the next section, but this is the core.
The Open V. Lesson here will now start the deep learning aspect of the course, which is the actual
very cool part which I'm looking forward to sharing with you guys.
So welcome into the next section of the course, which starts on a deep learning computer vision, of
course.
Thank you.