/ Published in: PHP
URL: http://itwigle.com/twig/Capturing_video_thumbnails_with_PHP
Expand |
Embed | Plain Text
function captureVideoPosterImg($movie_file = '') { $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 // 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 // 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'; } Ref : http://itwigle.com/twig/Capturing_video_thumbnails_with_PHP
You need to login to post a comment.
