ffmpeg做基本的音视频编辑还是比较简单的,但要做一些滤镜及特效就比较麻烦了。接下来看看借用frei0r
插件怎么做;
你可以将frei0r看作是一个"视频特效工具箱"。比如你有一段视频,你想给它加上某种特殊效果,例如让它变成黑白色,或者添加一个模糊效果,而frei0r就包含了许多这样的特效工具,我们称它们为"插件"。
下图报错是已ffmpeg编辑启用frei0r,但没安装好;
1、先下载插件
下载最新的解压即可https://github.com/dyne/frei0r/releases
2、置环境变量
这是我的(也就是那些滤镜dll的目录)
$env:FREI0R_PATH
D:\Program Files\frei0r-v2.3.1_win64\filter
参数释义参考:
https://www.mltframework.org/plugins/PluginsFilters/
https://gstreamer.freedesktop.org/documentation/frei0r
当然,frei0rb不仅仅有以下效果,这里只是抛砖引玉;
ffmpeg -i input.mp4 -vf "frei0r=filter_name=coloradj_rgb:filter_params=1.5|1.2" coloradj_rgb_1.5_1.2.mp4
ffmpeg -i input.mp4 -vf "frei0r=filter_name=distort0r:filter_params=0.1|0.01" distort0r_0.1_0.01.mp4
ffmpeg -i input.mp4 -vf "frei0r=filter_name=glow:filter_params=0.5" glow_0.5.mp4
其实在其他工具中也有集成frei0r
的,比如mlt framework,简单看看mlt下的使用示例;
用frei0r
做的转场
trans_darken_1.0.mlt
<mlt>
<producer id="clip1">
<property name="resource">input.mp4</property>
<property name="length">00:00:03623</property>
</producer>
<producer id="clip2">
<property name="resource">input2.mp4</property>
<property name="length">00:00:10,000</property>
</producer>
<tractor id="tractor0">
<track producer="clip1" in="00:00:02.600" out="00:00:03.600"/>
<track producer="clip2" in="00:00:00.000" out="00:00:01.000"/>
<transition id="transition0" out="00:00:01.000">
<property name="a_track">0</property>
<property name="b_track">1</property>
<property name="mlt_service">frei0r.darken</property>
</transition>
</tractor>
<playlist id="videotrack0">
<entry producer="clip1" in="00:00:00.000" out="00:00:02.567" />
<entry producer="tractor0" in="00:00:00.000" out="00:00:01.000" />
<entry producer="clip2" in="00:00:01.000" out="00:00:10.000" />
</playlist>
</mlt>
生成命令
melt trans_darken_1.0.mlt -consumer avformat:trans_darken_1.0.mp4
效果
https://blog.csdn.net/weixin_41530622/article/details/132543049
https://www.cnblogs.com/nlsoft/archive/2013/05/07/3065311.html