ffmpeg在给定的框架上绘制框架 [英] ffmpeg drawbox on a given frame

查看:788
本文介绍了ffmpeg在给定的框架上绘制框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have thousands of rectangle boxes to add in a video. Right now I am using this command:

ffmpeg.exe -i small.ts -vf drawbox=10:10:50:50:red,drawbox=100:100:200:200:green small_with_box.ts

不想在整个框架上添加框,而是在给定的框架上添加框。任何人都知道我该怎么做?

However I don't want to add the boxes on an entire frame, but on a given one. Anyone know how can I do that?

推荐答案

drawbox 视频过滤器具有时间轴编辑支持。您可以看到哪些过滤器支持时间轴编辑:

The drawbox video filter has timeline editing support. You can see what filters support 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 目前没有。

You can see that drawbox and drawgrid have timeline support, but deshake currently does not.

用法示例。这将从框28-32放置红色框,绿色框从60秒开始。另请参阅有关其他功能的表达式评估的文档。

Usage example. This will place the red box from frames 28-32, and the green box starting at 60 seconds. Also see the documentation on expression evaluations for additional functions.

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

这篇关于ffmpeg在给定的框架上绘制框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆