PHP上的FFMPEG和PHP不工作 [英] FFMPEG and PHP on mac does`t work

查看:143
本文介绍了PHP上的FFMPEG和PHP不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要你的帮助。目前我使用Mac OS X 10.9.4和xampp apache 1.8.3-3。我需要使用ffmpeg(3.2版)通过php exec()转换视频文件,但我无法使其工作。我做了一些运行终端命令行的测试,系统运行正常。只有在php它不工作。
ffmpeg是通过brew编译和安装的。



我运行了以下测试:

  exec(/ usr /local/Cellar/ffmpeg/2.3/bin/ffmpeg -i /Applications/XAMPP/xamppfiles/htdocs/teste/trailer.mp4 /Applications/XAMPP/xamppfiles/htdocs/teste/trailer2.flv 2>& 1,$ o,$ v); 
var_dump($ o);
var_dump($ v);

并得到以下内容:

  array(4){
[0] => string(51)dyld:找不到符号:__cg_jpeg_resync_to_restart
[1] => string(82)引用自:/System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
[2] => string(63)Expected in:/Applications/XAMPP/xamppfiles/lib/libJPEG.dylib
[3] => string(67)in /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO} int(133)


解决方案

问题链接到DYLD_LIBRARY_PATH设置为xampp库文件夹



尝试在exec $ b之前取消设置$ b任何一个这样的exec将工作

  exec('unset DYLD_LIBRARY_PATH;'); 
putenv('DYLD_LIBRARY_PATH');
putenv('DYLD_LIBRARY_PATH = / usr / bin');


I need your help. Currently I use Mac OS X 10.9.4 and xampp apache 1.8.3-3. I need to use ffmpeg (version 3.2) to convert video files via php exec() but I cannot make it work. I did some testing running the terminal command line and the system operates normally. Only in php it doesn't work. ffmpeg was compiled and installed through the brew.

I ran the following test:

exec("/usr/local/Cellar/ffmpeg/2.3/bin/ffmpeg -i /Applications/XAMPP/xamppfiles/htdocs/teste/trailer.mp4 /Applications/XAMPP/xamppfiles/htdocs/teste/trailer2.flv 2>&1", $o, $v);
var_dump($o);
var_dump($v);

and got the following:

array(4) { 
    [0]=> string(51) "dyld: Symbol not found: __cg_jpeg_resync_to_restart" 
    [1]=> string(82) "Referenced from: /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO" 
    [2]=> string(63) "Expected in: /Applications/XAMPP/xamppfiles/lib/libJPEG.dylib" 
    [3]=> string(67) " in /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO" } int(133)

解决方案

problem is linked to DYLD_LIBRARY_PATH being set to xampp libraries folder

try unsetting this before exec any one of these before exec will work

exec('unset DYLD_LIBRARY_PATH ;');
putenv('DYLD_LIBRARY_PATH');
putenv('DYLD_LIBRARY_PATH=/usr/bin');

这篇关于PHP上的FFMPEG和PHP不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆