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.