[FFmpeg-user] drawtext reload=N > 1?

Adam Nielsen a.nielsen at shikadi.net
Mon Feb 28 08:49:25 EET 2022


> Would it be worthy feature request to allow drawtext to accept
> integer values N > 1, and then reload the text file every Nth frame?
> It seems like a win for CPU and I/O loading, with the benefit of
> being fully backward compatible with existing scripts that read in
> every 1 frame (e.g. reload=1).
> 
> Or are there downsides to this that I’m not seeing?

I thought about something similar as I'm also overlaying infrequently
changed data (temperature) onto video.

However I ended up putting the file on a tmpfs partition so there's no
actual disk IO, the whole thing sits in memory anyway.

Have you tried benchmarking to see how much benefit you'd get from this
optimisation?  You could check CPU usage and I/O load with reload=1 and
again with reload=0 and see what the difference is.  Let us know what
you find, as I haven't actually tried this myself so it would be
interesting to know what the impact is of reading the file on every
frame.

> * and yes, I’m writing to weather.tmp and cping to weather.txt to
> prevent a file I/O collision.

Do you mean "mv" instead of "cp"?  I don't think "cp" is atomic but
"mv" is.  Using "cp" won't break anything but you might get a frame
here or there with incomplete data.

Cheers,
Adam.


More information about the ffmpeg-user mailing list