FFmpeg frei0r插件使用學習

背景

ffmpeg做基本的音視頻編輯還是比較簡單的,但要做一些濾鏡及特效就比較麻煩了。接下來看看借用frei0r插件怎麼做;

簡介

你可以將frei0r看作是一個"視頻特效工具箱"。比如你有一段視頻,你想給它加上某種特殊效果,例如讓它變成黑白色,或者添加一個模糊效果,而frei0r就包含了許多這樣的特效工具,我們稱它們爲"插件"。

官網:https://frei0r.dyne.org/

環境準備

Windows

下圖報錯是已ffmpeg編輯啓用frei0r,但沒安裝好;

image-20231024151818004

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不僅僅有以下效果,這裏只是拋磚引玉;

原視頻

image-20231024163430116

顏色調整

ffmpeg -i input.mp4 -vf "frei0r=filter_name=coloradj_rgb:filter_params=1.5|1.2" coloradj_rgb_1.5_1.2.mp4

image-20231024163444874

扭曲

ffmpeg -i input.mp4  -vf "frei0r=filter_name=distort0r:filter_params=0.1|0.01" distort0r_0.1_0.01.mp4

image-20231024165335643

光暈

ffmpeg -i input.mp4 -vf "frei0r=filter_name=glow:filter_params=0.5" glow_0.5.mp4

image-20231024164521492

其他

其實在其他工具中也有集成frei0r的,比如mlt framework,簡單看看mlt下的使用示例;

melt使用

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 

效果

image-20231025181703044

[參考]

https://blog.csdn.net/weixin_41530622/article/details/132543049

https://www.mltframework.org/

https://www.cnblogs.com/nlsoft/archive/2013/05/07/3065311.html

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章