0

Hi
I am using a php script for converting avi,mpeg files to flv with ffmpeg.my code is

$srcFile = "uploads/flame.avi";
    $destFile = "uploads/flame.flv";
    $ffmpegPath = "/usr/bin/ffmpeg";
    $flvtool2Path = "/usr/bin/flvtool2";
				
    $ffmpegObj = new ffmpeg_movie($srcFile);
    $srcWidth = 320;
    $srcHeight = 240;
    $command = $ffmpegPath . " -i " . $srcFile .  " -f flv -s " . $srcWidth . "x" .      $srcHeight . " " . $destFile . " | " . $flvtool2Path . " -U stdin " . $destFile;
    $convert = exec($command);
    if(!$convert)
    {
	echo "FAILED!!!";
    }
    else
    {
        echo "SUCCESS";
    }

I can create a flv file using this script.But sometimes it creates a flv file with size 0 k.I don't know why this is happening.With the same avi file,sometimes it creates correct flv file and sometimes flv with size 0k.How can I confirm whether the conversion is success. In both the cases it displays SUCCESS.

2
Contributors
2
Replies
4
Views
5 Years
Discussion Span
Last Post by alimziyan
0

exec() won't give you TRUE or FALSE on the command executed, will simply return an output, and only if you add a second parameter. For example:

<?php
echo exec('ls',&$ot) . "\n";
print_r($ot) . "\n";
?>

So, you need to see what is going on during the conversion. Try to use system(), you will get all the output.

Edited by cereal: n/a

0

Thanks for your reply..But may I know why ffmpeg command produces strange result.Sometimes it neatly converts avi to flv.
And sometimes the same avi is converted to 0 size flv..Is anything wrong in my ffmpeg command

Edited by alimziyan: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.