ffmpeg视频滤镜:缓入缓出-fade

滤镜描述

fade

官网链接 => FFmpeg Filters Documentation

这个滤镜可以给视频加上一个缓入或者缓出的特效。

滤镜的使用

参数
复制代码
   type              <int>        ..FV....... set the fade direction (from 0 to 1) (default in)
     in              0            ..FV....... fade-in
     out             1            ..FV....... fade-out
   t                 <int>        ..FV....... set the fade direction (from 0 to 1) (default in)
     in              0            ..FV....... fade-in
     out             1            ..FV....... fade-out
   start_frame       <int>        ..FV....... Number of the first frame to which to apply the effect. (from 0 to INT_MAX) (default 0)
   s                 <int>        ..FV....... Number of the first frame to which to apply the effect. (from 0 to INT_MAX) (default 0)
   nb_frames         <int>        ..FV....... Number of frames to which the effect should be applied. (from 1 to INT_MAX) (default 25)
   n                 <int>        ..FV....... Number of frames to which the effect should be applied. (from 1 to INT_MAX) (default 25)
   alpha             <boolean>    ..FV....... fade alpha if it is available on the input (default false)
   start_time        <duration>   ..FV....... Number of seconds of the beginning of the effect. (default 0)
   st                <duration>   ..FV....... Number of seconds of the beginning of the effect. (default 0)
   duration          <duration>   ..FV....... Duration of the effect in seconds. (default 0)
   d                 <duration>   ..FV....... Duration of the effect in seconds. (default 0)
   color             <color>      ..FV....... set color (default "black")
   c                 <color>      ..FV....... set color (default "black")
  • type, 选择in(换入)或者out(缓出)。t 是type的简写
  • start_frame, 从第几帧开始使用这个特效,(s)是start_frame的缩写
  • nb_frames, 特效持续多帧。 如果你使用了out特效,并且start_frame设置的比较小,比如0。nb_frames如果设置的比较小的话,比如30,那么视频就会显示30帧了,因为30帧以后就是退出了。
  • alpha, 是不是启用遮罩,以缓入为例,启用遮罩的效果-> 纯黑-> 纯黑慢慢褪去->显示视频。 不启用的话就和正常播放没有区别。
  • start_time (st), 从第几秒开始应用特效。
  • duration(d), 特效持续的时间。当然start_time也可以和nb_frames进行搭配。
  • color(c), 遮罩的颜色。
案例
复制代码
ffmpeg -y -i ffm_media/short_dancer.mp4 -filter_complex "fade=in:0:30" result/fade/fade_test_001.mp4

从第0秒开始持续30帧,应用缓入效果。

复制代码
ffmpeg -y -i ffm_media/short_dancer.mp4 -filter_complex "fade=out:0:30" result/fade/fade_test_002.mp4

从第0秒开始,持续30帧,应用退出效果,30帧以后就剩下黑屏了

复制代码
ffmpeg -y -i ffm_media/short_dancer.mp4 -filter_complex "fade=out:start_time=4:duration=2" result/fade/fade_test_003.mp4

从第4秒开始,应用缓出效果,持续两秒

复制代码
ffmpeg -y -i ffm_media/short_dancer.mp4 -filter_complex "fade=out:start_time=4:duration=2:color=green" result/fade/fade_test_004.mp4

将缓出的遮罩应用为绿色

复制代码
ffmpeg -y -i ffm_media/short_dancer.mp4 -filter_complex "fade=in:5:20:color=yellow" result/fade/fade_test_005.mp4

将缓入的遮罩应用为黄色

复制代码
## 祝你好运
 
hope("大神多多指点")
topic("有问题可以交流呀")
concat("球球QUN", "61480", "9646")
include("电", "-","子", "=", "书")

相关推荐
努力犯错3 小时前
AI视频修复技术入门:从Sora水印谈起,我们如何“抹去”未来影像的瑕疵?
大数据·人工智能·语言模型·开源·音视频
dddddppppp1234 小时前
linux sdl图形编程之helloworld.
linux·运维·ffmpeg
1024小神8 小时前
xr-frame微信小程序xr-ar-tracker实现video视频竖屏或横屏播放
ar·音视频·xr
我血条子呢9 小时前
[HTML]播放wav格式音频
前端·html·音视频
zzfive9 小时前
Ovi-音视频生成模型
论文阅读·人工智能·深度学习·音视频
给大佬递杯卡布奇诺9 小时前
FFmpeg 基本API avio_read函数内部调用流程分析
c++·ffmpeg·音视频
深圳市青牛科技实业有限公司10 小时前
在电力系统、电子设备制造等领域,变压器测试感量,电桥内阻如何选择
嵌入式硬件·音视频·制造·立体声收录机·盒式录音机·电子烟
互联科技报15 小时前
机器人能否实现远程视频通话方便家属探视老人
机器人·音视频
ACP广源盛1392462567316 小时前
(ACP广源盛)GSV1175---- MIPI/LVDS 转 Type-C/DisplayPort 1.2 转换器产品说明及功能分享
人工智能·音视频
技术钱20 小时前
uniapp使用音频录音功能
chrome·uni-app·音视频