Forum Moderators: coopster

Message Too Old, No Replies

converting video files to .flv format

how i can use exec in my file to convert.

         

vanik

8:14 am on Jul 8, 2008 (gmt 0)

10+ Year Member




Hi,

I converted the files to flv format in cmd.But when i try to those to convert it in my php file it could nt be converted.Please help me about this.Here is my code..

<?
$srcFile = "/FFmpeg/monkeydog.wmv";
$destFile = "/FFmpeg/mn.flv";
$ffmpegPath = "/FFmpeg/ffmpeg";
echo exec('cmd /c echo Hello World!');
exec($ffmpegPath . " -i " . $srcFile . " -ar 22050 -ab 32 -f flv -s 420 * 320 " . $destFile);
//$x=exec('cmd /c ffmpeg -i monkeydog.wmv -ar 22050 -ab 32 -f flv -s 320×240 video2.flv');
//exec("/usr/local/bin/ffmpeg -i /your/dir/uploadedfile.flv -an -ss 00:00:03 -an -r 2 -vframes 1 -y /your/dir/%d.jpg");
// Make multiples function
?>

supermanjnk

3:10 pm on Jul 8, 2008 (gmt 0)

10+ Year Member



This is the function that I use... (remember the forum breaks Pipes, so you will need to replace them)

function converttoflv( $in, $out ) {
if (file_exists($out)) {
unlink( $out );
}
$cmd = "/usr/bin/ffmpeg -v 0 -i $in -b 64k -ar 11025 -sameq $out 2>&1 ¦ grep time";
$fh = popen( $cmd, "r" );
while($prop = fgets( $fh ) ) {
if (!empty($prop)) {
$length = $prop;
}
}
pclose( $fh );
return $length;
}

eelixduppy

3:17 pm on Jul 8, 2008 (gmt 0)



Also note that if you have safe_mode enabled in your PHP configuration that this won't work unless you have ffmpeg in your safe_mode_exec_dir.

vanik

8:03 am on Jul 9, 2008 (gmt 0)

10+ Year Member



Hi,

I didnt got the converted file when i used that function also.I didnt got any error also.

In my php.ini the safe_mode was disable(off).What i have to be done for getting this ?