如何在ffmpeg中将showwaves位置调整到视频的底部?

问题描述

我正在尝试使用 ffmpeg 调整视频中波形的位置,认位置在中心,但我想将其移到底部。我知道我需要使用覆盖过滤器,但如何调用它是我的问题。我试过了,但没有用。

ffmpeg -i security3.mp3 -filter_complex "[0:a]showwaves=s=1280x202:mode=line[sw]; [sw]overlay=0:H-h,drawtext=fontcolor=white:x=10:y=10:text='\"Song Title\" by Artist'[out]" -map "[out]" -map 0:a -c:v libx264 -preset fast -crf 18 -c:a copy output.mp4

我收到此错误

Cannot find a matching stream for unlabeled input pad 1 on filter Parsed_overlay_1

有人可以帮我吗?

解决方法

overlay 需要 2 个输入:背景和前景。您只有 1 个输入:来自 showwaves 的波形。添加视频用作背景:

ffmpeg -i video.mp4 -i security3.mp3 -filter_complex "[1:a]showwaves=s=1280x202:mode=line[sw];[0:v][sw]overlay=0:H-h,drawtext=fontcolor=white:x=10:y=10:text='\"Song Title\" by Artist'[out]" -map "[out]" -map 1:a -c:v libx264 -preset fast -crf 18 -c:a aac output.mp4