Showing
2 changed files
with
12 additions
and
2 deletions
... | @@ -49,6 +49,11 @@ class DevFFmpeg extends Command | ... | @@ -49,6 +49,11 @@ class DevFFmpeg extends Command |
49 | */ | 49 | */ |
50 | public function handle() | 50 | public function handle() |
51 | { | 51 | { |
52 | + $a = <<<AAA | ||
53 | +/usr/bin/ffmpeg -y -i '/usr/local/nginx/html/OnePoem/storage/app/public/files/65f944c1bf4458a324440ceea44c993c.mp4' -i '/usr/local/nginx/html/OnePoem/storage/app/public/temp/88/350/output_1649906074717.mp4' -i '/usr/local/nginx/html/OnePoem/storage/app/public/ffmpeg/LOGO_eng.png' -filter_complex "[0:0]drawtext="fontfile='/usr/local/nginx/html/OnePoem/storage/app/public/ffmpeg/arialuni.ttf':text='佳节清明桃李笑,野田荒冢只生愁。\\n雷惊天地龙蛇蛰,雨足郊原草木柔。\\n人乞祭余骄妾妇,士甘焚死不公侯。\\n贤愚千载知谁是,满眼蓬蒿共一丘。\\n':fontsize=26:fontcolor=white@1.0:x='(w-text_w)/2':y='(h-text_h)/2':box=1:boxcolor=0xd0cdcc@0.5",drawtext="fontfile='/usr/local/nginx/html/OnePoem/storage/app/public/ffmpeg/arialuni.ttf':text='2022年04月14日11时':fontsize=31:fontcolor=white@1.0:x='(w-text_w)/2':y='text_h':box=1:boxcolor=0xd0cdcc@0.5",drawtext="fontfile='/usr/local/nginx/html/OnePoem/storage/app/public/ffmpeg/arialuni.ttf':text='测试有感文本,这里是十五个字。':fontsize=29:fontcolor=white@1.0:x='(w-text_w)/2':y='h-text_h*2':box=1:boxcolor=0xd0cdcc@0.5" [text];[text] [2:v]overlay=20:20[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 '/usr/local/nginx/html/OnePoem/storage/app/public/video/181/141/output_16499060769238.mp4' | ||
54 | +AAA; | ||
55 | + | ||
56 | + | ||
52 | $path = '/Users/lishuai/Desktop/test/'; | 57 | $path = '/Users/lishuai/Desktop/test/'; |
53 | $file = $path . 'qinghuaci.mp4'; | 58 | $file = $path . 'qinghuaci.mp4'; |
54 | // $file = $path . 'lingdang.mov'; | 59 | // $file = $path . 'lingdang.mov'; |
... | @@ -758,9 +763,12 @@ class DevFFmpeg extends Command | ... | @@ -758,9 +763,12 @@ class DevFFmpeg extends Command |
758 | $text_bg_color = $component->text_bg_color ?? '0xd0cdcc'; | 763 | $text_bg_color = $component->text_bg_color ?? '0xd0cdcc'; |
759 | $opacity = $component->opacity ? $component->opacity / 100 : '0.5'; | 764 | $opacity = $component->opacity ? $component->opacity / 100 : '0.5'; |
760 | 765 | ||
766 | + $text_file = $this->getTempPath('txt'); | ||
767 | + file_put_contents($text_file, $content); | ||
768 | + | ||
761 | $drawtext .= 'drawtext="'. | 769 | $drawtext .= 'drawtext="'. |
762 | 'fontfile=' . escapeshellarg($font) . ':' . | 770 | 'fontfile=' . escapeshellarg($font) . ':' . |
763 | - 'text=' . escapeshellarg($content) . ':' . | 771 | + 'textfile=' . escapeshellarg($text_file) . ':' . |
764 | 'fontsize=' . $component->font_size . ':' . | 772 | 'fontsize=' . $component->font_size . ':' . |
765 | 'fontcolor=' . $text_color . '@1.0:' . | 773 | 'fontcolor=' . $text_color . '@1.0:' . |
766 | 'x=' . escapeshellarg(VideoTemp::POSITION_FFMPEG[$component->position][0]) . ':' . | 774 | 'x=' . escapeshellarg(VideoTemp::POSITION_FFMPEG[$component->position][0]) . ':' . | ... | ... |
... | @@ -605,6 +605,8 @@ class MakeVideo implements ShouldQueue | ... | @@ -605,6 +605,8 @@ class MakeVideo implements ShouldQueue |
605 | switch ($component->name){ | 605 | switch ($component->name){ |
606 | case 'one_poem': | 606 | case 'one_poem': |
607 | $content = $this->adminMakeVideo->poem->content . PHP_EOL; | 607 | $content = $this->adminMakeVideo->poem->content . PHP_EOL; |
608 | + $text_file = $this->getTempPath('txt'); | ||
609 | + file_put_contents($text_file, $content); | ||
608 | 610 | ||
609 | $text_color = $component->text_color ?? 'white'; | 611 | $text_color = $component->text_color ?? 'white'; |
610 | $text_bg_color = $component->text_bg_color ?? '0xd0cdcc'; | 612 | $text_bg_color = $component->text_bg_color ?? '0xd0cdcc'; |
... | @@ -612,7 +614,7 @@ class MakeVideo implements ShouldQueue | ... | @@ -612,7 +614,7 @@ class MakeVideo implements ShouldQueue |
612 | 614 | ||
613 | $drawtext .= 'drawtext="'. | 615 | $drawtext .= 'drawtext="'. |
614 | 'fontfile=' . escapeshellarg($font) . ':' . | 616 | 'fontfile=' . escapeshellarg($font) . ':' . |
615 | - 'text=' . escapeshellarg($content) . ':' . | 617 | + 'textfile=' . escapeshellarg($text_file) . ':' . |
616 | 'fontsize=' . $this->calcFontSize($component->font_size,$content) . ':' . | 618 | 'fontsize=' . $this->calcFontSize($component->font_size,$content) . ':' . |
617 | 'fontcolor=' . $text_color . '@1.0:' . | 619 | 'fontcolor=' . $text_color . '@1.0:' . |
618 | 'x=' . escapeshellarg(VideoTemp::POSITION_FFMPEG[$component->position][0]) . ':' . | 620 | 'x=' . escapeshellarg(VideoTemp::POSITION_FFMPEG[$component->position][0]) . ':' . | ... | ... |
-
Please register or login to post a comment