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

Adam Nielsen a.nielsen at shikadi.net
Tue Mar 1 07:17:06 EET 2022


> > 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.
> 
> Regarding I/O load, I know it’s probably negligible, but it just
> offends my sensibilities to read something 11,999 times for no
> reason. And if this feature gets implemented (thank you, Gyan!!!)
> then I won’t have to worry about where I put the tmp file.

That's probably the best reason for something like this where it's
"just better" even if there is no tangible benefit :)

However what bothers me more than a little I/O is all the CPU
calculations required to load and parse the font file, interpret the
arcs and lines in the font, calculate the shape of each character, draw
it all in and antialias the lines to give smooth characters, and do all
*that* repeatedly on every single frame even if the text hasn't changed.

I guess in some ways if efficiency is what you're after, it would be
better to render the whole thing to a raw image file as needed, and
then just copy those pixels across as-is on every frame.

It's actually something I have been meaning to look in to, because I
wouldn't mind being able to overlay an icon or two onto the video as
well as just text.

Cheers,
Adam.


More information about the ffmpeg-user mailing list