coverting video files to flv
coverting video files to flv
<?php
include_once("db.php");
include_once("dbcon.php");
session_start();
function GetExt($Filename)
{
$Extension = explode(".", $Filename);
$Extension_i = (count($Extension) - 1);
return $Extension[$Extension_i];
}
// How to use it
if(isset($_POST) && isset($_FILES))
{
$title=$_POST['title'];
$desc=$_POST['desc'];
$keywords=$_POST['keywords'];
switch ($_POST['category']) {
case 1:
$imgcat = "animals/pets"; break;
case 2:
$imgcat = "people"; break;
case 3:
$imgcat = "travel"; break;
case 4:
$imgcat = "children"; break;
case 5:
$imgcat = "sports"; break;
case 6:
$imgcat = "nature"; break;
case 7:
$imgcat = "action"; break;
case 8:
$imgcat = "humor"; break;
case 9:
$imgcat = "portraiture"; break;
case 10:
$imgcat = "other"; break;
}
if(isset($_FILES['videofile']['name']))
{
ini_set("post_max_size", "25M");
ini_set("upload_max_filesize", "25M");
ini_set("memory_limit", -1 );
ini_set("max_input_time", -1);
set_time_limit(0);
$vid_file=str_replace(" ","_",$_FILES['videofile']['name']);
if(!empty($vid_file))
{
$ext=GetExt($vid_file);
$flv_filename=substr($vid_file,0,(strlen($vid_file)-strlen(GetExt($vid_file))-1));
$imgpath=$flv_filename.".jpg";
$flv_filename.=".flv";
if($_FILES['videofile']['type']!="video/mpeg" && $_FILES['videofile']['type']!="video/x-msvideo" && $_FILES['videofile']['type']!="video/vnd.mpegurl" && $_FILES['videofile']['type']!="video/x-ms-wmv" && $_FILES['videofile']['type']!="video/x-ms-asf" && $_FILES['videofile']['type']!="video/x-flv" && $_FILES['videofile']['type']!="video/quicktime" && $_FILES['videofile']['type']!="video/x-ms-wvx")
{
$msg="Image File must be mpeg, mpg, mpa, avi, m4u, wmv, wmv3, asx, flv, mov, wvx!!!";
header("Location: index.php?q=video_upld&msg=$msg");
exit();
}
/*if($_FILES['videofile']['size']>102400){
$msg="Your file exceeded to 100 KB !!!";
header("Location: index.php?q=video_upld&msg=$msg");
exit();
} */
$add = "video/".$vid_file;
if(move_uploaded_file($_FILES['videofile']['tmp_name'], $add))
{
echo "uploaded sucessfully";
}
else
{
echo "Unsuccessful";
}
chmod("$add",0777);
exec("ffmpeg -i ".$vid_file." -b 100k -ar 22050 -y video/".$flv_filename);
exec("ffmpeg -i ".$vid_file." -an -ss 00:00:10 -r 1 -vframes 1 -f mjpeg -y video/".$imgpath);
}
$type=$_FILES['videofile']['type'];
$size=$_FILES['videofile']['size'];
//print_r($_POST);
//print_r($_FILES);
$t=time();
$ins_video="insert into `pixyak`.`video` (title, description, member, keywords, category,
type, size, flvpath, path, imgpath, ext, cre_dt, mod_dt, status) values
('$title', '$desc', '".$_SESSION['user_name']."', '$keywords', '$imgcat', '$type', '$size', '$flv_filename', '$vid_file',
'$imgpath', '$ext', '$t', '$t', 'Active')";
//echo $ins_video;
mysql_query($ins_video);
if(mysql_affected_rows()==1)
{
$insId=mysql_insert_id();
if ($_POST['around']){
$country=addslashes($_POST['country']);
$city=addslashes($_POST['city']);
$desc1=addslashes($_POST['desc1']);
mysql_query("insert into world_vid values ('','".$insId."','".$_SESSION['user_name']."','','".time()."','0','".addslashes($title)."','".$desc1."','".$country."','".$city."',0,0,0)");
}
$msg="Video Uploaded Successfully";
header("location: index.php?q=video_upld&msg=$msg");
die();
}
else
{
$msg="Error: ".mysql_error();
header("location: index.php?q=video_upld&msg=$msg");
die();
}
//ob_flush();
}
}
else
{
//ob_flush();
$msg="Access Denied";
header("location: index.php?q=video_upld&msg=$msg");
die();
}
?>
include_once("db.php");
include_once("dbcon.php");
session_start();
function GetExt($Filename)
{
$Extension = explode(".", $Filename);
$Extension_i = (count($Extension) - 1);
return $Extension[$Extension_i];
}
// How to use it
if(isset($_POST) && isset($_FILES))
{
$title=$_POST['title'];
$desc=$_POST['desc'];
$keywords=$_POST['keywords'];
switch ($_POST['category']) {
case 1:
$imgcat = "animals/pets"; break;
case 2:
$imgcat = "people"; break;
case 3:
$imgcat = "travel"; break;
case 4:
$imgcat = "children"; break;
case 5:
$imgcat = "sports"; break;
case 6:
$imgcat = "nature"; break;
case 7:
$imgcat = "action"; break;
case 8:
$imgcat = "humor"; break;
case 9:
$imgcat = "portraiture"; break;
case 10:
$imgcat = "other"; break;
}
if(isset($_FILES['videofile']['name']))
{
ini_set("post_max_size", "25M");
ini_set("upload_max_filesize", "25M");
ini_set("memory_limit", -1 );
ini_set("max_input_time", -1);
set_time_limit(0);
$vid_file=str_replace(" ","_",$_FILES['videofile']['name']);
if(!empty($vid_file))
{
$ext=GetExt($vid_file);
$flv_filename=substr($vid_file,0,(strlen($vid_file)-strlen(GetExt($vid_file))-1));
$imgpath=$flv_filename.".jpg";
$flv_filename.=".flv";
if($_FILES['videofile']['type']!="video/mpeg" && $_FILES['videofile']['type']!="video/x-msvideo" && $_FILES['videofile']['type']!="video/vnd.mpegurl" && $_FILES['videofile']['type']!="video/x-ms-wmv" && $_FILES['videofile']['type']!="video/x-ms-asf" && $_FILES['videofile']['type']!="video/x-flv" && $_FILES['videofile']['type']!="video/quicktime" && $_FILES['videofile']['type']!="video/x-ms-wvx")
{
$msg="Image File must be mpeg, mpg, mpa, avi, m4u, wmv, wmv3, asx, flv, mov, wvx!!!";
header("Location: index.php?q=video_upld&msg=$msg");
exit();
}
/*if($_FILES['videofile']['size']>102400){
$msg="Your file exceeded to 100 KB !!!";
header("Location: index.php?q=video_upld&msg=$msg");
exit();
} */
$add = "video/".$vid_file;
if(move_uploaded_file($_FILES['videofile']['tmp_name'], $add))
{
echo "uploaded sucessfully";
}
else
{
echo "Unsuccessful";
}
chmod("$add",0777);
exec("ffmpeg -i ".$vid_file." -b 100k -ar 22050 -y video/".$flv_filename);
exec("ffmpeg -i ".$vid_file." -an -ss 00:00:10 -r 1 -vframes 1 -f mjpeg -y video/".$imgpath);
}
$type=$_FILES['videofile']['type'];
$size=$_FILES['videofile']['size'];
//print_r($_POST);
//print_r($_FILES);
$t=time();
$ins_video="insert into `pixyak`.`video` (title, description, member, keywords, category,
type, size, flvpath, path, imgpath, ext, cre_dt, mod_dt, status) values
('$title', '$desc', '".$_SESSION['user_name']."', '$keywords', '$imgcat', '$type', '$size', '$flv_filename', '$vid_file',
'$imgpath', '$ext', '$t', '$t', 'Active')";
//echo $ins_video;
mysql_query($ins_video);
if(mysql_affected_rows()==1)
{
$insId=mysql_insert_id();
if ($_POST['around']){
$country=addslashes($_POST['country']);
$city=addslashes($_POST['city']);
$desc1=addslashes($_POST['desc1']);
mysql_query("insert into world_vid values ('','".$insId."','".$_SESSION['user_name']."','','".time()."','0','".addslashes($title)."','".$desc1."','".$country."','".$city."',0,0,0)");
}
$msg="Video Uploaded Successfully";
header("location: index.php?q=video_upld&msg=$msg");
die();
}
else
{
$msg="Error: ".mysql_error();
header("location: index.php?q=video_upld&msg=$msg");
die();
}
//ob_flush();
}
}
else
{
//ob_flush();
$msg="Access Denied";
header("location: index.php?q=video_upld&msg=$msg");
die();
}
?>
Permissions in this forum:
You cannot reply to topics in this forum
Fri Jul 22, 2011 1:37 pm by shyamsunder
» Thousands of Free PHP Scripts Recommended
Wed May 18, 2011 10:33 am by bizboy12
» PHP form validation problem?
Wed Jan 12, 2011 1:25 pm by simy202
» string wrap
Sat Aug 02, 2008 2:06 pm by scvinodkumar
» retrieving current date rows
Tue Jul 15, 2008 3:25 am by scvinodkumar
» number in words
Tue Apr 29, 2008 3:10 pm by scvinodkumar
» Simple PHP Form Field Generator
Fri Apr 25, 2008 12:28 pm by scvinodkumar
» PHP password generator
Fri Apr 18, 2008 7:24 pm by scvinodkumar
» PHP Script to Extract Email Address from any text
Fri Apr 18, 2008 7:18 pm by scvinodkumar