Showing
1 changed file
with
75 additions
and
71 deletions
... | @@ -278,78 +278,82 @@ class AdminMakeImmerse implements ShouldQueue | ... | @@ -278,78 +278,82 @@ class AdminMakeImmerse implements ShouldQueue |
278 | ]; | 278 | ]; |
279 | break; | 279 | break; |
280 | } | 280 | } |
281 | - | 281 | + try{ |
282 | - $FID = $FOD = floatval($component->fade_time / 1000); | 282 | + $FID = $FOD = floatval($component->fade_time / 1000); |
283 | - $round = round($this->media_info['format']['duration'] / count($contents),1); | 283 | + $round = round($this->media_info['format']['duration'] / count($contents),1); |
284 | - if ($round < 1) $round = 1; | 284 | + if ($round < 1) $round = 1; |
285 | - $sub_text = ''; | 285 | + $sub_text = ''; |
286 | - foreach ($contents as $key => $content){ | 286 | + foreach ($contents as $key => $content){ |
287 | - $DS = $key * $round; | 287 | + $DS = $key * $round; |
288 | - $DE = $DS + $round; | 288 | + $DE = $DS + $round; |
289 | - if ($content['tag'] == 'title'){ | 289 | + if ($content['tag'] == 'title'){ |
290 | - $arr = explode("\n", $content['text']); | 290 | + $arr = explode("\n", $content['text']); |
291 | - $title = $arr[0] ?? " "; | 291 | + $title = $arr[0] ?? " "; |
292 | - $author = $arr[1] ?? " "; | 292 | + $author = $arr[1] ?? " "; |
293 | - // 标题 | 293 | + // 标题 |
294 | - $text_file = $this->getAbsolutePath($this->getTempPath('.txt','text')); | 294 | + $text_file = $this->getAbsolutePath($this->getTempPath('.txt','text')); |
295 | - file_put_contents($text_file, $title); | 295 | + file_put_contents($text_file, $title); |
296 | - $sub_text .= 'drawtext="'. | 296 | + $sub_text .= 'drawtext="'. |
297 | - 'fontfile=' . escapeshellarg($font_file) . ':' . | 297 | + 'fontfile=' . escapeshellarg($font_file) . ':' . |
298 | - 'textfile=' . escapeshellarg($text_file) . ':' . | 298 | + 'textfile=' . escapeshellarg($text_file) . ':' . |
299 | - 'fontsize=' . $font_size . ':' . | 299 | + 'fontsize=' . $font_size . ':' . |
300 | - '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 }') . ':' . | 300 | + '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 }') . ':' . |
301 | - 'x=' . escapeshellarg(VideoTemp::POSITION_FFMPEG['midMiddle'][0]) . ':' . | 301 | + 'x=' . escapeshellarg(VideoTemp::POSITION_FFMPEG['midMiddle'][0]) . ':' . |
302 | - 'y=' . escapeshellarg(VideoTemp::POSITION_FFMPEG['midMiddle'][1]) . ':' . | 302 | + 'y=' . escapeshellarg(VideoTemp::POSITION_FFMPEG['midMiddle'][1]) . ':' . |
303 | - '", '; | 303 | + '", '; |
304 | - // 作者 | 304 | + // 作者 |
305 | - $text_file = $this->getAbsolutePath($this->getTempPath('.txt','text')); | 305 | + $text_file = $this->getAbsolutePath($this->getTempPath('.txt','text')); |
306 | - file_put_contents($text_file, $author); | 306 | + file_put_contents($text_file, $author); |
307 | - $sub_text .= 'drawtext="'. | 307 | + $sub_text .= 'drawtext="'. |
308 | - 'fontfile=' . escapeshellarg($font_file) . ':' . | 308 | + 'fontfile=' . escapeshellarg($font_file) . ':' . |
309 | - 'textfile=' . escapeshellarg($text_file) . ':' . | 309 | + 'textfile=' . escapeshellarg($text_file) . ':' . |
310 | - 'fontsize=' . $font_size / 2 . ':' . | 310 | + 'fontsize=' . $font_size / 2 . ':' . |
311 | - '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 }') . ':' . | 311 | + '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 }') . ':' . |
312 | - 'x=' . escapeshellarg(VideoTemp::POSITION_FFMPEG['midMiddle'][0]) . ':' . | 312 | + 'x=' . escapeshellarg(VideoTemp::POSITION_FFMPEG['midMiddle'][0]) . ':' . |
313 | - 'y=' . escapeshellarg(VideoTemp::POSITION_FFMPEG['midMiddle'][1] + $font_size) . ':' . | 313 | + 'y=' . escapeshellarg(VideoTemp::POSITION_FFMPEG['midMiddle'][1] + $font_size) . ':' . |
314 | - '", '; | 314 | + '", '; |
315 | - }elseif($content['tag'] == 'source'){ | 315 | + }elseif($content['tag'] == 'source'){ |
316 | - $arr = explode("\n", $content['text']); | 316 | + $arr = explode("\n", $content['text']); |
317 | - $title = $arr[0] ?? " "; | 317 | + $title = $arr[0] ?? " "; |
318 | - $author = $arr[1] ?? " "; | 318 | + $author = $arr[1] ?? " "; |
319 | - //诗句 | 319 | + //诗句 |
320 | - $text_file = $this->getAbsolutePath($this->getTempPath('.txt','text')); | 320 | + $text_file = $this->getAbsolutePath($this->getTempPath('.txt','text')); |
321 | - file_put_contents($text_file, $title); | 321 | + file_put_contents($text_file, $title); |
322 | - $sub_text .= 'drawtext="'. | 322 | + $sub_text .= 'drawtext="'. |
323 | - 'fontfile=' . escapeshellarg($font_file) . ':' . | 323 | + 'fontfile=' . escapeshellarg($font_file) . ':' . |
324 | - 'textfile=' . escapeshellarg($text_file) . ':' . | 324 | + 'textfile=' . escapeshellarg($text_file) . ':' . |
325 | - 'fontsize=' . $font_size . ':' . | 325 | + 'fontsize=' . $font_size . ':' . |
326 | - '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 }') . ':' . | 326 | + '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 }') . ':' . |
327 | - 'x=' . escapeshellarg(VideoTemp::POSITION_FFMPEG[$component->position][0]) . ':' . | 327 | + 'x=' . escapeshellarg(VideoTemp::POSITION_FFMPEG[$component->position][0]) . ':' . |
328 | - 'y=' . escapeshellarg(VideoTemp::POSITION_FFMPEG[$component->position][1]) . ':' . | 328 | + 'y=' . escapeshellarg(VideoTemp::POSITION_FFMPEG[$component->position][1]) . ':' . |
329 | - '", '; | 329 | + '", '; |
330 | - // 出处 | 330 | + // 出处 |
331 | - $text_file = $this->getAbsolutePath($this->getTempPath('.txt','text')); | 331 | + $text_file = $this->getAbsolutePath($this->getTempPath('.txt','text')); |
332 | - file_put_contents($text_file, $author); | 332 | + file_put_contents($text_file, $author); |
333 | - $sub_text .= 'drawtext="'. | 333 | + $sub_text .= 'drawtext="'. |
334 | - 'fontfile=' . escapeshellarg($font_file) . ':' . | 334 | + 'fontfile=' . escapeshellarg($font_file) . ':' . |
335 | - 'textfile=' . escapeshellarg($text_file) . ':' . | 335 | + 'textfile=' . escapeshellarg($text_file) . ':' . |
336 | - 'fontsize=' . $font_size / 2 . ':' . | 336 | + 'fontsize=' . $font_size / 2 . ':' . |
337 | - '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 }') . ':' . | 337 | + '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 }') . ':' . |
338 | - 'x=' . escapeshellarg(VideoTemp::POSITION_FFMPEG[$component->position][0]) . ':' . | 338 | + 'x=' . escapeshellarg(VideoTemp::POSITION_FFMPEG[$component->position][0]) . ':' . |
339 | - 'y=' . escapeshellarg(VideoTemp::POSITION_FFMPEG[$component->position][1] + $font_size) . ':' . | 339 | + 'y=' . escapeshellarg(VideoTemp::POSITION_FFMPEG[$component->position][1] + $font_size) . ':' . |
340 | - '", '; | 340 | + '", '; |
341 | - }else{ | 341 | + }else{ |
342 | - $text_file = $this->getAbsolutePath($this->getTempPath('.txt','text')); | 342 | + $text_file = $this->getAbsolutePath($this->getTempPath('.txt','text')); |
343 | - file_put_contents($text_file, $content); | 343 | + file_put_contents($text_file, $content); |
344 | - $sub_text .= 'drawtext="'. | 344 | + $sub_text .= 'drawtext="'. |
345 | - 'fontfile=' . escapeshellarg($font_file) . ':' . | 345 | + 'fontfile=' . escapeshellarg($font_file) . ':' . |
346 | - 'textfile=' . escapeshellarg($text_file) . ':' . | 346 | + 'textfile=' . escapeshellarg($text_file) . ':' . |
347 | - 'fontsize=' . $font_size . ':' . | 347 | + 'fontsize=' . $font_size . ':' . |
348 | - '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 }') . ':' . | 348 | + '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 }') . ':' . |
349 | - 'x=' . escapeshellarg(VideoTemp::POSITION_FFMPEG[$component->position][0]) . ':' . | 349 | + 'x=' . escapeshellarg(VideoTemp::POSITION_FFMPEG[$component->position][0]) . ':' . |
350 | - 'y=' . escapeshellarg(VideoTemp::POSITION_FFMPEG[$component->position][1]) . ':' . | 350 | + 'y=' . escapeshellarg(VideoTemp::POSITION_FFMPEG[$component->position][1]) . ':' . |
351 | - '", '; | 351 | + '", '; |
352 | + } | ||
352 | } | 353 | } |
354 | + }catch (\Exception $exception){ | ||
355 | + echo $exception->getMessage(); | ||
356 | + echo $exception->getLine(); | ||
353 | } | 357 | } |
354 | 358 | ||
355 | $drawtext .= $sub_text; | 359 | $drawtext .= $sub_text; | ... | ... |
-
Please register or login to post a comment