Thursday, September 2, 2010

Working with php & ffmpeg

This the code for convert video using the ffmpeg.The php use the ffmpeg insstall in Linux system.
for the option please out the web site of ffmpeg



$uploadfile = "t1.3gp";
$uploadfile_flv = "video.flv";

//shell_exec('ffmpeg -i  '.$uploadfile.' -acodec libmp3lame -map_meta_data '.$uploadfile_flv.':'.$uploadfile.' -ar 22050 -ab 64000 -deinterlace -nr 500 -s 320x240 -aspect 4:3 -r 20 -g 500 -me_range 20 -b 200k -f flv -y '.$uploadfile_flv);

shell_exec('ffmpeg -i  '.$uploadfile.' -ar 22050 -ab 64000 -deinterlace -nr 500 -s 320x240 -aspect 4:3 -r 20 -g 500 -me_range 20 -b 200k -f flv -y '.$uploadfile_flv);

echo ('ffmpeg -i  '.$uploadfile.' -ar 22050 -ab 64000 -deinterlace -nr 500 -s 320x240 -aspect 4:3 -r 20 -g 500 -me_range 20 -b 200k -f flv -y '.$uploadfile_flv);


//$flvMetaUpdateCmd = "flvtool2 -U ".$uploadfile_flv;

$uploaddir = "./";
$png_file_name = "preview";

shell_exec("ffmpeg -i ".$uploadfile." -vcodec png -ss 00:00:05 -vframes 1 -an -f rawvideo -s 320x240 -y ".$uploaddir.$png_file_name.".png");

echo "

File Converted...";

?>

No comments:

Post a Comment