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
 shell_exec($command);