I'm trying to change text dynamically every 5 minutes on my live video stream
This is the argument im using:
-vf "drawtext=fontsize=40:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h)/2"
I tried 'c' in the FFMPEG console windows but I can't get it right, I always get a parse error.
Is there an example of how to use this options?
Thanks.
Exept a reload you also need to write the file atomically. Update the text to a temporarily file first and then rename it. If not, at some point FFMpeg will read null data and fails when the file is created and no text is written yet.
- Create livetext.txt.tmp with the text for the next 5 minutes.
- Rename livetext.txt.tmp to livetext.txt.
repeat this process every 5 minutes.
-vf "drawtext=fontsize=40:fontfile=FreeSerif.ttf:textfile=/path/livetext.txt:x=(w-text_w)/2:y=(h-text_h)/2:reload=1"
With reload Ffmpeg reads the text every frame, so updates are almost instantaneous. For details see Drawtext filter