【问题标题】:PHP with FFMPEGPHP 与 FFMPEG
【发布时间】:2015-09-04 07:23:09
【问题描述】:

我正在尝试通过 PHP 在服务器上运行 ffmpeg 代码,这是我的代码:

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

当我从 $file 命令复制文件路径时,我得到了文件路径,但是当我在 FFMPEG 代码中使用 PHP 变量 $file 时,我得到 -vodec not found 的错误

我想将包含服务器上文件路径的 $file 变量传递到 FFMPEG 代码中。

【问题讨论】:

    标签: php ffmpeg


    【解决方案1】:

    使用$t=$file; 代替== 运算符。

    【讨论】:

    • 必须至少指定一个输出文件 bash: line 1: -vcodec: command
    猜你喜欢
    • 2012-09-08
    • 1970-01-01
    • 2012-02-02
    • 2011-08-20
    • 1970-01-01
    • 1970-01-01
    • 2011-08-13
    • 1970-01-01
    • 2016-06-16
    相关资源
    最近更新 更多