简体   繁体   中英

How can I use ffmpeg with PHP's exec( ) command?

I'm running Max OS 10.7, MAMP (PHP 5.3.6), with FFMPEG installed. I want to convert videos from one format to another. The following entered into Terminal works fine:

 ffmpeg -i /path/video.wmv /path/video.flv

The file video.wmv is converted to video.flv. Great! Now, this PHP line DOESN'T work:

 exec('ffmpeg -i /path/video.wmv /path/video.flv');

Why? I've spent many hours reading up on this and I still can't figure out what is wrong. I have read the other discussions on this topic and there is no clear answer. Any help would be greatly appreciated! (PHP safe_mode is off).

I would double check that the path to ffmpeg is correct. Also, take a look at the output to see if has anything useful, like this:

exec("/usr/bin/ffmpeg -i $srcFile $destFile 2>&1", $output);
var_dump($output);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM