Location: PHPKode > projects > PHP Media Manager with IMDB > encode.php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
<title>All done! Get ready for lift-off</title>
<script type="text/javascript" src="swfobject.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="styles.css" rel="stylesheet" type="text/css" />
</head>
<body>
<p>Encoding started</p>
<?php
include 'config.php';
// retrieve useful strings
$get_filenames = mysql_query("select fname,filename from encoded where id = ".$_GET['id']." LIMIT 0,1");
while($row = mysql_fetch_assoc($get_filenames))
{
$filename = $row['filename'];
$fname = $row['fname'];
};
$extension = getExtension($filename);
$extension = strtolower($extension);

//  create sensible output file name
$filename1 = rtrim($fname,".".$extension); 

// Encoding
$flvname = $flvdir."/".$filename1.".flv";
$enc = $ffmpegpath."/ffmpeg -y -v debug -i \"".$filename."\" -ar 22050 -f flv ".$flvdir."\\".$id.".flv -vb ".$bitrate;
$meta = $ffmpegpath."/flvmdi ".$flvdir."\\".$id.".flv";

echo $enc;

if (!file_exists($flvname))
{
exec ($enc);
exec ($meta);
mysql_query("update encoded set success = 'yes',flvname='".$id.".flv' where id = ".$id."");
echo "
<SCRIPT language=JavaScript>
<!--
function win(){
window.opener.location.href=\"gen.php?id=".$id."\";
self.close();
//-->
}
</SCRIPT>

<input type=button onClick=\"win();\" value=\"Close this window and continue\" />
";
}
else
{
echo "Video already encoded (file exists), so playing cached version. To remove cached version contact sysadmin.";
echo "
<SCRIPT language=JavaScript>
<!--
function win(){
window.opener.location.href=\"gen.php?id=".$id."\";
self.close();
//-->
}
</SCRIPT>

<input type=button onClick=\"win();\" value=\"Close this window and continue\" />
";
}
?>
</body>
</html>
Return current item: PHP Media Manager with IMDB