only one Posted January 20, 2008 Share Posted January 20, 2008 Hi, I'm working on a page to convert a video file into a .flv file using ffmpeg. I found this script on the net and it didn't relly work, I've been trying to figure it out a few while now and it finnally uploads something but doesn't convert the file. <?php if(isset($_POST['submit'])) { $moviepath = "movies/"; $flvpath = "flvfiles/"; /***************Load FFMPEG *********************************/ $extension = "ffmpeg"; $extension_soname = $extension . "." . PHP_SHLIB_SUFFIX; $extension_fullname = PHP_EXTENSION_DIR . "/" . $extension_soname; // load extension if (!extension_loaded($extension)) { dl($extension_soname) or die("Can't load extension $extension_fullname\n"); } /*****************Get the path to Extention ****************/ $array_path = explode("/",$_SERVER['SCRIPT_FILENAME']); for ($i=0; $i < sizeof($array_path)-1; $i++) { if(isset($array_path[$i])) { $dynamic_path = $dynamic_path."/".$array_path[$i]; } } /******************Upload and convert video *****************************/ if(isset($_FILES["x_URL"])) { $fileName = $_FILES["x_URL"]["name"]; $fileNameParts = explode(".", $fileName ); $fileExtension = end( $fileNameParts ); if($fileExtension=="avi" || $fileExtension=="wmv" || $fileExtension=="mpeg" || $fileExtension=="mpg" || $fileExtension=="mov" ) { if ( move_uploaded_file($_FILES["x_URL"]["tmp_name"],$moviepath.$_FILES["x_URL"]["name"])) { if( $fileExtension == "wmv" ) { exec("ffmpeg -i /home/dtesters/public_html/".$moviepath."".$fileName."-sameq -acodec mp3 -ar 22050 -ab 32 -f flv -s 320x240 ".$dynamic_path."/".$flvpath."myflv.flv"); } if( $fileExtension == "avi" || $fileExtension=="mpg" || $fileExtension=="mpeg" || $fileExtension=="mov" ) { exec("ffmpeg -i /home/dtesters/public_html//".$moviepath."".$fileName."-sameq -acodec mp3 -ar 22050 -ab 32 -f flv -s 320x240 ".$dynamic_path."/".$flvpath."myflv.flv"); } /******************create thumbnail***************/ exec("ffmpeg -y -i ".$dynamic_path."/".$moviepath."".$fileName."-vframes 1 -ss 00:00:03 -an -vcodec png -f rawvideo -s 110x90 ".$dynamic_path."/".$flvpath."myflv.png"); }else { die("The file was not uploaded"); } }else { die("Please upload file only with avi, wmv, mov or mpg extension!"); } }else { die("File not found"); } } ?> <form name="frm" action="upload.php" method ="post" enctype="multipart/form-data" > <input name="x_URL" type="file" class="form1" size="26" /> <input type="submit" name="submit" value="upload" /> </form> Thanks for any help, O1R. Quote Link to comment https://forums.phpfreaks.com/topic/86928-ffmpeg/ 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.