[英]FFmpeg side by side video (widescreen) and play each video one by one
new to ffmpeg, I've already did this to combine 3 or more videos that I have into 1 video: ffmpeg 的新手,我已经这样做了将我拥有的 3 个或更多视频合并为 1 个视频:
ffmpeg -i left.mp4 -i center.mp4 -i right.mp4 -filter_complex "[0:v:0][1:v:0][2:v:0]hstack=inputs=3" -c:v libx264 -tune film -crf 16 -b:a 256k output.mp4
Now what I am having trouble with is the videos have different play times (in seconds) what I want to achieve is have them all side by side (working with the code above) then have left.mp4 play first (with it's own audio) once done, center.mp4 plays (has own audio), and when done too, right.mp4 plays (has own audio) as well and the video is over.现在我遇到的问题是视频有不同的播放时间(以秒为单位)我想要实现的是让它们并排(使用上面的代码)然后让 left.mp4 先播放(使用它自己的音频)完成后,center.mp4 播放(有自己的音频),完成后,right.mp4 也播放(有自己的音频),视频结束。
Can someone enlighten me on how to achieve this?有人可以启发我如何实现这一目标吗? Thank you!谢谢!
Add the tpad and concat filters.添加tpad和concat过滤器。 Example where each input is 10 seconds long:每个输入长度为 10 秒的示例:
ffmpeg -i left.mp4 -i center.mp4 -i right.mp4 -filter_complex "[1:v]tpad=start_duration=10:start_mode=clone[v1];[2:v]tpad=start_duration=20:start_mode=clone[v2];[0:v:0][v1][v2]hstack=inputs=3,format=yuv420p[v];[0:a][1:a][2:a]concat=n=3:v=0:a=1[a]" -map "[v]" -map "[a]" -c:v libx264 -tune film -crf 16 -b:a 256k -movflags +faststart output.mp4
This will freeze frame the first frame of each video until it begins.这将冻结每个视频的第一帧,直到它开始。 If you want a solid color instead change start_mode=clone
to start_mode=add
.如果您想要纯色, start_mode=clone
更改为start_mode=add
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.