Thursday, March 6, 2008

Command to convert any video file in to .flv file

Convert .FLV file
------------------------------------
system("ffmpeg -y -i '".$upFilePath."' -deinterlace -ar 22050 -ab 64 -ac 2 -aspect 4:3 -r 25 -f flv -b 650k -i_qfactor 0.71 -g 300 -s 320×240 $targetmovie",$retval);

Command to create thumbnail of video
----------------------------------------------------------
system("ffmpeg -y -i '".$upFilePath."' -vframes 1 -ss 00:00:10 -an -vcodec png -f rawvideo -s 270×270 '/var/www/vhosts/rooji.com/httpdocs/videoImageFiles/".$upFileName.".jpg'",$retval1);


----------------------------------------------------------------------------------------------



$select="SELECT * FROM ST_friends_video WHERE video_id=$video_id";
$rslt_video = $this->dbclass->select($select);

$videoClipPath = VIDEO_ROOT_PATH;
$imagepictime = "00:01";
$upFileName = $rslt_video[0]['video_file'];

$upFilePath = $videoClipPath.$upFileName;
$sourcemovie = VIDEO_ROOT_PATH.$upFileName;
$targetmovie = VIDEO_ROOT_PATH.$video_id.".flv";
$vfilename=$video_id.".flv";


system("ffmpeg -y -i '".$upFilePath."' -deinterlace -ar 22050 -ab 64 -ac 2 -aspect 4:3 -r 25 -f flv -b 650k -i_qfactor 0.71 -g 300 -s 320×240 $targetmovie",$retval);
//system("ffmpeg -y -i '".$upFilePath."' -vframes 1 -ss 00:00:10 -an -vcodec png -f rawvideo -s 270×270 '/var/www/vhosts/rooji.com/httpdocs/videoImageFiles/".$upFileName.".jpg'",$retval1);

if(file_exists($targetmovie))
{
@unlink($sourcemovie);
$sql_update = "UPDATE ST_friends_video SET video_file = '".$vfilename."' where video_id = '$video_id'";
$rslt_update = $this->dbclass->sql_query($sql_update);
return $rslt_update;
}
else
{
return false;
}