有些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

本文详细解析了FFmpeg中enable参数的使用方法,包括其逻辑表达式中的各种值如't'、'n'、'pos'、'w'和'h'等,以及如何通过enable参数控制特定filter的开启与关闭,实现精准的视频处理效果。
17万+

被折叠的 条评论
为什么被折叠?



