如何解决如何增加ffmpeg在php-ffmpeg中添加水印速度?
我正在尝试在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 举报,一经查实,本站将立刻删除。