使用FFMPEG一次应用两个过滤器(Showwaves和Drawtext)

时间:2018-11-25 14:56:08

标签: ffmpeg drawtext

我在视频中使用以下命令:

ffmpeg -i input.mp3 -i input.mp4 -y -ss 00:00:00 -t 00:00:10 -filter_complex "[0:a]showwaves=s=1920x175:colors=Yellow:mode=cline,colorkey=0x000000:0.01:0.1,format=yuva420p[v];[1:v][v]overlay=0:800[outv]" -map "[outv]" -pix_fmt yuv420p -map 0:a -c:v libx264 -c:a copy -shortest output.mp4

和此视频命令:

ffmpeg -i input.mp4 -y -ss 00:00:00 -t 00:00:10 -vf drawtext="fontfile=/path/to/font.ttf: text='My Text': fontcolor=white: fontsize=74: box=1: boxcolor=black@0.5: boxborderw=5: x=(w-text_w)/2: y=(h-text_h)/2" -c:v libx264 -c:a copy -shortest output.mp4

我想将这两个命令合并为一个命令。我看到this question,并尝试了几次但没有成功。

2 个答案:

答案 0 :(得分:0)

只需将其添加到叠加层之后:

[1:v][v]overlay=0:800,
       drawtext="fontfile=/path/to/font.ttf: text='My Text': fontcolor=white: fontsize=74: box=1: 
       boxcolor=black@0.5: boxborderw=5: x=(w-text_w)/2: y=(h-text_h)/2"[outv]"

答案 1 :(得分:0)

非常感谢!这是工作!我很开心!

ffmpeg -i input.mp3 -i input.mp4 -y -ss 00:00:00 -t 00:00:10 -filter_complex "[0:a]showwaves=s=1920x175:colors=Yellow:mode=cline,colorkey=0x000000:0.01:0.1,format=yuva420p[v];[1:v][v]overlay=0:800,drawtext=fontfile=/path/to/font.ttf: text='My Text': fontcolor=white: fontsize=74: box=1: boxcolor=black@0.5: boxborderw=5: x=(w-text_w)/2: y=(h-text_h)/2" -pix_fmt yuv420p -map 0:a -c:v libx264 -c:a copy -shortest output.mp4