0

On my home page I have 4 embedded videos. To reduce loading time I would like to generate thumbnails that link to an other page with the real embedded video.

How can I generate these thumbnails?

Noting that :

  • embedded videos come from several video shraing websites (dailymotion, youtube, vimeo or for example : this video ...)
  • videos are added dinamicaly every day by the site administrator and he can't make the thumbnail manualy for each video.
web-tiki
  • 99,765
  • 32
  • 217
  • 249
  • Video sharing websites already provide solutions for that. youtube example : http://google.about.com/od/youtube/ss/embed-share-YouTube-videos.htm – TCHdvlp Dec 11 '13 at 10:25
  • yes but the embedded videos come from several websites like this video : http://www.letelegramme.fr/fil_region/fil_bretagne/landerneau-les-pompiers-demenagent-21-05-2013-2109919.php that don't provide a solution for that. – web-tiki Dec 11 '13 at 10:29
  • as Dan said, the thumbnails is provided by the video site. If you are trying to autogenerate a thumbnail for any video, I wish you good luck. If you just want to create a embeded mechanism, you can see that most of the embeded videos are flash players, built like this `
    ...` This can be a cule.
    – TCHdvlp Dec 11 '13 at 10:41
  • ok, I'll have to find a way to retrieve those thumbnails for each video sharing website. – web-tiki Dec 11 '13 at 10:47

2 Answers2

1

Keep in mind, embedded videos from other sites don't really slow load time. When embedding video from another site like YouTube, it's usually flash, and it shows the thumbnails inside the player, and the video doesn't load until the user clicks play. I know at least YouTube has predictable thumbnail image locations if you just wanted the graphic. They can be found at

http://img.youtube.com/vi/<insert-youtube-video-id-here>/0.jpg
http://img.youtube.com/vi/<insert-youtube-video-id-here>/1.jpg
http://img.youtube.com/vi/<insert-youtube-video-id-here>/2.jpg
http://img.youtube.com/vi/<insert-youtube-video-id-here>/3.jpg
Dan Goodspeed
  • 3,484
  • 4
  • 26
  • 35
  • thanks for the reply, the problem is that the videos can come from many different websites like the example I gave in my question. and they don't provide those thumbnails. – web-tiki Dec 11 '13 at 10:39
  • What is wrong with just using each site's own embedding thumbnails instead of images? – Dan Goodspeed Dec 11 '13 at 10:42
  • in fact they do provide the thumbnails. I'll have to find a way to retrieve the thumbnails form each video sharing website, that is going to be a hassle... – web-tiki Dec 11 '13 at 10:46
  • "... and they don't provide those thumbnails..." => "...in fact they do provide the thumbnails..." So ? When you embed a video, you don't have to manage the thumbnail, the providing site will do it for you. – TCHdvlp Dec 11 '13 at 10:51
  • For vimeo - http://stackoverflow.com/questions/1361149/get-img-thumbnails-from-vimeo , from Dailymotion - http://stackoverflow.com/questions/13173641/how-to-get-the-video-thumbnail-from-dailymotion-video-from-the-video-id-of-that . That combined with the YouTube links above ought to handle it for ya, right? – Dan Goodspeed Dec 11 '13 at 10:52
1

this can help you if you need posters / thumbnails of your local videos try this link and this can also help here is described how can we get poster image , size,length,title of videos using ff-mpeg in php

function captureVideoPosterImg($movie_file = '')
{
    extension_loaded('ffmpeg');
    $movie_file = 'E:\wamp new\www\projects\indiemade_live\developer\uploads\comments\11\14\video\04072011094613_24062011234404_s Sporting Goods- Teams Come Alive.flv';
    // Instantiates the class ffmpeg_movie so we can get the information you want the video  
    $movie = new ffmpeg_movie($movie_file);  
    // Get The duration of the video in seconds  
    echo $Duration = round($movie->getDuration(), 0);  
    // Get the number of frames of the video  
    $TotalFrames = $movie->getFrameCount();  
    // Get the height in pixels Video  
    $height = $movie->getFrameHeight();  
    // Get the width of the video in pixels  
    $width = $movie->getFrameWidth();  
    //Receiving the frame from the video and saving 
    // Need to create a GD image ffmpeg-php to work on it  
    $image = imagecreatetruecolor($width, $height);  
    // Create an instance of the frame with the class ffmpeg_frame  
    $Frame = new ffmpeg_frame($image);  
    // Choose the frame you want to save as jpeg  
    $thumbnailOf = (int) round($movie->getFrameCount() / 2.5);  
    // Receives the frame  
    $frame = $movie->GetFrame($thumbnailOf);  
    // Convert to a GD image  
    $image = $frame->toGDImage();  
    // Save to disk.  
    //echo $movie_file.'.jpg';
    imagejpeg($image, $movie_file.'.jpg', 100);

    return $movie_file.'.jpg';
}
Ravinder Payal
  • 2,884
  • 31
  • 40
  • 1
    While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. – Shiva Saurabh Feb 09 '14 at 07:50
  • i have gived some info about what the page contains and also code – Ravinder Payal Feb 10 '14 at 03:20