04 May, 2010

PHP Video Conversion & Thumbnail -- FFMPEG

To convert video to flv format add the following code:
$source = "path/somesource.mpg";
$destination = "path/somefilename.flv";
exec("/path/to/ffmpeg -i $source -ab 128 -ar 22050 -b 300000 -r 25 -s 320×240 $destination");

And to generate video first-frame thumbnail, add the following code:
exec("/path/to/ffmpeg -i $source -ss 1.4 -vframes 1 -f image2 $screenshotImg");

No comments: