0

Possible Duplicate:
How to create thumbnails or preview for videos?

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

Community
  • 1
  • 1
rajanikant
  • 179
  • 2
  • 3
  • 5

2 Answers2

3

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

Adelf
  • 706
  • 4
  • 12
3

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
  • 6,064
  • 15
  • 62
  • 95
  • but how i install FFMPEG – rajanikant Feb 15 '10 at 11:04
  • 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 Feb 15 '10 at 12:01
  • i tried ffmpeg -i f:\Videos\amazing_mccullum_catch.flv -r 1 -t 00:00:30 -f image2 -s 120x72 /withfr/tnails/final%01d.png and also ffmpeg -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.png to get a single frame as a thumbnail from the 30th second of the video, but it returned more than one image.. why? – Vijay Mar 18 '10 at 06:52
  • may be u have used it in loop.... – Avinash Mar 18 '10 at 07:20
  • No i haven't used a loop i just tried it in the command line client. But produced too many images – Vijay Mar 18 '10 at 08:38