tags:

views:

169

answers:

2

I have made video gallery . i want thumbnail of that video like youtube. how can i get that while uploading in php.

+3  A: 

http://ffmpeg-php.sourceforge.net/

Adelf
how to install it on window
rajanikant
Don't know if this will work while uploading but I still give +1 :)
AntonioCS
@rajanikant: Just download and copy it to the php extension dir and then on php.ini and an entry in the extension section (search for 'extension' and you will see how to do it for this extension)
AntonioCS
then give me idea for work while uploading
rajanikant
+2  A: 

Use below two lines for creating image from video using ffmpeg

$str_command= $ffmpeg  ." -i " . $image_source_path . $image_cmd .$dest_image_path;     
shell_exec($str_command);

Please find variable explanation at below:

$ffmpeg ="Document path to your ffmpeg";
$image_source_path = "Document path to your video"
$image_cmd = " -r 1 -ss 00:00:10 -t 00:00:01 -s ".ALL_PLACE_WIDTH."x".ALL_PLACE_HEIGHT."   -f image2 " ;
    Where ALL_PLACE_WIDTH ="width of the image you want"
    ALL_PLACE_HEIGHT ="heoght of the image you want"

$dest_image_path = "Document path to your image which is going to create"

This will capture image from your video after 10 second.

FFMPEG

Hope this helps.

Avinash
but how i install FFMPEG
rajanikant
Just download latest version from here.http://ffdshow.faireal.net/mirror/ffmpeg/ and place ffmpeg.exe in your folder structure any where you want, and give that path to above code in variable $ffmpeg. also i have added link for ffmpeg in my answer chk it.
Avinash
i triedffmpeg -i f:\Videos\amazing_mccullum_catch.flv -r 1 -t 00:00:30 -f image2 -s 120x72 /withfr/tnails/final%01d.pngand alsoffmpeg -i f:\Videos\amazing_mccullum_catch.flv -r 1 -t 00:00:01 -ss 00:00:30 -f image2 -s 120x72 /withfr/tnails/final%01d.pngto get a single frame as a thumbnail from the 30th second of the video, but it returned more than one image..why?
kvijayhari
may be u have used it in loop....
Avinash
No i haven't used a loopi just tried it in the command line client.But produced too many images
kvijayhari