如何設定 ffmpeg 濾鏡的起始位置?

如何設定 ffmpeg 濾鏡的起始位置?

是否有從指定開始位置應用 ffmpeg 過濾器的標準方法,或者這對於不同的過濾器是否有所不同?

例如,如果我應用模糊,我可以輕鬆模糊整個剪輯,但如果我想從 5 秒鐘開始模糊,我將如何實現這一目標(無需修剪並連接回來)?

答案1

最簡單的方法是使用具有以下功能的過濾器時間軸支援enable選項)。

查看過濾器列表ffmpeg -filters並查找T名稱旁邊的。例子:

Filters:
  T.. = Timeline support
  .S. = Slice threading
  ..C = Command support
  A = Audio input/output
  V = Video input/output
  N = Dynamic number and/or type of input/output
  | = Source or sink filter
[...]
 TSC avgblur           V->V       Apply Average Blur filter.
 T.. boxblur           V->V       Blur the input.
 T.C dblur             V->V       Apply Directional Blur filter.
 TSC gblur             V->V       Apply Gaussian Blur filter.
 T.. sab               V->V       Apply shape adaptive blur.
 T.. smartblur         V->V       Blur the input video without impacting the outlines.
 TS. unsharp           V->V       Sharpen or blur the input video.
 TSC yaepblur          V->V       Yet another edge preserving blur filter.

所以所有這些模糊濾鏡都支援它。

從時間戳記 5 到結束模糊的範例指令:

ffmpeg -i input.mp4 -vf "boxblur=enable='gt(t,5)'" -c:a copy output.mp4

附加功能列表

如果過濾器沒有時間軸支持,解決方法是使用修剪設定點過濾器選擇要過濾的視訊時間,然後覆蓋或者連接過濾器來放置它。這個網站上應該有幾個例子。

相關內容