chanchelkumar Posted March 7, 2008 Share Posted March 7, 2008 Hi all, i want to convert the video files to flv.. ie upload any type of files it converts this to flv... i search a lot and find out that this happen only with support FFmpeg.. and i got it... i got a code tooo. the problem is now this code is converting files.. but it gives me empty file .. there is no problem with images or audio files... only video files are having this problem this is my code... please help me.. it wil be grateful if any body give me a solution... <?php ini_set( "max_execution_time", "3600" ); // sets the maximum execution time of this script to 1 hour. $fileName = $_FILES['message']['name']; // get client side file name if( $fileName ) { // Check File Type $fileNameParts = explode( ".", $fileName ); // seperate the name from the ext $fileExtension = end( $fileNameParts ); // part behind last dot $fileExtension = strtolower( $fileExtension ); // reduce to lower case if( !$fileExtension == "mp3" ) { die( "$fileName is not an mp3 file." ); } // Check File Size $fileSize = $_FILES['message']['size']; // size of uploaded file if( $fileSize == 0 ) { die( "Sorry. The upload of $fileName has failed. The file size is 0." ); } else if( $fileSize > 10240000 ) { //10 MB die( "Sorry. The file $fileName is larger than 10MB. Advice: reduce the file quality and upload again." ); } else { $uploadDir = '/home/yourdomain.com/httpdocs/audio/audio_to_encode/'; // Where the temp file will go $uploadFile = str_replace( " ", "", $uploadDir . $_FILES['message']['name'] ); // Get rid of spaces in the filename $finalDir = '/home/yourdomain.com/httpdocs/audio/flv_files/'; // Where the final file will go $finalFile = str_replace( " ", "", $finalDir . $fileNameParts[0] . ".flv" ); // Get rid of spaces in the filename if ( !move_uploaded_file( $_FILES['message']['tmp_name'], $uploadFile ) ) { echo "Possible file upload attack! Here's some debugging info:\n"; echo( $_FILES ); } $encode_cmd = "/usr/bin/ffmpeg -i $uploadFile -f flv -acodec mp3 -ab 64 -ac 1 -title \"Clip Title\" -author \"Clip Author\" -copyright \"Clip Copyright\" $finalFile"; exec( $encode_cmd ); unlink( $uploadFile ); chmod( $finalFile, 0644 ); } } ?> Thanks in advance!!!!!!! Quote Link to comment Share on other sites More sharing options...
chanchelkumar Posted March 7, 2008 Author Share Posted March 7, 2008 Any body to help me here?????? Quote Link to comment Share on other sites More sharing options...
chanchelkumar Posted March 8, 2008 Author Share Posted March 8, 2008 ??? ??? ??? ??? ??? Quote Link to comment Share on other sites More sharing options...
corbin Posted March 8, 2008 Share Posted March 8, 2008 Try echoing out $encode_cmd and then running it manually your self..... Then see what error ffmpeg says. Quote Link to comment 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.