noob到php-ffmpeg。安装它。可以使它执行某些操作,因此可能安装正确。
我将其归结为问题的症结所在:
$file="appL.mp4";
$config = array(
'ffmpeg.binaries' => '/usr/local/bin/ffmpeg',
'ffprobe.binaries' => '/usr/local/bin/ffprobe',
'timeout' => 3600, // The timeout for the underlying process
'ffmpeg.threads' => 12, // The number of threads that FFMpeg should use
);
// create the ffmpeg object
$ffmpeg = FFMpeg\FFMpeg::create($config, null);
// open video file
$video = $ffmpeg->open($file);
$format = new FFMpeg\Format\Video\x264();
$format->setAudioCodec("aac");
$video->save($format,'fixed-appL.mp4');
给出此错误:
Fatal error: Uncaught Alchemy\BinaryDriver\Exception\ExecutionFailureException:
ffmpeg failed to execute command ..
这是命令:
'/ usr / local / bin / ffmpeg''-y''-i''appL.mp4''-threads''12''-vcodec' 'libx264''-acodec''aac''-b:v''1000k'-refs''6''-coder''1' '-sc_threshold''40''-flags''+ loop''-me_range''16''-subq''7' '-i_qfactor''0.71''-qcomp''0.6''-qdiff''4''-格子''1''-b:a' '128k''-pass''1''-passlogfile' '/ var / tmp / ffmpeg-passes5ba3a8cc109416z2zr / pass-5ba3a8cc10a2c' 'fixed-appL.mp4'
因此,当我将命令复制到终端时,会出现此错误:
ratecontrol_init: can't open stats file
Error initializing output stream 0:0
-- Error while opening encoder for output stream #0:0
- maybe incorrect parameters such as bit_rate, rate, width or height
但是,如果我删除了tmp文件夹中的文件名并将其更改为:
'/ usr / local / bin / ffmpeg''-y''-i''appL.mp4''-threads''12''-vcodec' 'libx264''-acodec''aac''-b:v''1000k'-refs''6''-coder''1' '-sc_threshold''40''-flags''+ loop''-me_range''16''-subq''7' '-i_qfactor''0.71''-qcomp''0.6''-qdiff''4''-格子''1''-b:a' '128k''-pass''1'--passlogfile''/ var / tmp /''fixed-appL.mp4'
那没关系。 (可能是因为我试图影响一个不再存在的临时文件?