AdminMakeImmerse.php
25.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
<?php
namespace App\Jobs;
use App\Models\Immerse;
use App\Models\VideoTemp;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use App\Models\AdminMakeVideo;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
class AdminMakeImmerse implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public $adminMakeVideo;
protected $ffmpeg;
protected $ffprobe;
protected $media_info;
protected $output_width;
protected $output_height;
/**
* Create a new job instance.
* @param AdminMakeVideo $adminMakeVideo
* @return void
*/
public function __construct(AdminMakeVideo $adminMakeVideo)
{
$this->adminMakeVideo = $adminMakeVideo;
$this->ffmpeg = env('FFMPEG_CMD');
$this->ffprobe = env('FFPROBE_CMD');
$this->output_width = 720;
$this->output_height = 1280;
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
$file = $this->getAbsolutePath($this->adminMakeVideo->video_url);
// 分析视频
$this->media_info = $this->mediaInfo($file);
// 准备素材
$watermark = $this->getAbsolutePath('images/logo.png');
// 组装文字参数
$drawtext = $this->getTextContentString();
// 判断双轨 没有则制作空轨
$is_bgm = $this->adminMakeVideo->temp->bg_music == 1; //是否手动上传背景音
$bgm = $this->getAbsolutePath($this->adminMakeVideo->temp->bgm_url);
if ($this->media_info['format']['nb_streams'] >= 2) { /** 音频视频轨都有 */
if ($is_bgm) {
// 有背景音 融合
$audio = $this->getAbsolutePath($this->getTempPath('.mp3','audio'));
$cmd = $this->ffmpeg .
' -y -i ' . escapeshellarg($file) .
' -y -i ' . escapeshellarg($bgm) .
' -filter_complex amix=inputs=2:duration=first:dropout_transition=2 ' .
'-ar 48000 -ab 64k ' . escapeshellarg($audio);
if (!$this->execCmd($cmd)) return;
$audio_input = ' -i ' . escapeshellarg($audio);
$audio_filter = '2:a';
} else {
// 没有背景音
$audio_input = '';
$audio_filter = '0:a';
}
} elseif ($this->media_info['format']['nb_streams'] == 1) { /** 只有视频轨 */
// 生成一段无声音频
$audio = $this->getAbsolutePath($this->getTempPath('.mp3','audio'));
$cmd = $this->ffmpeg .
' -y -f lavfi -i aevalsrc=0:duration=' . escapeshellarg($this->media_info['format']['duration']) .
' -ar 48000 -ab 64k ' . escapeshellarg($audio);
if (!$this->execCmd($cmd)) return;
if ($is_bgm) {
// 有背景音 融合
$audio_empty = $audio;
$audio = $this->getAbsolutePath($this->getTempPath('.mp3','audio'));
$cmd = $this->ffmpeg .
' -y -i ' . escapeshellarg($audio_empty) .
' -y -i ' . escapeshellarg($bgm) .
' -filter_complex amix=inputs=2:duration=first:dropout_transition=2 ' .
'-ar 48000 -ab 64k ' . escapeshellarg($audio);
if (!$this->execCmd($cmd)) return;
}
$audio_input = ' -i ' . escapeshellarg($audio);
$audio_filter = '2:a';
} else {
/** 音频视频轨都没有 */
Log::channel('daily')->error('视频没有video track, url:' . $file);
return;
}
// 制作封面图
$thumbnail = $this->getTempPath('.jpg','thumbnail');
if ($this->adminMakeVideo->thumbnail == 2){
// 截取中间帧作为视频封面
$frame = ceil($this->media_info['streams'][0]['nb_frames'] / 2);
$cmd = $this->ffmpeg . ' -y ' .
' -i ' . escapeshellarg($file) .
' -filter_complex "[0:v]select=\'eq(n,' . $frame . ')\'[img]" ' .
' -map [img]'.
' -frames:v 1 -s ' . $this->output_width . 'x' . $this->output_height . ' -preset superfast ' .
escapeshellarg($this->getAbsolutePath($thumbnail));
if (!$this->execCmd($cmd)) return ;
}else{
// 手动上传封面
$origin_thumbnail = $this->getAbsolutePath($this->adminMakeVideo->thumbnail_url);
// 将封面分辨率改为指定分辨率
$cmd = $this->ffmpeg . ' -y ' .
' -i ' . escapeshellarg($origin_thumbnail) .
'-s ' . $this->output_width . 'x' . $this->output_height . ' -preset superfast ' .
escapeshellarg($this->getAbsolutePath($thumbnail));
if (!$this->execCmd($cmd)) return ;
}
// 合成视频
$output = $this->getTempPath('.mp4','video');
$cmd = $this->ffmpeg . ' -y '.
' -i ' . escapeshellarg($file).
' -i ' . escapeshellarg($watermark).
$audio_input .
' -filter_complex "[0:v]scale=' . $this->output_width . ':' . $this->output_height . ',' . $drawtext .
' [text];[text]'.
' [1:v]overlay=20:20[v]" ' .
' -map [v] -map '. $audio_filter .
' -c:v libx264 -bt 256k -r 25' .
' -ar 44100 -ac 2 -qmin 30 -qmax 60 -profile:v baseline -preset fast ' .
escapeshellarg($this->getAbsolutePath($output));
if (!$this->execCmd($cmd)) return ;
// 分析视频 入库
$video_info = $this->mediaInfo($this->getAbsolutePath($output));
Immerse::query()->create([
'user_id' => 1,
'title' => '',
'weather' => $this->adminMakeVideo->weather,
'huangli' => $this->adminMakeVideo->huangli,
'content' => $this->adminMakeVideo->feel,
'location' => $this->adminMakeVideo->location,
'longitude' => $this->adminMakeVideo->longitude,
'latitude' => $this->adminMakeVideo->latitude,
'url' => $output,
'type' => $this->adminMakeVideo->type == 1 ? 2 : 1,
'upload_file' => '',
'duration' => $video_info['format']['duration'],
'size' => $video_info['format']['size'],
'origin_video_url' => $this->adminMakeVideo->video_url,
'origin_image_url' => '',
'poem_id' => $this->adminMakeVideo->poem_id,
'temp_id' => $this->adminMakeVideo->temp_id,
'thumbnail' => $thumbnail,
'state' => 1,
'bgm' => $is_bgm ? $bgm : '',
]);
}
public function getAbsolutePath($path)
{
if ($path == '') return '';
return Storage::disk('public')->path($path);
}
public function mediaInfo($file)
{
$cmd = $this->ffprobe . ' -v quiet -print_format json -show_format -show_streams ' . escapeshellarg($file);
$output = $this->execCmd($cmd);
$data = json_decode($output, true);
if (json_last_error() === JSON_ERROR_UTF8) {
$output = mb_convert_encoding($output, "UTF-8");
$data = json_decode($output, true);
}
$this->media_info = $data;
return $data;
}
public function execCmd($cmd)
{
echo $cmd . "\n". "\n";
return shell_exec("{$cmd} 2>&1");
}
public function getTextContentString()
{
$components = $this->adminMakeVideo->temp->components;
$drawtext = '';
// 底部加入文字水印
$text_file = $this->getAbsolutePath($this->getTempPath('.txt','text'));
file_put_contents($text_file, 'Parlando.ink');
$font_file = $this->getAbsolutePath("files/d7300fd8be7ff27fb0a11d1afe717374.otf");
$font_size = $this->calcFontSize(22);
$drawtext .= 'drawtext="'.
'fontfile=' . escapeshellarg($font_file) . ':' .
'textfile=' . escapeshellarg($text_file) . ':' .
'fontsize=' . $font_size . ':' .
'fontcolor=white@0.8:' .
'x=' . escapeshellarg('w-text_w') . ':' .
'y=' . escapeshellarg('h-text_h-1') . ':' .
'", ';
foreach ($components as $component) {
$text_color = $component->text_color ?? 'white';
$text_bg_color = $component->text_bg_color ?? '0xd0cdcc';
$opacity = $component->opacity ? $component->opacity / 100 : 0.5;
$font_file = $this->getAbsolutePath($component->font_file);
$text_bg_box = $component->text_bg_box ?? 0;
$font_size = $this->calcFontSize($component->font_size);
// 文字淡入淡出模式
if ($component->draw == 'fade'){
$contents = []; //
switch ($component->name){
case 'one_poem':
$contents[] = [
"text" => $this->adminMakeVideo->poem2->title . "\n" . $this->adminMakeVideo->poem2->author,
"tag" => "title"
];
foreach ($this->adminMakeVideo->poem2->verses as $item) {
if ($item->content){
if ($item->source){
$contents[] = [
"text" => $this->autoEnter($item->content, $font_size, $this->output_width) . "\n" . $item->source,
"tag" => "source"
];
}else{
$contents[] = [
"text" => $this->autoEnter($item->content, $font_size, $this->output_width),
"tag" => "content"
];
}
}
if ($item->annotate){
$contents[] = [
"text" => $this->autoEnter($item->annotate, $font_size, $this->output_width),
"tag" => "annotate"
];
}
if ($item->spelling){
$contents[] = [
"text" => $this->autoEnter($item->spelling, $font_size, $this->output_width),
"tag" => "spelling"
];
}
if ($item->en){
$contents[] = [
"text" => $this->autoEnter($item->en, $font_size, $this->output_width),
"tag" => "en"
];
}
}
break;
case 'weather':
$contents[] = [
"text" => $this->adminMakeVideo->weather,
"tag" => "weather"
];
break;
case 'date':
$contents[] = [
"text" => Carbon::now()->format('Y年m月d日H时'),
"tag" => "date"
];
break;
case 'feel':
$contents[] = [
"text" => $this->adminMakeVideo->feel ?: '读此一言,仿佛身临其境。',
"tag" => "feel"
];
break;
}
$FID = $FOD = floatval($component->fade_time / 1000);
$round = round($this->media_info['format']['duration'] / count($contents),1);
if ($round < 1) $round = 1;
$sub_text = '';
foreach ($contents as $key => $content){
$DS = $key * $round;
$DE = $DS + $round;
if ($content['tag'] == 'title'){
$arr = explode("\n", $content['text']);
$title = $arr[0] ?? " ";
$author = $arr[1] ?? " ";
// 标题
$text_file = $this->getAbsolutePath($this->getTempPath('.txt','text'));
file_put_contents($text_file, $title);
$sub_text .= 'drawtext="'.
'fontfile=' . escapeshellarg($font_file) . ':' .
'textfile=' . escapeshellarg($text_file) . ':' .
'fontsize=' . $font_size . ':' .
'fontcolor_expr=' . escapeshellarg($text_color . '%{eif\\\\: clip(255*(1*between(t\\, ' . $DS . ' + ' . $FID . '\\, ' . $DE . ' - ' . $FOD . ') + ((t - ' . $DS . ')/' . $FID . ')*between(t\\, ' . $DS . '\\, ' . $DS . ' + ' . $FID . ') + (-(t - ' . $DE . ')/' . $FOD . ')*between(t\\, ' . $DE . ' - ' . $FOD . '\\, ' . $DE . '))\\, 0\\, 255) \\\\: x\\\\: 2 }') . ':' .
'x=' . escapeshellarg(VideoTemp::POSITION_FFMPEG['midMiddle'][0]) . ':' .
'y=' . escapeshellarg(VideoTemp::POSITION_FFMPEG['midMiddle'][1]) . ':' .
'", ';
// 作者
$text_file = $this->getAbsolutePath($this->getTempPath('.txt','text'));
file_put_contents($text_file, $author);
$sub_text .= 'drawtext="'.
'fontfile=' . escapeshellarg($font_file) . ':' .
'textfile=' . escapeshellarg($text_file) . ':' .
'fontsize=' . $font_size / 2 . ':' .
'fontcolor_expr=' . escapeshellarg($text_color . '%{eif\\\\: clip(255*(1*between(t\\, ' . $DS . ' + ' . $FID . '\\, ' . $DE . ' - ' . $FOD . ') + ((t - ' . $DS . ')/' . $FID . ')*between(t\\, ' . $DS . '\\, ' . $DS . ' + ' . $FID . ') + (-(t - ' . $DE . ')/' . $FOD . ')*between(t\\, ' . $DE . ' - ' . $FOD . '\\, ' . $DE . '))\\, 0\\, 255) \\\\: x\\\\: 2 }') . ':' .
'x=' . escapeshellarg(VideoTemp::POSITION_FFMPEG['midMiddle'][0]) . ':' .
'y=' . escapeshellarg(VideoTemp::POSITION_FFMPEG['midMiddle'][1] . '+' . $font_size) . ':' .
'", ';
}elseif($content['tag'] == 'source'){
$arr = explode("\n", $content['text']);
$verse = $arr[0] ?? " ";
$source = $arr[1] ?? " ";
//诗句
$text_file = $this->getAbsolutePath($this->getTempPath('.txt','text'));
file_put_contents($text_file, $verse);
$sub_text .= 'drawtext="'.
'fontfile=' . escapeshellarg($font_file) . ':' .
'textfile=' . escapeshellarg($text_file) . ':' .
'fontsize=' . $font_size . ':' .
'fontcolor_expr=' . escapeshellarg($text_color . '%{eif\\\\: clip(255*(1*between(t\\, ' . $DS . ' + ' . $FID . '\\, ' . $DE . ' - ' . $FOD . ') + ((t - ' . $DS . ')/' . $FID . ')*between(t\\, ' . $DS . '\\, ' . $DS . ' + ' . $FID . ') + (-(t - ' . $DE . ')/' . $FOD . ')*between(t\\, ' . $DE . ' - ' . $FOD . '\\, ' . $DE . '))\\, 0\\, 255) \\\\: x\\\\: 2 }') . ':' .
'x=' . escapeshellarg(VideoTemp::POSITION_FFMPEG[$component->position][0]) . ':' .
'y=' . escapeshellarg(VideoTemp::POSITION_FFMPEG[$component->position][1]) . ':' .
'", ';
// 出处
$text_file = $this->getAbsolutePath($this->getTempPath('.txt','text'));
file_put_contents($text_file, $source);
$sub_text .= 'drawtext="'.
'fontfile=' . escapeshellarg($font_file) . ':' .
'textfile=' . escapeshellarg($text_file) . ':' .
'fontsize=' . $font_size / 2 . ':' .
'fontcolor_expr=' . escapeshellarg($text_color . '%{eif\\\\: clip(255*(1*between(t\\, ' . $DS . ' + ' . $FID . '\\, ' . $DE . ' - ' . $FOD . ') + ((t - ' . $DS . ')/' . $FID . ')*between(t\\, ' . $DS . '\\, ' . $DS . ' + ' . $FID . ') + (-(t - ' . $DE . ')/' . $FOD . ')*between(t\\, ' . $DE . ' - ' . $FOD . '\\, ' . $DE . '))\\, 0\\, 255) \\\\: x\\\\: 2 }') . ':' .
'x=' . escapeshellarg(VideoTemp::POSITION_FFMPEG[$component->position][0]) . ':' .
'y=' . escapeshellarg(VideoTemp::POSITION_FFMPEG[$component->position][1] . '+' . $font_size) . ':' .
'", ';
}else{
$text_file = $this->getAbsolutePath($this->getTempPath('.txt','text'));
file_put_contents($text_file, $content['text']);
$sub_text .= 'drawtext="'.
'fontfile=' . escapeshellarg($font_file) . ':' .
'textfile=' . escapeshellarg($text_file) . ':' .
'fontsize=' . $font_size . ':' .
'fontcolor_expr=' . escapeshellarg($text_color . '%{eif\\\\: clip(255*(1*between(t\\, ' . $DS . ' + ' . $FID . '\\, ' . $DE . ' - ' . $FOD . ') + ((t - ' . $DS . ')/' . $FID . ')*between(t\\, ' . $DS . '\\, ' . $DS . ' + ' . $FID . ') + (-(t - ' . $DE . ')/' . $FOD . ')*between(t\\, ' . $DE . ' - ' . $FOD . '\\, ' . $DE . '))\\, 0\\, 255) \\\\: x\\\\: 2 }') . ':' .
'x=' . escapeshellarg(VideoTemp::POSITION_FFMPEG[$component->position][0]) . ':' .
'y=' . escapeshellarg(VideoTemp::POSITION_FFMPEG[$component->position][1]) . ':' .
'", ';
}
}
$drawtext .= $sub_text;
}
// 文字固定模式
if ($component->draw == 'fix'){
$contents = []; //
switch ($component->name){
case 'one_poem':
$stanzas = '';
$default = $this->adminMakeVideo->poem2->title . "\n" . $this->adminMakeVideo->poem2->author;
$stanzas .= $this->autoCenter($default,$font_size, $this->output_width) .PHP_EOL.PHP_EOL;
foreach ($this->adminMakeVideo->poem2->verses as $item) {
if ($item->content != '') $stanzas .= $this->autoEnter($item->content, $font_size, $this->output_width) . "\n";
}
$contents[] = $stanzas;
break;
case 'weather':
$contents[] = $this->adminMakeVideo->weather;
break;
case 'date':
$contents[] = Carbon::now()->format('Y年m月d日H时');
break;
case 'feel':
$contents[] = $this->adminMakeVideo->feel ?: '读此一言,仿佛身临其境。';
break;
}
$sub_text = '';
foreach ($contents as $key => $content){
$text_file = $this->getAbsolutePath($this->getTempPath('.txt','text'));
file_put_contents($text_file, $content);
$sub_text .= 'drawtext="'.
'fontfile=' . escapeshellarg($font_file) . ':' .
'textfile=' . escapeshellarg($text_file) . ':' .
'fontsize=' . $font_size . ':' .
'fontcolor=' . $text_color . '@' . $opacity . ':' .
'x=' . escapeshellarg(VideoTemp::POSITION_FFMPEG[$component->position][0]) . ':' .
'y=' . escapeshellarg(VideoTemp::POSITION_FFMPEG[$component->position][1]) . ':' .
'box=1:boxborderw='. $text_bg_box . ':' .
'boxcolor=' . $text_bg_color . '@' . $opacity . '", ';
}
$drawtext .= $sub_text;
}
}
return rtrim($drawtext,', ');
}
public function autoEnter($string, $font_width, $video_width)
{
$video_width = $video_width - 1 * $font_width; // 两侧留出空隙
$row_count = floor($video_width / $font_width);
echo $string . "#" . $row_count . PHP_EOL;
$str_len = mb_strlen($string);
if ($str_len > $row_count) {
$tmp = array_chunk(
preg_split("//u", $string, -1, PREG_SPLIT_NO_EMPTY), $row_count);
$new_str = "";
foreach ($tmp as $t) {
$new_str .= join("", $t) . "\n";
}
return $new_str;
}else{
return $string;
}
}
public function autoCenter($string, $font_width, $video_width)
{
$video_width = $video_width - 1 * $font_width; // 两侧留出空隙
$row_count = floor($video_width / $font_width);
$arr = explode("\n", $string);
$title = $arr[0] ?? " ";
$author = $arr[1];
$title_len = mb_strlen($title);
if ($title_len > $row_count) {
$tmp = array_chunk(
preg_split("//u", $string, -1, PREG_SPLIT_NO_EMPTY), $row_count);
$tmp[count($tmp - 1)] = $this->autoStrPad(end($tmp), $row_count * 2, ' ', STR_PAD_BOTH);
$new_title = '';
foreach ($tmp as $t) {
$new_title .= join("", $t) . "\n";
}
} else {
$new_title = $this->autoStrPad($title, $row_count * 2, ' ', STR_PAD_BOTH);
}
$new_author = $this->autoStrPad($author, $row_count * 2, ' ', STR_PAD_BOTH);
return $new_title . PHP_EOL . $new_author;
}
public function autoStrPad($string, $length, $pad_string = "", $pad_type = STR_PAD_BOTH)
{
$mb_disparity_count = (strlen($string) - mb_strlen($string)) / 2;
return str_pad($string,$length+$mb_disparity_count,$pad_string,$pad_type);
}
public function calcFontSize($width)
{
return floor($this->output_width / 360 * $width);
}
/**
* 获取输出临时文件名
* @param string $ext
* @param string $dir
* @return string
*/
public function getTempPath($ext = '.mp4',$dir = 'video')
{
$filename = "/output_" . time() . rand(0, 10000);
$hash_hex = md5($filename);
// 16进制表示的字符串一共32字节,表示16个二进制字节。
// 前16个字符用来第一级求摸,后16个用做第二级
$hash_hex_l1 = substr($hash_hex, 0, 8);
$hash_hex_l2 = substr($hash_hex, 8, 8);
$dir_l1 = hexdec($hash_hex_l1) % 256;
$dir_l2 = hexdec($hash_hex_l2) % 512;
$dir = $dir . '/' . $dir_l1 . '/' . $dir_l2;
if( !Storage::disk('public')->exists($dir)) Storage::disk('public')->makeDirectory($dir);
return $dir . $filename . $ext;
}
}
///usr/local/ffmpeg-amd64-static/ffmpeg -y
// -i '/www/wwwroot/api.parlando.ink/storage/app/public/files/663d081e3044c0d898bc9eb5d0fbf295.mp4'
// -i '/www/wwwroot/api.parlando.ink/storage/app/public/images/logo.png'
// -i '/www/wwwroot/api.parlando.ink/storage/app/public/audio/163/318/output_16844141095724.mp3'
// -filter_complex "[0:v]scale=720:1280,drawtext="fontfile='/www/wwwroot/api.parlando.ink/storage/app/public/files/f756b152d774a107d5ad08b972764551.TTF'
//:textfile='/www/wwwroot/api.parlando.ink/storage/app/public/text/6/444/output_16844141093118.txt'
//:fontsize=48:fontcolor_expr='#F5F5F5%{eif\\: clip(255*(1*between(t\, 0 + 1.5\, 2.5 - 1.5) + ((t - 0)/1.5)*between(t\, 0\, 0 + 1.5) + (-(t - 2.5)/1.5)*between(t\, 2.5 - 1.5\, 2.5))\, 0\, 255) \\: x\\: 2 }':x=(w-text_w)/2:y=(h-text_h)/2:", drawtext="fontfile='/www/wwwroot/api.parlando.ink/storage/app/public/files/f756b152d774a107d5ad08b972764551.TTF':textfile='/www/wwwroot/api.parlando.ink/storage/app/public/text/137/91/output_16844141093024.txt':fontsize=24:fontcolor_expr='#F5F5F5%{eif\\: clip(255*(1*between(t\, 0 + 1.5\, 2.5 - 1.5) + ((t - 0)/1.5)*between(t\, 0\, 0 + 1.5) + (-(t - 2.5)/1.5)*between(t\, 2.5 - 1.5\, 2.5))\, 0\, 255) \\: x\\: 2 }':x=(w-text_w)/2:y=(h-text_h)/2:", drawtext="fontfile='/www/wwwroot/api.parlando.ink/storage/app/public/files/f756b152d774a107d5ad08b972764551.TTF':textfile='/www/wwwroot/api.parlando.ink/storage/app/public/text/38/32/output_16844141099313.txt':fontsize=48:fontcolor_expr='#F5F5F5%{eif\\: clip(255*(1*between(t\, 2.5 + 1.5\, 5 - 1.5) + ((t - 2.5)/1.5)*between(t\, 2.5\, 2.5 + 1.5) + (-(t - 5)/1.5)*between(t\, 5 - 1.5\, 5))\, 0\, 255) \\: x\\: 2 }':x='(w-text_w)/2':y='h-text_h*2-68':", drawtext="fontfile='/www/wwwroot/api.parlando.ink/storage/app/public/files/f756b152d774a107d5ad08b972764551.TTF':textfile='/www/wwwroot/api.parlando.ink/storage/app/public/text/244/134/output_16844141096908.txt':fontsize=48:fontcolor_expr='#F5F5F5%{eif\\: clip(255*(1*between(t\, 5 + 1.5\, 7.5 - 1.5) + ((t - 5)/1.5)*between(t\, 5\, 5 + 1.5) + (-(t - 7.5)/1.5)*between(t\, 7.5 - 1.5\, 7.5))\, 0\, 255) \\: x\\: 2 }':x='(w-text_w)/2':y='h-text_h*2-68':" [text];[text] [1:v]overlay=20:20[v]" -map [v] -map 2:a -c:v libx264 -bt 256k -r 25 -ar 44100 -ac 2 -qmin 30 -qmax 60 -profile:v baseline -preset fast '/www/wwwroot/api.parlando.ink/storage/app/public/video/93/183/output_16844141105696.mp4'