I have a laravel website on shared hosting and some videos on a cloud storage.
What do I need to hide direct links and stream videos on my website?
The videos are for sell and somebody might download them without paying. so every time that a user wants to see a video, I generate a random link and use it in video src. I generate random string and pass it to a function. The function finds video link and uses curl to get and play video (PHP stream remote video file) but it's not good enough. If it is possible to stream videos from another source, what do I need to do it right?
Do I need a streaming server? is apache good enough? what should I learn?
I've a download youtube scrip, after many changes I get to a point where I get a direct link to video, something like this :
http://r12---sn-4g57km7s.googlevideo.com/videoplayback?dur=265.868&pl=21&sver=3&mt=1444909527&ms=pm&source=youtube&sparams=dur,id,ip,ipbits,itag,lmt,mime,mm,mn,ms,mv,nh,pl,ratebypass,source,upn,expire&mv=s&itag=22&signature=A1D19A4DB1134E4ADF3CCBE8DDD7F5B01AB995B4.C0790F1AB331B4C290E83C292F064F67B811C17E&mm=35&mn=sn-4g57km7s&upn=qNbx8hdMDaU&nh=EAY&id=o-AAR67WMXg6mE9K6QpXf981YZf0B51_Jz_kEGYVHT9hdz&mime=video/mp4&expire=1444936669&ipbits=0&fexp=9408710,9414764,9414929,9416126,9417259,9417707,9418162,9418203,9418400,9418802,9418907,9418997,9421584,9421945,9422338,9422428,9422587,9422900&ratebypass=yes&ip=144.76.168.167&lmt=1444877662206720&key=yt6&signature=
when I enter the url in browser , it opens the video a plays it .
I tried this code but I get a file with the size of 0 as the result :
$download_video_file = file_put_contents("file", fopen($url, 'x'));
How can I download and save video from youtube and save it in my webhost ?
thanks
Download Videos from youtube is a complex issue...
Basically, youtube will generate a key when you access the video page, that key is only valid for the ip of the device accessing the page.
Check the url you've posted for a variable called ip , it has the value 144.76.168.167, this means that you'll only be able to download the video from that ip.
As I said, it's complex and you may want to take a look at https://rg3.github.io/youtube-dl/ . It's opensource video downloader that supports 700+ sites including youtube and it's updated frequently by a huge community.
youtube-dl
youtube-dl is a small command-line program to download videos from
YouTube.com and a few more sites. It requires the Python interpreter
(2.6, 2.7, or 3.2+), and it is not platform specific. We also provide
a Windows executable that includes Python. youtube-dl should work in
your Unix box, in Windows or in Mac OS X. It is released to the public
domain, which means you can modify it, redistribute it or use it
however you like.
I am trying to get an audio stream (in mp3 format with fixed quality) from a YouTube video in PHP.
Notice that I cannot use FFMPEG and also i do not want to save the mp3 on my server, but I need only the audio stream (on the fly use).
Do you have any code or script? I have used many, but the half needs FFMPEG and the other saves the mp3 file in the server.
My plan is to hit on the browser:
http://host.com/process.php?url=<youtubeurl>
and get the audio stream in the page in variable that creating every time
&stream = ......;
It's not PHP, but we've open sourced a simple all-in-one node.js/CoffeeScript web app that can download a YouTube videos from a URL and then convert the video into an MP3 using ffmpeg.
github / demo / blog
Is there any possiblity to create a thumbnail of uploaded video file in php without using ffmpeg.
Most server side scripts rely on ffmpeg, so if you can't use that you can either upload the video to an external service but that would mean sending the whole file OR you could try creating them client-side in the browser -- Generate thumbnails from video files using HTML5's video tag and canvas
If however you can't use ffmpeg for installtion reasons you could look at a wrapper -- It currently provides FFmpeg-PHP emulation in pure PHP so you wouldn't need to compile and install the module.
In the past I have used this website to do video conversion and create thumbnails. It works very well and have both free and paid plans.
The system consists of several "robots" that do different jobs. These robots can read your videos if you put them in a public folder with an URI or Amazon S3 for example. The actions that the robot must do are defined in "templates" in JSON and have a PHP SDK. Have a look at the docs.
P.S: I'm not related with transloadit, seems like I am a commercial guy...
I have develop a media website to play video from Youtube by using jPlayer in PHP.
I have a problem with getting actual Youtube download link to make it play in my jPlayer.
Suppose that I have a Youtube link: https://www.youtube.com/watch?v=zpfNeFWA2vE and my actual download link is: http://o-o---preferred---hkg05s03---v12---nonxt5.c.youtube.com/videoplayback?upn=PnVtBEZ_KJw&sparams=cp%2Cgcr%2Cid%2Cip%2Cipbits%2Citag%2Cratebypass%2Csource%2Cupn%2Cexpire&fexp=919109%2C911646%2C920917%2C922401%2C920704%2C912806%2C913419%2C913558%2C913556%2C925109%2C912706&ms=nxu&expire=1348071130&itag=18&ipbits=8&gcr=kh&sver=3&ratebypass=yes&mt=1348046463&ip=119.15.90.10&mv=m&source=youtube&key=yt1&cp=U0hTTVBST19ISkNOM19ITFNCOmNBYVpWN2FtYXpn&id=ce97cd785580daf1&signature=74DF90D5D04F4DA2A2D588BDAFE777594673D2EE.64E845538B00C1FAA2E0AC043DAB5C512A49E45D&redirect_counter=1&cms_redirect=yes.
This actual url will expired on the next day.
Is there any method which I can paste only https://www.youtube.com/watch?v=zpfNeFWA2vE onto jPlayer or a script in either PHP or Javascript which can generate that actual link?
Note
I have download phptube from http://www.masnun.me/2011/05/17/phptube-a-php-class-to-get-download-links-from-youtube-watch-videos.html. It's working but when I download video from this generate link it said that "I don't have permission to download this file. 403 Forbidden"
Thank for helping!
Are you making sure that when you generate the youtube download links with phptube you are also accessing them from the server (and not from the client machine)? You are allowed to access these download links only from the same machine that was used to generate them (the author of phptube states that right at the beginning of the article).
A solution would be to generate these links from your server. Then use the server to download the contents to it. Then use the downloaded file to display it to the user. The problem is that your server will have to use double the bandwidth and the process will need time. YouTube just won't let you share the download links directly.
I had the exact same problem! Than I found this:
http://navarr.me/ytaudio/?q=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DtvS5MLzJfAw&s=on&psize=s&theme=dark
the source: https://github.com/navarr/ytaudio/
This script is also creating a download link like phptube. But I can acces the video from my local pc!