Monday, February 23, 2009

convert a video file to FLV format using FFMPEG

you can user FFMPEG to convert a video file to flv format. following is the code block that will show you how to convert a video to flv format.


function makeflv()
{
//this is the path of the video file that you want to convert
$video = $this->baseDir."/".$this->video_name;

//this is the path of the converted flv file with name
$flv_video = $this->baseDir."/".strtok($this->video_name,".").'.flv';

$cmd = "$this->ffmpeg -i $video -deinterlace -ar 44100 -r 25 -qmin 3 -qmax 6 $flv_video";
$return = `$cmd`;

$flv = strtok($userfile_name,".").'.flv';

return $flv;
}



this will return the converted flv file