【发布时间】:2013-06-24 18:13:17
【问题描述】:
我有数千个矩形框要添加到视频中。现在我正在使用这个命令:
ffmpeg.exe -i small.ts -vf drawbox=10:10:50:50:red,drawbox=100:100:200:200:green small_with_box.ts
但是,我不想在整个框架上添加框,而是在给定的框架上添加框。有谁知道我该怎么做?
【问题讨论】:
我有数千个矩形框要添加到视频中。现在我正在使用这个命令:
ffmpeg.exe -i small.ts -vf drawbox=10:10:50:50:red,drawbox=100:100:200:200:green small_with_box.ts
但是,我不想在整个框架上添加框,而是在给定的框架上添加框。有谁知道我该怎么做?
【问题讨论】:
drawbox 视频过滤器支持timeline editing。您可以查看哪些过滤器支持时间线编辑:
$ 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
【讨论】: