PHP tutorials,a way to getting some thing new in web

Followers

Powered by Blogger.

Sunday 17 August 2014

Getting Video Thumbnails in PHP using ffmpeg

No comments :
Developers always create awesome codes by knowing language deeply.He can create ideas to make new innovative system.In PHP,same thing happens.As you all know extensions of php.ffmpeg is one of popular extension of php to take images from video.

Now,you can create images of your video.The video can be mp4,wmv,mkv etc..But here some lines are different.I have created code for windows system and with ffmpeg.exe

Download ffmpeg.exe for windows and paste following code in your editor.




Code:
<?php

$ffmpeg = 'ffmpeg.exe';

//video dir
$video = 'song.mp4';

//where to save the image
$image = 'image.jpg';

//interval
$interval = 5;

//image size
$size = '320x240';

//ffmpeg command
$cmd = "$ffmpeg -i $video -deinterlace -an -ss $interval -f mjpeg -t 1 -r 1 -y -s $size $image 2>&1";       
$return = `$cmd`;
?>

if you want to define directory you can define it  with "/".



No comments :

Post a Comment