convert video files into .flv using ffmpeg

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
vanik
Forum Newbie
Posts: 2
Joined: Tue Jul 08, 2008 6:02 am

convert video files into .flv using ffmpeg

Post by vanik »

Hi All,

I convert the video files into .flv format in cmd by using ffmpeg.Whether i did it in my php file i didnot get the converted file.Please tell me how i can use cmd in my file.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.exe -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
?>
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: convert video files into .flv using ffmpeg

Post by Christopher »

PHP runs as the same user as the webserver. That user may not have the path settings of regular user accounts. You may want to try using absolute paths to the executable and data files.
(#10850)
vanik
Forum Newbie
Posts: 2
Joined: Tue Jul 08, 2008 6:02 am

Re: convert video files into .flv using ffmpeg

Post by vanik »

Hi,

echo exec('cmd /c echo Hello World!');

It runs successfully.

exec('cmd /c ffmpeg.exe -i monkeydog.wmv -ar 22050 -ab 32 -f flv -s 320×240 video2.flv');

i tried like this also.But i didnt get any output or error.

Please help me about this problem.

Thanks in advance.
arturgrigor
Forum Newbie
Posts: 3
Joined: Mon Aug 25, 2008 9:39 am

Re: convert video files into .flv using ffmpeg

Post by arturgrigor »

I think you cannot execute ffmpeg because ffmpeg binary is not installed on system's folder (bin) or where linux stores them.
You must have the absolute path to the ffmpeg to execute it like: /var/www/yoursite/FFmpeg/ffmpeg.

Something like this.

I also building a website based on watching flv movies but the thing is that I do not know how to execute ffmpeg to tell me when the conversion is done. :(
izero
Forum Newbie
Posts: 1
Joined: Thu Aug 28, 2008 3:05 am

Re: convert video files into .flv using ffmpeg

Post by izero »

Try using FFlib.NET from http://www.intuitive.sk/fflib/ :drunk:
Post Reply