Showing
2 changed files
with
29 additions
and
28 deletions
... | @@ -77,50 +77,51 @@ class MakeVideo implements ShouldQueue | ... | @@ -77,50 +77,51 @@ class MakeVideo implements ShouldQueue |
77 | $animate = $this->makeAnimate($last_frame_video, $end_wallpaper, '', $signature_x, $signature_y, $font); | 77 | $animate = $this->makeAnimate($last_frame_video, $end_wallpaper, '', $signature_x, $signature_y, $font); |
78 | } | 78 | } |
79 | 79 | ||
80 | - | ||
81 | $video = $this->getTempPath(); | 80 | $video = $this->getTempPath(); |
82 | - $watermark_x = $watermark_x ? $watermark_x : 0; | 81 | + $cmd = $this->ffmpeg . ' -y ' . |
83 | - $watermark_y = $watermark_y ? $watermark_y : 0; | ||
84 | - $am_inp = ' -i ' . escapeshellarg($watermark); | ||
85 | - $am_filter = "[2:v]overlay={$watermark_x}:{$watermark_y}[water];[water]"; | ||
86 | - | ||
87 | - $cmd = $this->ffmpeg . ' -y' . | ||
88 | ' -i ' . escapeshellarg($file) . | 82 | ' -i ' . escapeshellarg($file) . |
89 | ' -i ' . escapeshellarg($animate) . | 83 | ' -i ' . escapeshellarg($animate) . |
90 | - $am_inp . | 84 | + ' -i ' . escapeshellarg($watermark) . |
91 | - ' -filter_complex "[0:0]' . '' . $am_filter . '[0:1] [1:0] [1:1] concat=n=2:v=1:a=1 [v] [a]"' . | 85 | + |
92 | - ' -map [v] -map [a]'; | 86 | + ' -filter_complex "[0:0] ' . |
93 | - $cmd .= | 87 | + 'drawtext="' . |
94 | - ' -c:v libx264 -s 800x450 -bt 256k -r 25' . | 88 | + 'fontfile=' . escapeshellarg($font) . ':' . |
89 | + 'text=' . escapeshellarg($content) . ':' . | ||
90 | + 'fontsize=43:' . | ||
91 | + 'fontcolor=white@1.0:' . | ||
92 | + 'x=main_w/2' . '-260' . ':' . | ||
93 | + 'y=main_h/2' . '-20' . ':' . | ||
94 | + 'box=1:boxcolor=0xd0cdcc@0.5' . | ||
95 | + '" [text];' . | ||
96 | + '[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]" ' . | ||
97 | + ' -map [v] -map [a]' . | ||
98 | + ' -c:v libx264 -bt 256k -r 25' . | ||
95 | ' -ar 44100 -ac 2 -qmin 30 -qmax 60 -profile:v baseline -preset fast ' . | 99 | ' -ar 44100 -ac 2 -qmin 30 -qmax 60 -profile:v baseline -preset fast ' . |
96 | escapeshellarg($video); | 100 | escapeshellarg($video); |
97 | 101 | ||
98 | - // 执行合成 | ||
99 | $this->execmd($cmd); | 102 | $this->execmd($cmd); |
100 | 103 | ||
101 | - $video2 = $this->getTempPath(); | 104 | + if ( $adminMakeVideo->thumbnail == 1 && $adminMakeVideo->thumbnail_url){ |
102 | - $cmd = $this->ffmpeg . ' -y -i ' . escapeshellarg($video) . | 105 | + $video_temp = $video; |
103 | - ' -vf '. | 106 | + $video = $this->getTempPath(); |
104 | - 'drawtext="'. | 107 | + |
105 | - 'fontfile=' . escapeshellarg($font) . ':'. | 108 | + $cmd = $this->ffmpeg. ' -y'. |
106 | - 'text=' . escapeshellarg($content) . ':'. | 109 | + ' -i ' . escapeshellarg($video_temp). |
107 | - 'fontsize=43:'. | 110 | + ' -i ' . escapeshellarg(Storage::disk('public')->path($adminMakeVideo->thumbnail_url)). |
108 | - 'fontcolor=white@1.0:'. | 111 | + ' -map 1 -map 0 -c copy -disposition:0 attached_pic '. |
109 | - 'x=main_w/2' . '-260' . ':'. | 112 | + escapeshellarg($video); |
110 | - 'y=main_h/2' . '-20' . ':'. | ||
111 | - 'box=1:boxcolor=0xd0cdcc@0.5'. | ||
112 | - '" ' . escapeshellarg($video2); | ||
113 | 113 | ||
114 | $this->execmd($cmd); | 114 | $this->execmd($cmd); |
115 | + } | ||
115 | 116 | ||
116 | // 全部合成以后创建 临境 | 117 | // 全部合成以后创建 临境 |
117 | - $video_info = $this->mediainfo($video2); | 118 | + $video_info = $this->mediainfo($video); |
118 | 119 | ||
119 | Immerse::query()->create([ | 120 | Immerse::query()->create([ |
120 | 'user_id' => 1, | 121 | 'user_id' => 1, |
121 | 'title' => '', | 122 | 'title' => '', |
122 | 'content' => $this->adminMakeVideo->feel, | 123 | 'content' => $this->adminMakeVideo->feel, |
123 | - 'url' => $video2, | 124 | + 'url' => $video, |
124 | 'type' => $this->adminMakeVideo->type == 1 ? 2 : 1, | 125 | 'type' => $this->adminMakeVideo->type == 1 ? 2 : 1, |
125 | 'duration' => $video_info['format']['duration'], | 126 | 'duration' => $video_info['format']['duration'], |
126 | 'size' => $video_info['format']['size'], | 127 | 'size' => $video_info['format']['size'], | ... | ... |
-
Please register or login to post a comment