Jump to content

FFmpeg converting to flv but with 0 file size

- - - - -

  • Please log in to reply
2 replies to this topic

#1
HemZone

HemZone

    Newbie

  • Members
  • Pip
  • 4 posts
I'm having problems regarding conversion of video to flv format. Below is my command

for conversion, but it seems to convert the video to flv but the file size remains 0

KB, what could be the problem, please suggest.

My command:

$command =$ffmpegPath . " -i " . $srcFile . " -ar " . $srcAR . " -ab " . $srcAB . "

-f flv -s " . $srcWidth . "x" . $srcHeight . " " . $destFile . " | " . $flvtool2Path

. " -U stdin " . $destFile;

Please Help me ASAP. It's urgent

Thanks in advance

Regards
Hem

#2
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,124 posts
  • Location:Vancouver, Eh! Cleverness: 200
Have you tested the command generated (i.e. "echo $command") on the command line to see if it runs without error?

PHP will not dump absolutely everything generated, it also depends on how you run it (you only have a variable in your script!) however PHP should be completely fine with commands such as that.

Alexander.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.

#3
HemZone

HemZone

    Newbie

  • Members
  • Pip
  • 4 posts
Here is my PHP Code. Pl check it


<?php

echo $srcFile = "upload_v/El-Bahia-Video.mp4";
echo "<br>";
echo $destFile = "upload_v/El-Bahia-Video.flv";
echo "<br>";
$ffmpegPath = "/usr/bin/ffmpeg";
$flvtool2Path = "/usr/bin/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();
//$srcWidth = 320;
//$srcHeight = 240;
//$command = $ffmpegPath . " -i " . $srcFile . " -f flv -s " . $srcWidth . "x" . $srcHeight . " " . $destFile . " | " . $flvtool2Path . " -U stdin " . $destFile;

extension_loaded('ffmpeg') or die('Error in loading ffmpeg');


$command =$ffmpegPath . " -i " . $srcFile . " -ar " . $srcAR . " -ab " . $srcAB . " -f flv -s " . $srcWidth . "x" . $srcHeight . " " . $destFile . " | " . $flvtool2Path . " -U stdin " . $destFile;


$type='flv';
$size='1280x720';
$quality='450000';
$audio='11025';

if($type=="flv"){ $call="/usr/bin/ffmpeg -i ".$srcFile." -vcodec flv -f flv -r 30 -b ".$quality." -ab 128000 -ar ".$audio." -s ".$size." ".$destFile;}

$convert = (popen($call." >/dev/null &", "r"));
pclose($convert);

function makeMultipleTwo ($value) {
$sType = gettype($value/2);
if($sType == "integer") {
return $value;
} else {
return ($value-1);
}
}
echo $convert = shell_exec($command);
if(!$convert)
{
echo "FAILED!!!";
}
else
{
echo "SUCCESS";
}


?>




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users