I have various video hosts that I like to use on my website. I am trying to code a way to retrieve their video thumbnails.
Most of these video hosts actually have a frame of the video on display before the video starts to play. If it's possible to even get that frame as the thumbnail, that would be great. Most if not all of these video hosts use iframes for embedding.
I am looking for a fairly generic way of retrieving thumbnails for all video hosts that display some type of frame from the video once the video is embedded. If that frame can somehow be retrieved and then turned into an image that can be used that would be amazing. However, I am not exactly sure how to go about doing that.
You'd have to have the actual binary file data. If you have that access, install ffmpeg-php on your server and use this question for further direction: ffmpeg to get screenshot
Depends on the site.
For example, if you have a youtube video
http://www.youtube.com/watch?v=AC2FKbyC28k
then its thumbnail is at
http://i2.ytimg.com/vi/AC2FKbyC28k/mqdefault.jpg
I found this out by right clicking the image thumbnail, opening it in a tab and inspecting the url, so I'm sure you can do this exhaustively for every site ;)
It sounds like what you want is oEmbed, which is supported by most popular video hosting sites (Youtube, Vimeo, ...). There are several PHP oEmbed libraries, which come preconfigured with oEmbed endpoints.
What oEmbed allows you to do is to make a request to the provider (Youtube for example) with the video URL. It will return a JSON response with information about the video. Both Youtube and Vimeo return a thumbnail_url element in the JSON.
Related
This is a progress after the question Embedding Image/Video Stream into webpage that was answered for the picture only using curl, video is still an open issue.
Resuming, I need to avoid that the visitor of a web page see the real source of an image streming. So I want to embed the video a some wrapper php page that doesnt use any userid/password but is under my control. Embedding the video stream into any HTML page it's really easy:
<img src="http://5.246.77.89:8090/videostream.cgi?user=stack&pwd=overflow&resolution=32&rate=15" alt="">
For some time I'll give you the opportunity to test the source of the video streaming that I want to hide here
http://93.58.198.189:8090/videostream.cgi?user=stack&pwd=overflow&resolution=32&rate=15
Now all I need is a simple web page let say video.php that is able to stream the video without asking credentials and hiding the original source IP, something like
<img src='my.php'>
How can I obtain this behavior?
Note that despite the source is a video stream, the header is image/jpeg as you can see by yourself and it works with any browser. I've tried to use
<?php
header("content-type:image/jpeg");
passthru("http://93.58.198.189:8090/videostream.cgi?user=stack&pwd=overflow&resolution=32&rate=15");
?>
but for some reason doesn't work. Any idea?
Good question, i was also had a same problem.
Now its solved for me. just you can go to you tube video url where your video is stored and below the video there is share ad embed, you go to embed and there you will get a url which can be embeded to your video.php. it works.
Now, I am encountering some difficulties when I have to scan or crawl a video URL link. This web page is using the Flash-based technology to embed the video and stream video.
In order to understand more clearly, this is a link example:
http://vnexpress.net/gl/the-gioi/tu-lieu/2012/11/bai-phat-bieu-thua-nhan-that-bai-cua-romney/
The above link has below content (HTML code for Flash embedded video):
<div id="flashContent" style="text-align:center;width:100%;">
<span id="FlashPlayer79237" class="Normal" align="center">Bạn cần cài Flash Player để xem được Clip này.</span>
</div>
In this above article, there is a above video. However, when I tried to scan or crawl the content, the video could not run properly (because it could not load correct video link) and only show Install Flash Player plugin words (Certainly, the real web page needs to run some Javascript script or Flash script to obtain the real video link and stream this video for users)
Therefore, how can I render Flash and Javascript script through PHP or ASP.NET or Java? How can I get the correct video link when I crawl the web page? In this case, how can I obtain the correct Flash embedded video (HTML code)?
Thank you so much.
Before I answer, I want to make a note that if you need this information to do anything shady... please don't.
Disclaimer aside, for that particular site it is relatively easy.
The flashvars param (which is probably put there by Javascript) contains a value called xmlPath, which is a url encoded path (relative to their domain name). If you grab that and decode it, you get something like:
/Service/FlashVideo/PlayListVideoPage.asp?id=79237&f=108&t=1
which points to
http://vnexpress.net/Service/FlashVideo/PlayListVideoPage.asp?id=79237&f=108&t=1
If you read that, it's an XML file which contains the URL of the actual video.
I'm not quite sure where that value is generated from. If you needed to do this fully server-side, you could use a headless browser to process it.
i made a script to upload videos to youtube from a folder on my server, but now i want a way to control the overlay ads. i saw a video that has just like what i want.
here is the video link:
http://www.youtube.com/watch?v=_v0JoEarI8s
is there any way to do that?
I think that the Call-to-Action overlays can not be managed from the API
https://groups.google.com/forum/?fromgroups=#!topic/youtube-api-gdata/wyUoI9S2c0M
Apparently can only be configured manually
http://support.google.com/youtube/bin/answer.py?hl=en&answer=150471
Recently stumbled upon a stock video footage site http://www.pond5.com/stock-video-footage/1/*.html , and saw that they had a preview of a video when the user hovered over a thumbnail. I want to recreate this, because it seems like useful practice and it will allow me to workout my web developing muscles.
I would like to be able to preview a video when a user hovers over a thumbnail.
For example like pond5.com. Audio is not necessary, but I would like it to look smooth like a video rather than a video preview that contains a frame every 5 seconds.
On pond5.com, I originally thought they used a gif, but it plays very smoothly. Some also contain audio. As far as I thought, audio can't be used in .GIFs
Is this a case where I would have to just upload a 2nd video for the preview?
Thank you for any help.
Pond5, the website you specifically mentioned, creates a video thumbnail with watermark and lowered quality and stores it. It is then played back using JavaScript to dynamically load a div element that contains the flash player. So no GIFs are involved. You do need to upload a 2nd video, but the steps to this project are as follows:
Server-side video thumbnail/watermarking: Not sure if there are any PHP packages that are up to the task on this one. I would write a more powerful program in C++ or C#. If you go with C#, quick and easy solution would be Microsoft Expression Encoder.
Flash/Silverlight/HTML5 video player: To play the video.
Client-side JavaScript: To load the fancy popup and the aforementioned video player. Note that you might need to use PHP and a database engine to load the thumbnail URL for the video requested.
This is what Pond5, and what many other stock-footage sites use, and the basic outline of what you would need to do to achieve similar results.
I'm creating a site with a lot of embedded Youtube videos, but it seems the video players take a while to load. Is there a way I could speed things up?
If this is not possible, then how do you embed just the thumbnails and load the videos when a user clicks on the thumbnail?
About your first question:
You cannot control the load speed because the videos are not hosted on your server but on Youtube's one.
About your second question:
You can check this address in order to find out how to extract the thumbnails from the youtube videos: http://www.reelseo.com/youtube-thumbnail-image/
After that you can load the youtube video on onclick using Ajax or simple redirect to a separate page where video is positioned.