李帅

1.继续调试ffmpeg命令

...@@ -46,6 +46,48 @@ class DevFFmpeg extends Command ...@@ -46,6 +46,48 @@ class DevFFmpeg extends Command
46 */ 46 */
47 public function handle() 47 public function handle()
48 { 48 {
49 + $content = '题破山寺后禅院' . "\t" . ' -- 常建' . PHP_EOL .
50 + '清晨入古寺,初日照高林。' . PHP_EOL .
51 + '曲径通幽处,禅房花木深。' . PHP_EOL .
52 + '山光悦鸟性,潭影空人心。' . PHP_EOL .
53 + '万籁此都寂,但余钟磬音。' . PHP_EOL ;
54 + $path = '/Users/lishuai/Desktop/test/';
55 +
56 + $cmd = $this->ffmpeg . ' -y '.
57 + ' -i ' . escapeshellarg($path . 'qinghuaci.mp4').
58 + ' -i ' . escapeshellarg($path . 'suffiix.mp4').
59 + ' -i ' . escapeshellarg($path . 'logo.png').
60 +
61 + ' -filter_complex "[0:0] ' .
62 + 'drawtext="'.
63 + 'fontfile=' . escapeshellarg($path . 'arialuni.ttf') . ':' .
64 + 'text=' . escapeshellarg($content) . ':'.
65 + 'fontsize=43:'.
66 + 'fontcolor=white@1.0:'.
67 + 'x=main_w/2' . '-260' . ':'.
68 + 'y=main_h/2' . '-20' . ':'.
69 + 'box=1:boxcolor=0xd0cdcc@0.5'.
70 + '" [text];'.
71 + '[text] [2:v]overlay=20:20[water];[water][0:1][1:0][1:1] concat=n=2:v=1:a=1[v][a]" '.
72 + ' -map [v] -map [a]'.
73 + ' -c:v libx264 -bt 256k -r 25' .
74 +// ' -c:v:thumb png -disposition:v:thumb attached_pic' .
75 + ' -ar 44100 -ac 2 -qmin 30 -qmax 60 -profile:v baseline -preset fast ' .
76 + escapeshellarg($path . 'out.mp4');
77 +
78 + $this->execmd($cmd);
79 +
80 +
81 + $cmd = $this->ffmpeg. ' -y'.
82 + ' -i ' . escapeshellarg($path . 'out.mp4').
83 + ' -i ' . escapeshellarg($path . 'thumbnail.png').
84 + ' -map 1 -map 0 -c copy -disposition:0 attached_pic '.
85 + escapeshellarg($path . 'out2.mp4');
86 +
87 + $this->execmd($cmd);
88 +
89 + return 0;
90 +
49 $adminMakeVideo = AdminMakeVideo::query()->first(); 91 $adminMakeVideo = AdminMakeVideo::query()->first();
50 $adminMakeVideo->video_url = Storage::disk('public')->path($adminMakeVideo->video_url); 92 $adminMakeVideo->video_url = Storage::disk('public')->path($adminMakeVideo->video_url);
51 // $adminMakeVideo->thumbnail_url = Storage::disk('public')->path($adminMakeVideo->thumbnail_url); 93 // $adminMakeVideo->thumbnail_url = Storage::disk('public')->path($adminMakeVideo->thumbnail_url);
......