Go4Expert (http://www.go4expert.com/)
-   PHP (http://www.go4expert.com/forums/php/)
-   -   convert avi to flv (http://www.go4expert.com/forums/convert-avi-flv-t14342/)

Mariam 3Oct2008 23:12

convert avi to flv

Please tell how can I convert avi to flv using PHP.

Thanks a lot.

pradeep 3Oct2008 23:32

Re: convert avi to flv
Install FFMPEG and running the ffmpeg -i test.avi -ab 56 -ar 22050 -b 500 -r 15 -s 320x240 test.flv command using the shell_exec function in PHP.

Code: PHP

// Source file (uploaded file using http upload)
 $src = $_FILES['video']['tmp_name'];
 // Destination FLV
 $dest = '/path/to/your/videos/myvideo.flv';
 // Command to encode movie to flash video
 // use escapeshellcmd to make the command safe
 $command = escapeshellcmd('ffmpeg -i ' . $src . ' -ab 56 -ar 22050 -b 500 -r 15 -s 320x240 ' . $dest);
 // Execute the command

abu123 1Dec2009 18:32

Re: convert avi to flv
Here is my code,
PHP Code:

function makeMultipleTwo ($value){
$sType gettype($value/2);
$sType == "integer"){
} else {
return (

$srcFile "kabhi-alvida.avi";
$destFile ".flvs/kabhi-alvida.flv";
$ffmpegPath "/usr/local/bin/ffmpeg";
$flvtool2Path "/usr/local/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();

$command $ffmpegPath " -i " $srcFile " -ar " $srcAR " -ab " $srcAB " -f flv -s " $srcWidth "x" $srcHeight " " $destFile " | " $flvtool2Path " -U stdin " $destFile;
$convert exec($command);



What's wrog with this. everything going okey, but output flv file is 0kb. Plz help

dasli 13Apr2010 16:23

Re: convert avi to flv
as for me I convert with Video to Flash Converter

Iliya 15Apr2010 20:07

Re: convert avi to flv
I prefer use the program Flash to Video Encoder, to me has very much helped.

All times are GMT +5.5. The time now is 19:16.