问题描述
我正在尝试在15-35秒持续时间为8-10 MB的视频中添加水印。该过程所花费的时间超出了预期的30-40秒。这是我的代码:
$ffmpeg = FFMpeg\FFMpeg::create(array(
'ffmpeg.binaries' => ffmpeg_lib,'ffprobe.binaries' => ffprobe_lib,'timeout' => 3600,// The timeout for the underlying process
'ffmpeg.threads' => 12,// The number of threads that FFMpeg should use
),null);
$ffmpeg_string = ffprobe_lib;
$tempFile=rand().time();
$outputFile='tmp/'.$tempFile.'.mp4';
$video = $ffmpeg->open($videoURL);
$watermarkPath = watermark_Path;
$video
->filters()
->watermark($watermarkPath,array(
'position' => 'absolute','x' => 20,'y' => 10,));
$text="@".$username;
$command = "text='$text': fontcolor=white:fontfile=OpenSans-Bold.ttf: fontsize=18: x=20: y=70:";
$format = new FFMpeg\Format\Video\X264();
$format->setAudioCodec("aac");
try
{
$video->filters()->custom("drawtext=$command");
$video->save($format,$outputFile);
$array_out = array();
$array_out[] =
array(
"download_url" => checkVideoUrl($outputFile)
);
$output=array( "code" => "200","msg" => $array_out);
print_r(json_encode($output,true));
}
我的代码有什么问题吗?如何提高速度?任何帮助都是可观的。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)