合并音频和视频,并在其顶部与ffmpeg添加覆盖层
我正在为Python编程一个简单的脚本,以通过MP3从静态图像中制作视频,并在其顶部添加覆盖层。 此覆盖层是视频,透明或黑色(屏幕),例如移动的徽标。
覆盖持续时间为5分钟。 我所有的MP3都在5分钟以下(通常为2-3分钟),因此视频应具有音频的持续时间,而不是覆盖层。 覆盖尺寸始终是1920x1080,以及我的图像,因此我不必处理决议。
我正在使用RAW FFMPEG命令来实现它,但是我坚持使用filter_complex,以添加覆盖层。文档似乎很复杂,我无法理解。 这是我所拥有的:
ffmpeg -r 25 -loop 1 -i nature.jpg -i nature_sound.mp3 -acodec copy \
-shortest -pix_fmt yuv420p nature_video.mp4
如何在自然上添加mp4视频覆盖层。我想学习那些过滤室,如果有人能帮助我一些细节,那就太好了!谢谢。
[更新命令]
ffmpeg -r 25 -loop 1 -i ./nature.jpg -i ./overlay.mp4 -i nature_sound.mp3 \
-filter_complex "[1]setsar=sar=1,format=rgba [video]; [0][video]blend=all_mode=screen[out]" \
-map [out] output.mp4
I'm programming a simple script in Python to make a video from a static image with an mp3, and add an overlay on top of it.
This overlay is a video, transparent or black (Screen) for example a logo that moves.
The overlay duration is 5minutes.
All my mp3 are under 5min (generally 2-3min), so the video should have the duration of the audio, not the overlay.
The overlay size is always 1920x1080, as well as my image so I don't have to deal with resolutions.
I'm using raw FFMpeg command to achieve it, but I'm stuck to filter_complex things, in order to add the overlay. The docs seems so complicated, I can't get it.
Here is what I have:
ffmpeg -r 25 -loop 1 -i nature.jpg -i nature_sound.mp3 -acodec copy \
-shortest -pix_fmt yuv420p nature_video.mp4
How to add an MP4 video overlay on top of the nature.jpg, and the whole video having only the sound of nature_sound.mp3? I would like to learn those filter complex, if anyone can help me with some details it would be great! Thank you.
[updated command]
ffmpeg -r 25 -loop 1 -i ./nature.jpg -i ./overlay.mp4 -i nature_sound.mp3 \
-filter_complex "[1]setsar=sar=1,format=rgba [video]; [0][video]blend=all_mode=screen[out]" \
-map [out] output.mp4
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它应该像:
It should be as simple as: