papaface Posted April 28, 2007 Share Posted April 28, 2007 Hello, I know this requires ffmpeg-php, but how do I actually do it with ffmpeg-php? I know the site for it but I don't know how to do this. Any help would be appreciated. regards Link to comment https://forums.phpfreaks.com/topic/49075-create-thumbnail-from-video/ Share on other sites More sharing options...
papaface Posted April 28, 2007 Author Share Posted April 28, 2007 Anyone? Link to comment https://forums.phpfreaks.com/topic/49075-create-thumbnail-from-video/#findComment-240471 Share on other sites More sharing options...
papaface Posted April 28, 2007 Author Share Posted April 28, 2007 Can nobody shed any light on this for me? Link to comment https://forums.phpfreaks.com/topic/49075-create-thumbnail-from-video/#findComment-240542 Share on other sites More sharing options...
taith Posted April 28, 2007 Share Posted April 28, 2007 as far as i'm aware, the GD librarys cannot work with video files... potentially animated gifs, but no movies Link to comment https://forums.phpfreaks.com/topic/49075-create-thumbnail-from-video/#findComment-240544 Share on other sites More sharing options...
papaface Posted April 28, 2007 Author Share Posted April 28, 2007 You can definately do this with ffmpeg-php. I just dont know how. Link to comment https://forums.phpfreaks.com/topic/49075-create-thumbnail-from-video/#findComment-240547 Share on other sites More sharing options...
TimGladieux Posted October 31, 2009 Share Posted October 31, 2009 The original thread was started and not answered some time ago,,, so... since I actually surfed in here looking for a similar question... Maybe this will help some one. This is how you do it with ffmpeg and php: function makeThumbnails($dir){ if (is_dir($dir)) { if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { if($file != "." && $file != ".." && eregi(".mp4", $file)) { $file='/'.$file; $command = "ffmpeg -i " . $dir . $file . " -vcodec mjpeg -vframes 1 -an -f rawvideo -s 320x240 -ss 00:00:10 " . $dir . str_replace(".mp4", ".jpg", $file) ; return exec("$command"); }//end if }//end while closedir($dh); }//end if handle $dh }//end if dir return TRUE; }//end function makeThumnails() This of course will make a 320x240 jpg from a mp4 file from the frame 10sec into the movie ffmpeg is quite powerful it will use pretty much any video container/codec, just change those parts. (oh yeah the function returns a boolean and the while loop means it keeps doing it while there is another movie in the dir to make a thumbnail for! I guess that's pretty obvious. If you take the "command" out and run it in a terminal with the variables $dir and $file changed to indicate the movie, etc. it will just make one!) Link to comment https://forums.phpfreaks.com/topic/49075-create-thumbnail-from-video/#findComment-948219 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.