Converting/Downloading Videos php or javascript
So I've decided that adding the functionality to download videos from my website, which are videos played from youtube (youtube videos are dynamically embedded on the site).
I've read a bit about ffmpeg, which is php based
I would love to use javascript/Jquery because thats what I do almost all my coding, but I guess I have to learn php at some time.
Basica开发者_如何学运维lly I'm wondering, how would it be done? I would assume that you would first upload the video to your site, and then proceed to convert and then when finished give a link to the user to download the video? If so, how would I go about getting the video from youtube?
I tried learning from this site...here, but I couldn't quite get it. I'd just like to know th best way of going about this, and if anyone has any information on how to do it, I'm all ears, thanks a lot!
You cannot invoke ffmpeg from javascript/JQuery, as that runs on the client computer, not your server. The data for the videos that are embedded on your website never actually go through your web server, they go straight from YouTube to the web browsers of your websites' visitors.
In order to download from YouTube and convert the videos, you'd have to establish a connection with the YouTube server yourself (from your server), download the file (having worked out what the URL of the actual data stream is), and then run it through ffmpeg. This is not a trivial task if you've never done anything server-side before.
As it's likely to take a long time and require some kind of background-processing task, you probably wouldn't want to do this all in a single web-page request. I would create a background process to download and convert the file, then offer the URL to download the completed file to the client.
You will have considerable bandwidth requirements if a service like this becomes popular, as you'll have the bandwidth of downloading each file from YouTube, and the bandwidth of serving your converted files to the client.
Do you actually need to convert the files in any way - or are you simply after stripping the data stream and saving it as a file?
精彩评论