-4

Possible Duplicate:
how to convert the videos with ffmpeg

I have to execute some ffmpeg command using PHP, by giving some input parameters and a output file parameter. How would I be doing it. I am a asp.net guy, dont know much about php.

Help will be appreciated.

Community
  • 1
  • 1
Parminder
  • 3,088
  • 6
  • 37
  • 61
  • 3
    Your question is way too elementary, you did not even bother to read one of many php tutorials which explain this very well, and you also did not procure to research previous answers, those points might be what the downvoters had in mind. – RedComet Dec 08 '11 at 21:56

2 Answers2

3
<?php //linux

    $commands = array(
        '-i file.mpg',
        '-vcodec copy', 
        '-acodec ac3',
        '-ab 384k test.mpg',
        '-acodec mp2',
        '-ab 192k',
        '-newaudio'
    };

    shell_exec("ffmpeg".implode(' ',$commands);

?>

<?php //windows

    $commands = array(
        '-i file.mpg',
        '-vcodec copy', 
        '-acodec ac3',
        '-ab 384k test.mpg',
        '-acodec mp2',
        '-ab 192k',
        '-newaudio'
    };

exec ('c:\\path\\to\\ffmpeg.exe \\'
        .implode(' ',$commands), 
        $output ); 
?>
ehime
  • 8,025
  • 14
  • 51
  • 110
0

you could use a wrapper but far easier would just be call exec with the command line options

hackartist
  • 5,172
  • 4
  • 33
  • 48