graham23s Posted November 25, 2007 Share Posted November 25, 2007 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: <?php ## 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 if(isset($_POST['submit'])) { ## 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."); include("includes/footer.php"); exit; } ## 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."); include("includes/footer.php"); exit; } ## ffmpeg encoding $encode_cmd = "/usr/bin/ffmpeg -i $uploadedmoviesdir -acodec mp3 -ar 22050 -ab 32 -f flv -author \"Clip Author\" -copyright \"Clip Copyright\" $outputflvdirectory"; exec($encode_cmd); } ?> cheers guys Graham Quote Link to comment https://forums.phpfreaks.com/topic/78777-conversion-problem/ Share on other sites More sharing options...
trq Posted November 25, 2007 Share Posted November 25, 2007 the initial file is uploaded but the conversion isn't doing its stuff Then I would suggest that htis is an ffmpeg issue and not that of php. Quote Link to comment https://forums.phpfreaks.com/topic/78777-conversion-problem/#findComment-398665 Share on other sites More sharing options...
rarebit Posted November 25, 2007 Share Posted November 25, 2007 Hi, i've had a play at the ffmpeg part and also having trouble. I've tried various commands but always get return code 1, not 0. I'm not sure if it's the user it's running as, I know it has other restrictions such as access raw sockets. I've thought of a few other way's to try, but for now you could look at http://ffmpeg-php.sourceforge.net/, but you'll probably need your host to install it, or to look through the source and see how they do it. p.s. since i've got a new laptop, i'm not fully installed, so only with a basic ffmpeg install, i got an error for the mp3 codec when i ran your cmd from the terminal, so since then i've just been using [$cmd = "/usr/bin/ffmpeg -i ".$fin." -f flv -author 'Clip Author' -copyright 'Clip Copyright' ".$fout;] Quote Link to comment https://forums.phpfreaks.com/topic/78777-conversion-problem/#findComment-398804 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.