rmail2006 Posted October 11, 2010 Share Posted October 11, 2010 Sorry if this is in the wrong section, wasn't too sure. I have been running FFMPEG on Windows 7 using Xampp. It's all set up and I can read the Wildlife.wmv file but it doesn't convert it. Here's my code: <?php // Set our source file $ffmpegPath = "C:\xampp\ffmpeg\ffmpeg.exe"; $flvtool2Path = "C:\xampp\flvtool2\flvtool2.exe"; // Create our FFMPEG-PHP class $ffmpegObj = new ffmpeg_movie('C:\xampp\htdocs\Video\uploads\Wildlife.wmv'); // Save our needed variables $srcWidth = makeMultipleTwo($ffmpegObj->getFrameWidth()); $srcHeight = makeMultipleTwo($ffmpegObj->getFrameHeight()); $srcFPS = $ffmpegObj->getFrameRate(); $srcAB = intval($ffmpegObj->getAudioBitRate()/1000); $srcAR = $ffmpegObj->getAudioSampleRate(); // Call our convert using exec() exec("ffmpeg -i wildlife.wmv -ar 22050 -ab 32 -f flv -s 1280x720 wildlife.flv"); // Make multiples function function makeMultipleTwo ($value) { $sType = gettype($value/2); if($sType == "integer") { return $value; } else { return ($value-1); } }?> I've heard people mentioning the exec might not be working. Is there anyway to get it working if so? Thanks Quote Link to comment Share on other sites More sharing options...
rmail2006 Posted October 11, 2010 Author Share Posted October 11, 2010 I've Cut down my code and added a check and it turns out the exec is working but its always failing. <?php exec("C:\xampp\ffmpeg\ffmpeg -i C:\xampp\htdocs\Video\video.wmv -ar 22050 -ab 32 -f flv -s 1280x720 C:\xampp\htdocs\Video\video.flv"); if ($result !== 0) { echo 'Command failed!<br>'; print_r($command_output); die(); } echo 'success!'; print_r($command_output);?> Quote Link to comment Share on other sites More sharing options...
rmail2006 Posted October 11, 2010 Author Share Posted October 11, 2010 Me again. I got the ffmpeg to convert my file from wmv to flv and it plays great but when it converts it it still comes up saying Command Failed! <?php exec('C:\xampp\ffmpeg\ffmpeg.exe -i C:\xampp\htdocs\Video\video.wmv -ar 22050 -ab 32 -f flv -s 1280x720 C:\xampp\htdocs\Video\video.flv'); echo $result.'<br/>'; if ($result !== 0) { echo 'Command failed!<br>'; print_r($command_output); die(); } echo 'success!'; print_r($command_output); ?> The problem is $result has no value in it when done so it will always say Command failed! Is there a proper way to check if it has converted? And the error before was the command to be executed should be wrapped in single quotations not double Thanks 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.