如何在 ffmpeg 中组合这两个过滤器

How can I combine these two filters in ffmpeg

所以我尝试在图像上叠加视频,然后在 ffmpeg 中的图像上添加文本我发现我可以单独完成所有这些操作,但是在组合时会出现

错误

Cannot find a matching stream for unlabeled input pad 0 on filter Parsed_drawtext_2

代码行:

ffmpeg -loop 1 -i overlay.png -re
-i overlay.mp4 
-filter_complex "[1]scale=1660:934[inner];[0][inner]overlay=0:0:shortest=1[out];
drawtext=fontsize=40:fontfile=FreeSerif.ttf:textfile=text.txt:x=(w-text_w)/2:y=(h-text_h)/2:reload=1"
-map "[out]" -map 1:a -c:a copy -y -s 1280x800 output.mp4

谁能帮我解决这个问题?

你差不多明白了。只需要重新安排一下:

ffmpeg -loop 1 -i overlay.png
-i overlay.mp4 
-filter_complex "[1]scale=1660:934[inner];[0][inner]overlay=0:0:shortest=1,scale=1280:800,drawtext=fontsize=40:fontfile=FreeSerif.ttf:textfile=text.txt:x=(w-text_w)/2:y=(h-text_h)/2:reload=1[out]"
-map "[out]" -map 1:a -c:a copy output.mp4

有关语法的快速说明,请参阅 FFmpeg filtering intro