Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Jul 2007
    Location
    Scotland
    Posts
    134
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Conversion problem

    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 Code:
    <?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

  • #2
    Senior Coder NancyJ's Avatar
    Join Date
    Feb 2005
    Location
    Bradford, UK
    Posts
    3,169
    Thanks
    19
    Thanked 65 Times in 64 Posts
    change your exec line to

    PHP Code:
      exec($encode_cmd$output); 
      
    print_r($output); 
    That should give you some info.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •