The #ffmpeg "drawtext" filter [1] is powerful, but once you need to write some dynamic data (e.g. overlay temperature on timelapse), one way to do it is to load the image and do your processing in your programming language of choice, and then pipe raw frames to ffmpeg using "rawvideo" input [2].
E.g. in Python it would be:
with Image.open(path) as img:
img=img.convert('RGB')
# Do your thing...
sys.stdout.buffer.write(img.tobytes())
[1] https://ffmpeg.org/ffmpeg-filters.html#drawtext-1
[2] https://ffmpeg.org/ffmpeg-formats.html#rawvideo



