FFMPEG filter之Timeline editing

有些filter是支持enable參數的。比如drawtext,對於這些支持enable參數的filter,這個參數通過判斷一些邏輯問題,來判斷當幀是否進入這個filter。

如果邏輯是零,那就不改變幀的信息,把幀傳入filtergraph中當前filter 的下一個filter中;

如果邏輯是非零,那當前幀就進入該filter,接受這個filter的處理,處理完該幀後再傳給下一個filter
enableoption支持的邏輯表達式中的值有:

  • ‘t’
    timestamp expressed in seconds, NAN if the input timestamp is unknown
  • ‘n’
    sequential number of the input frame, starting from 0
  • ‘pos’
    the position in the file of the input frame, NAN if unknown
  • ‘w’
  • ‘h’
    width and height of the input frame if video

和其他filter的option一樣,enableoption遵循一些原則。如下:
eg1:使用drawtext filter 在第3秒到第5秒之間加入文字:

drawtext=enable='between(t,3,5)'

eg2:使用curves filter從第三秒開始:

curves  = enable='gte(t,3)' : preset=cross_process

想要知道哪些filter支持enableoption,可以使用:ffmpeg -filters命令,凡是filter有 T的都支持timeline editing

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