如何使用ffmpeg在串联视频之间进行淡入/淡出效果 [英] How to make fade in/out effect between concatenate videos using ffmpeg

查看:175
本文介绍了如何使用ffmpeg在串联视频之间进行淡入/淡出效果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有三个视频,分为三个部分,分别是开始,主视频和结束,在其中将它们连接在一起,我想在第一个视频的末尾和开始处添加淡入/淡出效果第三部影片中的影片,因此观众可以很好地将它们分开.
我使用此代码通过将视频名称添加到文本文件

I have three videos which divide into three parts on is the start then main video then end of the video in which I concatenate them together I want to add fade in/out effect at the end of the first video and at the start of the third video so they are separated nicely to the viewer.
i used this code to concatenate the video together by adding videos name to the text file

ffmpeg -f concat -i ffmpeg-sound.txt -c copy final_output.mp4

现在我应该通过什么命令,以便我可以添加此效果,因为我不擅长ffmgep.或是否还有其他事情要遵循.
预先感谢

now what command should i pass so i can add this effect as iam not good at ffmgep. or if there is any other things to follow.
Thanks in advance

推荐答案

使用淡入淡出 concat 过滤器.在此示例中,每个输入的时长为30秒,每个完全淡入的时长为4秒.

Use the fade and concat filters. In this example each input is 30 seconds long and each complete fade is 4 seconds long.

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

这假设每个输入具有相同的参数(宽度,高度,蒸汽数量等).如果不是,则添加各种过滤器(例如比例尺),以使每个输入符合一组通用的参数.该网站上有许多示例显示了如何执行此操作.

This assumes that each input has the same parameters (width, height, number of steams, etc). If not then add various filters, such as scale, to conform each input to a common set of parameters. There are many examples on this site showing how to do this.

这篇关于如何使用ffmpeg在串联视频之间进行淡入/淡出效果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆