other to FLV file conversion in PHP

Hi It’s really painful to convert any extension of video file to flv which is really lightweight for video playing on web, If you are not using HTML 5 yet may be you are in that painful situation where I was 🙂 BTW using this below written php code any one can convert any video file to flv.
Requirements : ffmpeg software
You can download this software from http://www.videohelp.com/tools/ffmpeg


Code :

$curdir = define ('FULL_PATH', dirname(__FILE__).'/');
if(strstr($_SERVER['SERVER_SOFTWARE'],"Win32"))
$ffmpeg_format = $curdir."ffmpeg.exe -y -i %s %s";
else
$ffmpeg_format = "LD_LIBRARY_PATH=. ".$curdir."ffmpeg -y -i %s %s > /dev/null 2>&1";
$ret_value = 0;

// prepare ffmpeg command
$ffmpeg_command = sprintf($ffmpeg_format, $video_file_name, $flv_name);
if (system($ffmpeg_command, $ret_value) === FALSE || $ret_value != 0) {
// ffmpeg was failed return false notice
return false;
}

Where this php page directory should ffmpeg.exe directory
By the help of flvtool2 mencoder software file conversion you can follow
http://reazulk.wordpress.com/2008/01/24/easy-way-to-convert-a-no-flash-movie-to-flash/

One Response to “other to FLV file conversion in PHP”

  1. Hi Jewel,

    Please give solve me problem, how can set permission on server to ffmpeg.exe and video upload folder of video convoter to FLV in PHP

    Thanks

Leave a Reply

  • (will not be published)