FFMpeg在命令行中工作,但在PHP中使用exec(); [英] FFMpeg working in command line but not in PHP using exec();

查看:205
本文介绍了FFMpeg在命令行中工作,但在PHP中使用exec();的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用FFMpeg隐藏视频,它可以从命令行正常工作。我使用以下命令:

I am using FFMpeg to covert videos and it is working fine from the command line. I am using the following command:

ffmpeg -i input.mpg  -vcodec libx264 -b 819200 -s 100x100 -g 15 -bf 3 -b_strategy 1 -coder 1 -qmin 10 -qmax 51 -sc_threshold 40 -flags +loop -cmp +chroma -me_range 16 -me_method hex -subq 5 -i_qfactor 0.71 -qcomp 0.6 -qdiff 4 -directpred 1 -flags2 +fastpskip -dts_delta_threshold 1 -acodec libfaac -ab 48000 output.m4v

但是,当我使用PHP运行命令exec(),输出视频编码不正确,并且被扭曲和裁剪。我在PHP中使用以下内容:

However, when I run the command using PHP exec(), the output video is not encoded correctly and is distorted and cropped. I am using the following in PHP:

$output = exec($cmd . ' 2>&1', $output, $return);

$ output返回一个0成功代码。

The $output returns a '0' successful code.

有没有任何建议?

谢谢。

推荐答案

这是不寻常的。您有可能安装了多个ffmpeg二进制文件,PHP / Apache用户调用的二进制文件与您从用户命令行调用的二进制文件不同。

This is unusual. It is possible that you have more than one ffmpeg binary installed, and the one that is being called by the PHP/Apache user is not the same as the one you call as your user from the command line.

尝试指定您的exec()中的ffmpeg二进制文件(/ usr / bin / ffmpeg或其他内容)的完整路径。

Try specifying the full path to your ffmpeg binary (/usr/bin/ffmpeg or whatever) inside your exec().

这篇关于FFMpeg在命令行中工作,但在PHP中使用exec();的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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