简体   繁体   English

ffmpeg php 执行不工作

[英]ffmpeg php exec not working

  • I have ffmpeg installed我安装了 ffmpeg
  • safe_mode is off安全模式已关闭
  • when i do this: $movie = new ffmpeg_movie('Bear.wmv');当我这样做时: $movie = new ffmpeg_movie('Bear.wmv'); I can use getDuration(), getFilename().... wthout any problems, so it's all seems to be working我可以使用 getDuration()、getFilename().... 没有任何问题,所以一切似乎都在工作
  • exec is working fine, cos when i do: $output = exec('ls -lart'); exec 工作正常,因为当我这样做时: $output = exec('ls -lart'); I get a nice little result.我得到了一个不错的小结果。

but when I do this:但是当我这样做时:

exec('ffmpeg -i Bear.wmv outputfile.flv')

nothing happens什么都没发生

if I add: $command_output, $result the only result i guess is: array { }如果我添加: $command_output, $result result 我猜唯一的结果是: array { }

I have tried everything I could think of:我已经尝试了我能想到的一切:

exec('ffmpeg -i Bear.wmv outputfile.flv')

exec('ffmpeg.so -i Bear.wmv outputfile.flv')

exec('/usr/lib/php5/20090626/ffmpeg -i Bear.wmv outputfile.flv')

I've tried all sizes and folders and codecs but still don't get anything back我已经尝试了所有大小、文件夹和编解码器,但仍然没有得到任何回报

All i wanna do is convert that video, Bear.wmv to an flv file.我想做的就是将该视频 Bear.wmv 转换为 flv 文件。

I'm very close to crying like a baby and/or jumping out of the window (im only on the first floor but still lol) so Please help????!我非常接近像婴儿一样哭泣和/或跳出 window (我只在一楼,但仍然哈哈)所以请帮忙????!

FFMPEG is a application wich don't output to STDIO but STDERR, so you can redirect it to standard output: FFMPEG 是一个应用程序,它不是 output 到 STDIO 而是 STDERR,因此您可以将其重定向到标准 output:

$cmd = $FFMPEGDIR . " -i somefile.avi 2>&1"; // SEE 2>&1 !!

Extracting size:提取大小:

 exec( $cmd , $info );

      echo "<pre>".print_r($info,true)."</pre>";
      $resolution = preg_match( '@[ ,\t]([0-9]{3,4}x[0-9]{3,4})[ ,\t]@si' , implode( " " , $info ) , $durmatches );

      $rtab = explode( "x" , $durmatches[1] );

      $videowidth = $rtab[0];
      $videoheight = $rtab[1];

Recently set ffmpeg up for audio stuff... it's a bit of a black art, ffmpeg is notorious for not playing nice (or consistently) - what works (worked) for me might not work for you!最近将 ffmpeg 设置为音频的东西......这有点像魔法,ffmpeg 因演奏不好(或始终如一)而臭名昭著 - 对我有用(有效)的方法可能对你无效!

try using: shell_exec()尝试使用:shell_exec()

or:或者:

$command="{$FFMPEG_BINARY} ... rest of your options";
$process=proc_open($command, $descriptors, $pipes);
if (!$process)
{
    // failed to exec...
}
else
{
    // command ran...
}

my ffmpeg was in... "/usr/bin/ffmpeg" just check you've got right path too.我的 ffmpeg 在……“/usr/bin/ffmpeg”中,只要检查一下你的路径是否正确。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM