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?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With