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
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…