Filter 给定帧上的ffmpeg drawbox

Filter 给定帧上的ffmpeg drawbox,filter,ffmpeg,frame,Filter,Ffmpeg,Frame,我有数千个矩形框添加到视频中。现在我正在使用以下命令: ffmpeg.exe -i small.ts -vf drawbox=10:10:50:50:red,drawbox=100:100:200:200:green small_with_box.ts 但是,我不想在整个框架上添加框,而是在给定的框架上添加框。有人知道我该怎么做吗?视频过滤器支持。您可以查看哪些筛选器支持时间轴编辑: $ ffmpeg -filters … Filters: T. = Timeline support

我有数千个矩形框添加到视频中。现在我正在使用以下命令:

ffmpeg.exe -i small.ts -vf drawbox=10:10:50:50:red,drawbox=100:100:200:200:green small_with_box.ts
但是,我不想在整个框架上添加框,而是在给定的框架上添加框。有人知道我该怎么做吗?

视频过滤器支持。您可以查看哪些筛选器支持时间轴编辑:

$ ffmpeg -filters
…
Filters:
  T. = Timeline support
  .S = Slice threading
  A = Audio input/output
  V = Video input/output
  N = Dynamic number and/or type of input/output
  | = Source or sink filter
…
 .. deshake          V->V       Stabilize shaky video.
 T. drawbox          V->V       Draw a colored box on the input video.
 T. drawgrid         V->V       Draw a colored grid on the input video.
您可以看到
drawbox
drawgrid
具有时间轴支持,但
deshake
目前没有

用法示例。这将从第28-32帧开始放置红色框,从60秒开始放置绿色框。有关其他函数,请参见表达式求值文档

ffmpeg -i small.ts -vf "drawbox=enable='between(n,28,32)' : x=10 : y=10 : w=50 \
: h=50 : color=red,drawbox=enable='gte(t,60)' : x=100 : y=100 : w=200 : \
h=200 : color=green" -codec:a copy small_with_box.ts