conn.php
=======
include("function.php");
$config['BASE_DIR'] = '/home/vhosts/ena/biztech';
$config['BASE_URL'] = 'http://ena.pingworx.com/biztech';
$config['tmpimgpath'] = '/home/vhosts/ena/biztech/temp';
$config['tmpimgpath2'] = '/home/vhosts/ena/biztech/temp';
$config['ffmpeg'] = '/usr/local/bin/ffmpeg';
$config['mplayer'] = '/usr/local/bin/mplayer';
$config['mencoder'] = '/usr/local/bin/mencoder';
$config['metainject'] = '/usr/local/bin/flvtool2';
$config['guest_limite'] = 65535;
//$config['CONF_FILE'] = $config[BASE_DIR].'/include/conf.ini';
$config['IMG_DIR'] = $config[BASE_DIR].'/images';
$config['IMG_URL'] = $config[BASE_URL].'/images';
$config['VDO_DIR'] = $config[BASE_DIR].'/video';
$config['VDO_URL'] = $config[BASE_URL].'/video';
$config['ADO_DIR'] = $config[BASE_DIR].'/audio';
$config['ADO_URL'] = $config[BASE_URL].'/audio';
$config['FLVDO_DIR'] = $config[BASE_DIR].'/flvideo';
$config['FLVDO_URL'] = $config[BASE_URL].'/flvideo';
$config['TMB_DIR'] = $config[BASE_DIR].'/thumb';
$config['TMB_URL'] = $config[BASE_URL].'/thumb';
$config['baseurl'] = $config['BASE_URL'];
$config['basedir'] = $config['BASE_DIR'];
$config['vdodir'] = $config['VDO_DIR'];
$config['vdourl'] = $config['VDO_URL'];
$config['audiodir'] = $config['ADO_DIR'];
$config['audiourl'] = $config['ADO_URL'];
$config['flvdodir'] = $config['FLVDO_DIR'];
$config['flvdourl'] = $config['FLVDO_URL'];
$config['imgurl'] = $config['IMG_URL'];
$config['imgpath'] = $config['IMG_DIR'];
$config['tmbdir'] = $config['TMB_DIR'];
$config['tmburl'] = $config['TMB_URL'];
$config['img_max_width'] = 110;
$config['img_max_height'] = 90;
?>
upload.php
========
include("conn.php");
ob_flush();
ini_set("display_errors", "on");
ini_set("display_startup_errors", "on");
ini_set("set_time_limit", "0");
ini_set("memory_limit", "50M");
ini_set("upload_max_filesize", "10MB");
if(isset($_POST["Submit"]))
{
$vido="test";
if($_FILES[$vido]['tmp_name']!="")
{
$p=$_FILES[$vido]['name'];
$pos=strrpos($p,".");
$ph=strtolower(substr($p,$pos+1,strlen($p)-$pos));
$space = round($_FILES[$vido]['size']/(1024*1024));
$err = "";
if(($ph!="mpg" && $ph!="avi" && $ph!="mpeg" && $ph!="wmv" && $ph!="rm" && $ph!="dat" && $ph!="3gp" && $ph!="mp4" && $ph!="asf" && $ph!="mpeg4" && $ph!="divx" && $ph!="xvid" && $ph!="mov" && $ph!="flv"))
{
$err="Invalid Video Format.";
}
}
if($err=="")
{
$vid="123";
//$vdoname=rand().".".$ph;
$vdoname = "final_1".".$ph";
$fileup="test";
if(isset($_FILES[$fileup]['tmp_name']) && is_uploaded_file($_FILES[$fileup]['tmp_name']))
{
$ff = $config['vdodir']."/".$vdoname;
if(move_uploaded_file($_FILES[$fileup]['tmp_name'], $ff))
{
if($ph == "mov")
{
exec("/usr/local/bin/ffmpeg -i /home/vhosts/ena/biztech/video/final_1.mov -f flv -acodec mp3 -b 300 -r 29.97 -s 320x240 -an /home/vhosts/ena/biztech/flvideo/output_success_2.flv");
}
else
{
exec("/usr/local/bin/ffmpeg -i /home/vhosts/ena/biztech/video/final.mov -f flv -acodec mp3 -vcodec flv -ab 56 -ar 22050 -r 15 -s 320x240 -qmin 4 -qmax 10 /home/vhosts/ena/biztech/flvideo/output_final.flv");
}
exec("/usr/local/bin/ffmpeg -i /home/vhosts/ena/biztech/flvideo/output_success_2.flv -s 94x58 -ss 2 -vframes 1 -f mjpeg /home/vhosts/ena/biztech/thumb/flv_final.jpg");
}
}
}
}
?>
<form action="upload.php" method="post" enctype="multipart/form-data" name="form1" id="form1">
Upload Video File :
<input type="file" name="test" id="test">
</form>
Saturday, December 15, 2007
FFMPEG Integration with PHP
Posted by ArunK at 3:07 PM
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment