I have a set of few hundreds of photos taken every 30 minutes. I combine them into a single video. How can I put a timestamp presenting real time difference between each photo ?

Right now I use timecode filter with the following settings:

ffmpeg -i %04d.png -vf format=yuv420p,scale=1650x1180,fps=24,drawtext="fontsize=15:fontfile=/Library/Fonts/DroidSansMono.ttf:timecode='00\:00\:00\:00':rate=24:text='time\:':fontsize=72:fontcolor='white':x=860-text_w/2:y=960" out_24fps.mp4

This creates timestamp showing the length of the video which takes ~7 seconds. I'd like the timestamp to show that how long it took to record the whole video rather than how long it takes to replay it (difference of 30 minutes between each photo).

Or perhaps is it possible to take a timestamp from each file used to combine the video?

1 Answer 1


Timecode isn't suitable for this. It assumes real-time footage. You can use the eif and n functions to increment the text counter to advance by 30 mins for each frame i.e.

ffmpeg -framerate 24 -i %04d.png -vf format=yuv420p,scale=1650x1180,drawtext="fontsize=15:fontfile=/Library/Fonts/DroidSansMono.ttf:text='time\: %{eif\:n*(30/60)\:d} h %{eif\:mod(n*30\,60)\:d\:2} m':fontsize=72:fontcolor='white':x=860-text_w/2:y=960" out_24fps.mp4

(BTW, framerates for image sequences should be set on the input. Using fps filter here will cause ffmpeg to drop one frame from each second.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.