ffmpeg drawbox on a given frame

北慕城南 提交于 2019-12-07 06:59:53

问题


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?


回答1:


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.

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

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


来源:https://stackoverflow.com/questions/17339841/ffmpeg-drawbox-on-a-given-frame

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!