dongzilu0178 2013-03-03 13:54
浏览 106
已采纳

FFMPEG命令在PHP中不起作用。 (与MAMP不相容)

I'm a bit of a beginner when it comes to PHP, and I'm trying to create a simple(ish) system where files are input, and then converted to html5 video in various resolutions.

I've sorted out how to handle multiple file uploads etc, but now I'm having a problem.

I can't seem to get exec to execute FFMPEG in PHP.

For example, if I type this into my command line (Terminal on Mac OSX 10.8), It converts the video correctly:

ffmpeg -i /Users/charlieryan/Desktop/MOV01785.MPG websample.mov

This correctly outputs the converted video file into my home directory.

However if I run this in PHP as follows:

exec('ffmpeg -i /Users/charlieryan/Desktop/MOV01785.MPG websample.mov');

Absolutely nothing happens ... my stat monitor doesn't register any change in processor use, and I can't find the output file anywhere on my system.

Since I'm a bit of a noob at this, I'm assuming I'm doing something wrong, but what is it?

Thanks,

Charlie

  • 写回答

5条回答 默认 最新

  • dongliulu1122 2013-03-03 20:05
    关注

    After alot of help from birgire and a lot of fiddling around I've sorted it.

    This problem comes from an incompatibility with the MAMP sandbox. Which can be solved as follows:

    Go to Terminal and type:

    sudo nano /Applications/MAMP/Library/bin/envvars
    

    Then comment out the following lines with a hash (#)

    # DYLD_LIBRARY_PATH="/Applications/MAMP/Library/lib:$DYLD_LIBRARY_PATH"
    # export DYLD_LIBRARY_PATH
    

    And then add the following line to the file

    export PATH="$PATH:/opt/local/bin"
    

    Then, go back to MAMP and restart your servers, navigate back to the page, and you'll be good to go.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(4条)

报告相同问题?

悬赏问题

  • ¥15 求解答一道线性规划题,用lingo编程运行,第一问要求写出数学模型和lingo语言编程模型,第二问第三问解答就行,我的ddl要到了谁来求了
  • ¥50 树莓派安卓APK系统签名
  • ¥15 maple软件,用solve求反函数出现rootof,怎么办?
  • ¥65 汇编语言除法溢出问题
  • ¥15 Visual Studio问题
  • ¥20 求一个html代码,有偿
  • ¥100 关于使用MATLAB中copularnd函数的问题
  • ¥20 在虚拟机的pycharm上
  • ¥15 jupyterthemes 设置完毕后没有效果
  • ¥15 matlab图像高斯低通滤波