Hi
I am trying to convert videos in some format into flv using ffmpeg. The converted video that is create is 0 kb. I need some help to get it working thanks.
This is the code:
<?Php
function makeMultipleTwo ($value){
$sType = gettype($value/2);
if($sType == "integer"){
return $value;
} else {
return ($value-1);
}
}
$srcFile = "Videos/robot.avi";
$destFile = "Videos/robot.flv";
$ffmpegPath = "ffmpeg";
$flvtool2Path = "flvtool2";
$ffmpegObj = new ffmpeg_movie($srcFile);
$srcWidth = makeMultipleTwo($ffmpegObj->getFrameWidth());
$srcHeight = makeMultipleTwo($ffmpegObj->getFrameHeight());
$srcFPS = $ffmpegObj->getFrameRate();
$srcAB = intval($ffmpegObj->getAudioBitRate()/1000);
$srcAR = $ffmpegObj->getAudioSampleRate();
$command = $ffmpegPath . " -i " . $srcFile . " -ar " . $srcAR . " -ab " . $srcAB . " -f flv -s " . $srcWidth . "x" . $srcHeight . " " . $destFile . " | " . $flvtool2Path . " -U stdin " . $destFile;
$convert = exec($command);
if(!$convert){
echo "FAILED!!!";
}
?>
I must say I do not have flvtools on my server but I guess it does not matter as flvtools is only used for getting meta data.
Thanks.
+ Reply to Thread
Results 1 to 7 of 7
-
-
Output the $command and try it manually from the command line and see if any error message.
-
Hi
ERROR: /usr/bin/flvtool2:2
This is the error I recieve like I said I dont have flvtool on my server plan but did not think it matter as its only used for meta data.
I also do not know how to modify my code not to include flvtools in the command.
Hope you can help:
Thanks -
The obvious thing to try is to replace
PHP Code:$command = $ffmpegPath . " -i " . $srcFile . " -ar " . $srcAR . " -ab " . $srcAB . " -f flv -s " . $srcWidth . "x" . $srcHeight . " " . $destFile . " | " . $flvtool2Path . " -U stdin " . $destFile;
PHP Code:$command = $ffmpegPath . " -i " . $srcFile . " -ar " . $srcAR . " -ab " . $srcAB . " -f flv -s " . $srcWidth . "x" . $srcHeight . " " . $destFile;
-
Hi I modified the code as you said, but for some reason the code does not convert any thing and no error is printed out before the file would convert but have 0kb.
this is the code.
function makeMultipleTwo ($value){
$sType = gettype($value/2);
if($sType == "integer"){
return $value;
} else {
return ($value-1);
}
}
$srcFile = "Videos/robot.avi";
$destFile = "Videos/robot.flv";
$ffmpegPath = "ffmpeg";
$ffmpegObj = new ffmpeg_movie($srcFile);
$srcWidth = makeMultipleTwo($ffmpegObj->getFrameWidth());
$srcHeight = makeMultipleTwo($ffmpegObj->getFrameHeight());
$srcFPS = $ffmpegObj->getFrameRate();
$srcAB = intval($ffmpegObj->getAudioBitRate()/1000);
$srcAR = $ffmpegObj->getAudioSampleRate();
$command = $ffmpegPath . " -i " . $srcFile . " -ar " . $srcAR . " -ab " . $srcAB . " -f flv -s " . $srcWidth . "x" . $srcHeight . " " . $destFile;
$convert = exec($command);
if(!$convert){
echo "FAILED!!!";
}
print_r($convert);Last edited by Tonybot; 7th Jun 2011 at 04:56.
Similar Threads
-
Windows , PHP, ffmpeg , flvtool2 to convert and stream video on website
By jeffshead in forum Video ConversionReplies: 26Last Post: 4th Jan 2012, 07:49 -
Ffmpeg N/A video conversion problem
By livestream in forum Video ConversionReplies: 3Last Post: 15th Sep 2011, 16:17 -
solved = struggling to get ffmpeg-php to compile
By richiedood in forum Video ConversionReplies: 30Last Post: 12th Jul 2011, 20:39 -
php-ffmpeg video conversion
By Tonybot in forum ProgrammingReplies: 1Last Post: 6th Jun 2011, 02:36 -
php error - viewforumlatest.php?topicdays=1&start=100
By offline in forum FeedbackReplies: 9Last Post: 29th May 2008, 22:52