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 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用
  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教