問題描述
我在 Mac OSX 10.7.3 上通過 PHP 的 exec()
命令在 MAMP 中使用 ffmpeg,我設置了一個絕對路徑來調用 ffmpeg,例如
I am using ffmpeg on Mac OSX 10.7.3 in MAMP through PHP's exec()
command, I have an absolute path set to call ffmpeg, e.g.
/opt/local/bin/ffmpeg -i "/sample.avi"
但我收到以下錯誤 -
dyld: Library not loaded: /opt/local/lib/libjpeg.8.dylib Referenced from: /opt/local/lib/libopenjpeg.1.dylib Reason: Incompatible library version: libopenjpeg.1.dylib requires version 13.0.0 or later, but libJPEG.dylib provides version 12.0.0
注意ffmpeg 是通過 Macports 安裝的.
N.B. ffmpeg was installed through Macports.
它從命令行工作.
怎么辦?
編輯
我重新打開了這個 - 最初認為 shell_exec()
解決了這個問題,但實際上它應該以不同的方式調用 - 我直到今天進一步調查才意識到.這是我使用 shell_exec 的代碼,但仍然出現上述錯誤:
I've reopened this - originally thought shell_exec()
solved the issue, but infact it should be called differently - and I didn't realise until investigating further today. Here is my code using shell_exec and still giving the error above:
$cmd = '/opt/local/bin/ffmpeg -h';
$cmd = escapeshellcmd($cmd) . ' 2>&1';
$output = shell_exec($cmd);
var_dump($output);
推薦答案
問題是 DYLD_LIBRARY_PATH 是在 MAMP 中設置的,我已經通過 macports 安裝了 ffmpeg.
The problem is that the DYLD_LIBRARY_PATH is set in MAMP and I've installed ffmpeg via macports.
這可能不是最好的解決方法,但它讓我現在就開始運行:
This might not be the best fix but it has me up and running for now:
在 /Applications/MAMP/Library/bin/envvars
文件中,注釋以下幾行:
In the /Applications/MAMP/Library/bin/envvars
file and comment the following lines as below:
#DYLD_LIBRARY_PATH="/Applications/MAMP/Library/lib:$DYLD_LIBRARY_PATH"
#export DYLD_LIBRARY_PATH
并重啟Apache
這篇關于ffmpeg MAMP“dyld:庫未加載"錯誤的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!