Date/time overlay in timelapse video

I use Kdenlive to create timelapse videos captured by cameras recording at normal speed.

I’m struggling to add real-world date/time overlays to my projects so my audience knows what time it was, at the time of recording, when they see something of interest.

For example, I combine 2 video files spanning 3 hours each. I know exactly what time each video starts and stops at. I want to increase the playback speed by of each clip by 2500x and I want to display the time of day, at the time of recording, in the corner, also at 2500x speed.

e.g.

File 1 Start: July 7, 2023 6:00am
File 1 Stop: July 7, 2023 9:00am

File 2 Start: July 7, 2023 9:00am
File 2 Stop: July 7, 2023 12:00pm

I’m striking-out with both dynamic text and counters.

Does anyone have any suggestions for achieving this effect?

Was hoping for a stamp format something like this: m/d/yyyy h:mm:ss

Maybe with the Timer effect: Timer — Kdenlive Manual 23.04 documentation

Add the effect before you change the speed.

Thanks for the suggestion!

I added the timer effect, then changed the clip speed, but I’m afraid the timer values didn’t scale with speed.

I also don’t see a formatting option for date, either, just these:

  • HH:MM:SS
  • HH;MM:SS.S
  • MM:SS
  • MM:SS.SS
  • MM:SS.SSS
  • SS
  • SS.S
  • SS.SS
  • SS.SSS

I’m open to FFMPEG command-line suggestions, too. The drawtext functions seem as powerful as they are cryptic. Might need to marinate those in alcohol before they sink in.

Still hope the Kdenlive gui can bail me out.

For clarity, this is the effect I’m aiming to achieve:
Timestamp at compressed speed

Hmm, perhaps with a modified .gpx file and the GPS Text effect.

Bottom line is, you need to jump through some hoops to get this done in Kdenlive …

At the time of writing, I haven’t found a solution to my timestamp problem using Kdenlive, but I did find a solution using FFMPEG in Linux.

In the interest of helping others, I’m posting what worked for me:

FFMPEG Version:
ffmpeg version 4.4.2-0ubuntu0.22.04.1

Command Used:

ffmpeg -an -y -i input.mp4 -vf "drawtext=fontfile=/usr/share/fonts/opentype/urw-base35/NimbusSans-Bold.otf:
fontsize=72:
fontcolor=yellow:
bordercolor=black:
borderw=2:
box=1:
boxcolor=gray:
x=0:
y=h-th:
text='%{pts\:localtime\:1689362040\:%d %B %Y %I\\\\\:%M\\\\\:%S%p}',
setpts=PTS/10,
scale=1920x1080" -vcodec libx264 -crf 28 -f mp4 output.mp4

Notes on parameters used:

-an: removes audio

-y: overwrites existing file

x = 0 & y = t-th: this is for text placement (bottom-left corner); see here for more details.

text=‘%{pts:localtime:1689362040:%d %B %Y %I\\:%M\\:%S%p}’

  • PTS: presentation timestamp

  • localtime: use local time zone instead of GMT time

  • 1689362040: this is my begining overlay timestamp converted into Unix epoch format; in my case I wanted the text overlay to start at Friday, July 14, 2023 12:14:00 PM, which is 1689362040; use a Unix epoch converter to switch from human to Unix timestamps.

  • %d: day of month

  • %B: spelled-out month

  • %Y: 4-digit year

  • %I: hour (12hr clock)

  • %M: minute

  • %S: second

  • %p: AM/PM stamp

setpts=PTS/10: increases speed of video, in this case 10x

scale=1920x1080: resizes output video resolution

-vcodec libx264: encode using the libx264 library

-crf 28: sets output quality (23 is defauly, 0 is lossless, 51 is lowest quality)

-f mp4: force mp4 format

The command above produces this effect:

output example

2 Likes

Thank you very much for sharing! This is what this community is all about: helping each other and providing solutions!

May I incorporate that in the official Kdenlive documentation as a How-to?

Of course!

It took much trial and error to get the result I wanted, so if anyone has a better solution, then please don’t hesitate to enlighten me.

can someone propose this as a feature to kdenlive?

this would be really useful

I could try the ffpmeg solution but it messes with the workflow in my case

Feel free to create a Feature Request here. Just put “[Feature Request]” in the subject line :wink:

From the “awful hacks, but entirely within kdenlive” dept:

You should be able to create a ‘dummy clip’, like a colour clip or similar, of the duration you want to run the timer for, then apply the timer to that and render it (at normal speed). You can then overlay that rendered clip, and speed it up, slow it down, or time remap it in the same way you do for the video of interest.