Free Php Scripts, Articles and Resources
    home  Home   php  PHPscripts   articles  Articles   contact  Contact
Date: 13 March 2010
in

Total scripts: 203
Total downloads: 25548
Total articles: 11

Latest Scripts
Free Contact Us Script +...
Free PHP ODP Script

Top Downloaded Scripts
Captcha Security Images
dGallery

Best Rated Scripts
File Searcher
Transparent Watermark

CATEGORIES

PHP ARTICLES

<< All Php Articles



Related Resources

Writing 642-503 or 156-215 is not a piece of cake. It is better that 1Y0-456 and 1z0-042 professionals attempt it and that too after appearing in 642-892 for once.

 
How to convert mpeg/avi files to .flv at server side
 
     

Video streaming has become a very popular feature on many sites. One of the most convenient ways to add this feature on a web site is to use a flash player (e.g. FlowPlayer - it's nice and free).

In order to use a flash player you will need to convert your video files to .flv files (Flash Video files). You can do this automatically on server side using a conversion software. We have chosenffmpeg for this. Ffmpeg is a very complex tool that supports a various number of video formats.

You will need root access to the hosting server to install ffmpeg. After ffpeg will be installed you'll be able to convert mpeg,avi or other video formats to .flv automatically.

Bellow are the steps that have to be taken in order to install ffpmeg and other required libraries on the server.

 

The following software has to be installed on the hosting server in order to automatically convert uploaded movies into the .flv format.

1) Lame (http://lame.sourceforge.net/index.php)

This has to be installed on the server in order for the movies sound encoding to work.

In order for the lame shared libraries to be found, add /usr/local/lib to /etc/ld.so.conf

ld.so.conf file will probably now look something like this:

include ld.so.conf.d/*.conf
/usr/local/lib

After editing the file run

/sbin/ldconfig

2) Install FFmpeg – one of the most popular encoding software (probably because it’s free)

The latest version can be retrieved from svn repository (details at http://ffmpeg.mplayerhq.hu/download.html).


Follow these steps to install ffmpeg:

Configure ffmpeg to use the lame library

./configure --enable-gpl --enable-pp --enable-libmp3lame

After configure run

make
 
make install

3) Make a test to see if it’s working:

Upload a test movie file and run the following command:

ffmpeg -i test.mpeg test.flv

That should be all.

 

After installing ffmpeg, you can use the following php code to convert the uploaded mpeg, avi, or other files to .flv format:

define('PATH_SITE', substr(__file__, 0, -8));;

$src = PATH_SITE . "test.mpeg";
$dest = PATH_SITE . "test.flv";;

echo "src: $src
dest: $dest
";
$command = escapeshellcmd("ffmpeg -i $src $dest");

$output = shell_exec($command);
echo $output;

 

 

 
<< All Php Articles