如何在 ffmpeg 中添加黑色淡入淡出过渡时连接文件列表中的视频
我有一段代码可以连接文件列表中的视频。它工作完美。
ffmpeg -f concat -safe 0 -i file_list.txt -c copy mergedVideo.avi
但是,我想在每个视频之间添加黑色淡入淡出过渡。我发现这个代码片段显然可以做到这一点,但它要求您手动输入每个文件。
ffmpeg -i in.mp4 -i main.mp4 -i out.mp4 -filter_complex \
"[0:v]fade=type=out:duration=2:start_time=28,setpts=PTS-STARTPTS[v0]; \
[1:v]fade=type=in:duration=2,fade=type=out:duration=2:start_time=28,setpts=PTS-STARTPTS[v1]; \
[2:v]fade=type=in:duration=2,setpts=PTS-STARTPTS[v2]; \
[v0][0:a][v1][1:a][v2][2:a]concat=n=3:v=1:a=1[v][a]" \
-map "[v]" -map "[a]" output.mp4
我希望能够从 txt 文件读取所有视频文件,因为我有数百个视频。如何组合这两个片段,或者是否有更好的方法来完成淡入淡出过渡的连接?
I have a piece of code that concats videos from a file list. It works perfectly.
ffmpeg -f concat -safe 0 -i file_list.txt -c copy mergedVideo.avi
However, I want to add a black fade transition between each video. I found this code snippet that apparently does this, but it requires you to input each file by hand.
ffmpeg -i in.mp4 -i main.mp4 -i out.mp4 -filter_complex \
"[0:v]fade=type=out:duration=2:start_time=28,setpts=PTS-STARTPTS[v0]; \
[1:v]fade=type=in:duration=2,fade=type=out:duration=2:start_time=28,setpts=PTS-STARTPTS[v1]; \
[2:v]fade=type=in:duration=2,setpts=PTS-STARTPTS[v2]; \
[v0][0:a][v1][1:a][v2][2:a]concat=n=3:v=1:a=1[v][a]" \
-map "[v]" -map "[a]" output.mp4
I want to be able to read all the video files from a txt file as I have hundreds of videos. How do I combine these two snippets, or is there a better way to accomplish the concat with fade transitions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论