I am curious if there is a php script or a program that will allow me to generate a thumbnail either .png or .jpg of the flv file but also so that this flv file doesn't have to be local on my machine. So i can just give it the url of the .flv file and it will generate a thumbnail of this flash file. If anyone knows of a way that this can be done please let me know. thanks.
i know it is posible using this tool: ffmpeg, but i am not sure how http://gallery.menalto.com/node/57821 ------------------------------------------ www.equipo24.com
That is fairly simle if you have ffmpeg installed on server Include code somewhere in code. $ffmpegpath = "/usr/bin/ffmpeg"; function make_jpg($input, $output, $fromdurasec="01") { global $ffmpegpath; if(!file_exists($input)) return false; $command = "$ffmpegpath -i $input -an -ss 00:00:$fromdurasec -r 1 -vframes 1 -f mjpeg -y $output"; @exec( $command, $ret ); if(!file_exists($output)) return false; if(filesize($output)==0) return false; return true; } Code (markup): ffmpeg ath may vary on servers, ask your server team if it is really '/usr/bin/ffmpeg'. Usage: #extract frame at 00:00:01 as jpeg make_jpg("/test.flv", "/test.jpg", "01"); Code (markup): What is php4flv ? never heard of it. I hope it helps.
my server does not allow me to excute exec() ! also how i can check my server for ffmpeg existance ? that's a mistak here is it : http://code.google.com/p/flv4php/
The other way is if you have php_ffmpeg extension installed, that is less resources consuming way of extracting screenshost. You will have to ask your host if they have ffmpeg amongst installed modules. regards
this script works fine. but how can i modify ths script to make a thumbnail on a fly. i mean i want to use it ths way <img src="thumbnail.php?file=video.flv&percentage=60" /> HTML:
Place the script into a php file called thumbnail.php insert a random string generator to create a nice random filename (and also check that it doesn't already exist) add a jpg file extension to the random string and use as the output variable for the "make_jpg" function. grab and sanitise the GET parameter for 'file' and use as input (create a static variable for the file system path to the flv) you might want to grab a url paramter for the timecode to take the thumbnail from or make a static one. Once passed in through the make_jpg function set the HTTP Header to reflect that you are going to return image data instead of Hypertext and then print the thumbnail to the screen. Job done. P.S, almost forgot. Thanks for the code snippet Vooler, really useful