【发布时间】: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 代码中。
【问题讨论】: