View Full Version : Conversion problem

11-25-2007, 11:40 AM
Hi Guys,

i have written a small upload a video and convert to .flv script but it's not working for some reason, the initial file is uploaded but the conversion isn't doing its stuff, can anyone see any problems at all:

## HTML form
echo ("<br />");
echo ("<fieldset>");
echo ("<legend>Upload Your Audition Video</legend>");
echo ("<form action=\"uploadvideo.php\" method=\"post\" enctype=\"multipart/form-data\" />");
echo ("<table width=\"600\" border=\"0\" bordercolor=\"#000000\" align=\"center\" cellpadding=\"5\" cellspacing=\"0\">");
echo ("<tr>");
echo ("<td align=\"center\"><b>Select an audition video to upload</b></td><td align=\"center\"><input type=\"file\" name=\"video\" size=\"50\" /></td>");
echo ("</tr>");
echo ("<tr>");
echo ("<td colspan=\"2\" align=\"right\"><input type=\"submit\" class=\"btn\" name=\"submit\" value=\"Upload Video\" /></td>");
echo ("</tr>");
echo ("</table><div id=\"notice\">Video formats you can upload are: <b>.avi .mov .wmv</b></div></form>");
echo ("</fieldset>");

## deal with the submission

## set up a few server variables
$ffmpeglocation = "/usr/bin/ffmpeg";

## set up file variables
$filename = $_FILES['video']['name'];
$filetemp = $_FILES['video']['tmp_name'];
$filesize = $_FILES['video']['size'];
$filetype = $_FILES['video']['type'];

## get the extension everything after the .
$fileextension = substr(strrchr($filename, "."), 1);

## make lower case
$filenamelowercase = strtolower($fileextension);

## now we have the files extension do some checking
//if($fileextension != 'avi' || $fileextension != 'mov' || $fileextension != 'wmv') {
// stderr("Error","That file isn't one of the allowed types, look above for the proper files to upload.");
// include("includes/footer.php");
// exit;

## no video uploaded
if($filesize <= 0) {
stderr("Error","No video file was selected for uploading.");

## start processing stuff vars first
$uploadedmoviesdir = "movies/$filename";
$outputflvdirectory = "flvfiles/video.flv";

## move the uploaded file
if(move_uploaded_file($filetemp,$uploadedmoviesdir)) {
stderr("Success","Your video file has been uploaded.");

## ffmpeg encoding
$encode_cmd = "/usr/bin/ffmpeg -i $uploadedmoviesdir -acodec mp3 -ar 22050 -ab 32 -f flv -author \"Clip Author\" -copyright \"Clip Copyright\" $outputflvdirectory";


cheers guys


11-25-2007, 02:00 PM
change your exec line to

exec($encode_cmd, $output);

That should give you some info.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum