李帅

1.继续调试ffmpeg命令

......@@ -77,50 +77,51 @@ class MakeVideo implements ShouldQueue
$animate = $this->makeAnimate($last_frame_video, $end_wallpaper, '', $signature_x, $signature_y, $font);
}
$video = $this->getTempPath();
$watermark_x = $watermark_x ? $watermark_x : 0;
$watermark_y = $watermark_y ? $watermark_y : 0;
$am_inp = ' -i ' . escapeshellarg($watermark);
$am_filter = "[2:v]overlay={$watermark_x}:{$watermark_y}[water];[water]";
$cmd = $this->ffmpeg . ' -y' .
$cmd = $this->ffmpeg . ' -y ' .
' -i ' . escapeshellarg($file) .
' -i ' . escapeshellarg($animate) .
$am_inp .
' -filter_complex "[0:0]' . '' . $am_filter . '[0:1] [1:0] [1:1] concat=n=2:v=1:a=1 [v] [a]"' .
' -map [v] -map [a]';
$cmd .=
' -c:v libx264 -s 800x450 -bt 256k -r 25' .
' -i ' . escapeshellarg($watermark) .
' -filter_complex "[0:0] ' .
'drawtext="' .
'fontfile=' . escapeshellarg($font) . ':' .
'text=' . escapeshellarg($content) . ':' .
'fontsize=43:' .
'fontcolor=white@1.0:' .
'x=main_w/2' . '-260' . ':' .
'y=main_h/2' . '-20' . ':' .
'box=1:boxcolor=0xd0cdcc@0.5' .
'" [text];' .
'[text] [2:v]overlay=' . $watermark_x . ':' . $watermark_y . '[water];[water][0:1][1:0][1:1] concat=n=2:v=1:a=1[v][a]" ' .
' -map [v] -map [a]' .
' -c:v libx264 -bt 256k -r 25' .
' -ar 44100 -ac 2 -qmin 30 -qmax 60 -profile:v baseline -preset fast ' .
escapeshellarg($video);
// 执行合成
$this->execmd($cmd);
$video2 = $this->getTempPath();
$cmd = $this->ffmpeg . ' -y -i ' . escapeshellarg($video) .
' -vf '.
'drawtext="'.
'fontfile=' . escapeshellarg($font) . ':'.
'text=' . escapeshellarg($content) . ':'.
'fontsize=43:'.
'fontcolor=white@1.0:'.
'x=main_w/2' . '-260' . ':'.
'y=main_h/2' . '-20' . ':'.
'box=1:boxcolor=0xd0cdcc@0.5'.
'" ' . escapeshellarg($video2);
if ( $adminMakeVideo->thumbnail == 1 && $adminMakeVideo->thumbnail_url){
$video_temp = $video;
$video = $this->getTempPath();
$this->execmd($cmd);
$cmd = $this->ffmpeg. ' -y'.
' -i ' . escapeshellarg($video_temp).
' -i ' . escapeshellarg(Storage::disk('public')->path($adminMakeVideo->thumbnail_url)).
' -map 1 -map 0 -c copy -disposition:0 attached_pic '.
escapeshellarg($video);
$this->execmd($cmd);
}
// 全部合成以后创建 临境
$video_info = $this->mediainfo($video2);
$video_info = $this->mediainfo($video);
Immerse::query()->create([
'user_id' => 1,
'title' => '',
'content' => $this->adminMakeVideo->feel,
'url' => $video2,
'url' => $video,
'type' => $this->adminMakeVideo->type == 1 ? 2 : 1,
'duration' => $video_info['format']['duration'],
'size' => $video_info['format']['size'],
......
......@@ -174,7 +174,7 @@ return [
'maxJobs' => 0,
'memory' => 128,
'tries' => 1,
'timeout' => 60,
'timeout' => 180,
'nice' => 0,
],
],
......