I'm currently trying to implement a timer on a video with FFMPEG, so it should start at 00.00 and start timing after a number of frames and stop timing again after a set amount of frames. So the timer should work like this:
00:00
00:00
00.00
(start timing) 00.01
00.02
[...]
05.88
05.89
(stop timing) 05.89
05.89
05.89
So far I've got the following as (minimal) command:
ffmpeg -i input.mp4
-filter_complex "[0:v]drawtext=fontfile='C\\:font.ttf':
text='%{eif\\:n/30\\:d\\:2}\\:%{eif\\:((mod(n,30))/30)*100\\:d\\:2}':
fontcolor=black:fontsize=55:x=(1705.5-(text_w/2)):y=(1000.5-(text_h/2)),format=yuv420p"
-pix_fmt yuv420p -c:a copy out.mp4
There is some more stuff inside of the filter_complex, so I can't replace that with -vf
or similar.
Thanks for all of your help!
Suppose you want to start the count at n=200
and end at n=700
. Then let's call min(max(n-200,0),700-200)
as X
Your text expression now becomes
text='%{eif\\:X/30\\:d\\:2}\\:%{eif\\:((mod(X,30))/30)*100\\:d\\:2}'