How to draw text on image? (FFMPEG drawtext command)

  • I want to read a local image file, draw text on it as an overlay, and write it back locally using ffmpeg in a shell command (overlay timestamp sourced from filename)

  • I’m trying to use the ffmpeg drawtext filter

  • My image is in www and I can read/write it (copy/move/rename etc)

I’ve tried:

  • Lots of keyword searches for relevant home assiantant threads.

  • a squillion combinations of syntax variants I’ve found online

Apparently accessing the font file is the most common point of failure. ffmpeg is working fine for a bunch of other commands.
Setup is hassio on raspberry pie.

Threads I’ve looked at:

Here’s the kind of thing I’ve tried. I swear I’ve tried a gazillion variants of this over a squillion hours. Especially paths, escaping, and ", ': fiddling.

  drawtext: 'ffmpeg -i /config/www/motioneye_files/GiraffeCam1/all_timelapse/lastestGiraffe.jpg -vf drawtext=fontfile="arial.ttf":text=Last60min -y /config/www/motioneye_files/GiraffeCam1/all_timelapse/drawtext_lastestGiraffe.jpg'
  drawtext2: 'ffmpeg -i /config/www/motioneye_files/GiraffeCam1/all_timelapse/lastestGiraffe.jpg -vf drawtext=fontfile=arial.ttf:text=Last60min -y /config/www/motioneye_files/GiraffeCam1/all_timelapse/drawtext_lastestGiraffe.jpg'
  drawtext3: 'ffmpeg -i /config/www/motioneye_files/GiraffeCam1/all_timelapse/lastestGiraffe.jpg -vf drawtext=text=Last60min -y /config/www/motioneye_files/GiraffeCam1/all_timelapse/drawtext_lastestGiraffe.jpg'

If anyone could confirm they have a ffmpeg drawtext filter working and how, that would be really great!!!