dou29106 2015-06-18 15:02
浏览 27

PHP与FFMPEG

I am trying to run ffmpeg code on the server via PHP and here is my code:

<?php
$command ='find /mnt/'.$year.' /mnt/2015/ -name '.$_POST['MXF'].'.mxf';
if (!($stream = ssh2_exec($con, $command))) {
            echo "fail: unable to execute command
";
        } else {

            stream_set_blocking($stream, true);
            $stream_out = ssh2_fetch_stream($stream,SSH2_STREAM_STDIO);
            $file = stream_get_contents($stream_out);
            echo $file;
            $t==$file;
            echo $t;
            $ff='/usr/bin/ffmpeg -i '.$t.' -vcodec libx264 -pix_fmt yuv420p -profile:v baseline -level 3.0 -s '.$RESOLUTION.' -vb '.$VB.'k -ac 2 -acodec aac -b:a 128k -ar 44100 -strict -2  -vf "movie=/datastore/logo/hello_logo.png [watermark]; [in][watermark] overlay=60:main_h-overlay_h-60 [out]"  '.$NDRIVE.''.$MXF.'.mp4 -y';
            if(!($tra= ssh2_exec($con, $ff))) {
            echo "failed to execute the Command";
        }
?>

and when I copy the file path from the $file command, I get the file path but when I use PHP variable $file within the FFMPEG code, I get error of -vodec not found

I want to pass the $file variable which contain the file path on the server into the FFMPEG code.

  • 写回答

1条回答 默认 最新

  • doujuan2688 2015-06-18 15:11
    关注

    use $t=$file; instead of == operator.

    评论

报告相同问题?

悬赏问题

  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?
  • ¥15 matlab(相关搜索:紧聚焦)
  • ¥15 基于51单片机的厨房煤气泄露检测报警系统设计
  • ¥15 Arduino无法同时连接多个hx711模块,如何解决?
  • ¥50 需求一个up主付费课程