Toggle navigation
Toggle navigation
This project
Loading...
Sign in
OnePoem
/
OnePoem-Server
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
李帅
2022-04-14 15:05:48 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
196573567521879e9f2ca829aa0acbcd07b253de
19657356
1 parent
6d7980b8
1.ffmpeg命令微调
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
2 deletions
app/Console/Commands/DevFFmpeg.php
app/Jobs/MakeVideo.php
app/Console/Commands/DevFFmpeg.php
View file @
1965735
...
...
@@ -49,6 +49,11 @@ class DevFFmpeg extends Command
*/
public
function
handle
()
{
$a
=
<<<AAA
/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'
AAA;
$path
=
'/Users/lishuai/Desktop/test/'
;
$file
=
$path
.
'qinghuaci.mp4'
;
// $file = $path . 'lingdang.mov';
...
...
@@ -758,9 +763,12 @@ class DevFFmpeg extends Command
$text_bg_color
=
$component
->
text_bg_color
??
'0xd0cdcc'
;
$opacity
=
$component
->
opacity
?
$component
->
opacity
/
100
:
'0.5'
;
$text_file
=
$this
->
getTempPath
(
'txt'
);
file_put_contents
(
$text_file
,
$content
);
$drawtext
.=
'drawtext="'
.
'fontfile='
.
escapeshellarg
(
$font
)
.
':'
.
'text
='
.
escapeshellarg
(
$content
)
.
':'
.
'text
file='
.
escapeshellarg
(
$text_file
)
.
':'
.
'fontsize='
.
$component
->
font_size
.
':'
.
'fontcolor='
.
$text_color
.
'@1.0:'
.
'x='
.
escapeshellarg
(
VideoTemp
::
POSITION_FFMPEG
[
$component
->
position
][
0
])
.
':'
.
...
...
app/Jobs/MakeVideo.php
View file @
1965735
...
...
@@ -605,6 +605,8 @@ class MakeVideo implements ShouldQueue
switch
(
$component
->
name
){
case
'one_poem'
:
$content
=
$this
->
adminMakeVideo
->
poem
->
content
.
PHP_EOL
;
$text_file
=
$this
->
getTempPath
(
'txt'
);
file_put_contents
(
$text_file
,
$content
);
$text_color
=
$component
->
text_color
??
'white'
;
$text_bg_color
=
$component
->
text_bg_color
??
'0xd0cdcc'
;
...
...
@@ -612,7 +614,7 @@ class MakeVideo implements ShouldQueue
$drawtext
.=
'drawtext="'
.
'fontfile='
.
escapeshellarg
(
$font
)
.
':'
.
'text
='
.
escapeshellarg
(
$content
)
.
':'
.
'text
file='
.
escapeshellarg
(
$text_file
)
.
':'
.
'fontsize='
.
$this
->
calcFontSize
(
$component
->
font_size
,
$content
)
.
':'
.
'fontcolor='
.
$text_color
.
'@1.0:'
.
'x='
.
escapeshellarg
(
VideoTemp
::
POSITION_FFMPEG
[
$component
->
position
][
0
])
.
':'
.
...
...
Please
register
or
login
to post a comment