[FFmpeg-user] Alternative to Dynamic Text

Carl Zwanzig cpz at tuunq.com
Thu Nov 4 18:27:49 EET 2021

(I haven't had enough coffee yet and my remembrance of the nuances of mmap 
are sketchy)

On 11/4/2021 5:14 AM, LianCheng wrote:
> Yes, would like to know in ffmpeg, under drawtext, the textfile (reload=1)
> is using read-write or read-only mode?

 From a quick read of the source code-
libavfilter/vf_drawtext.c uses libavutil/file.c av_file_map(); that opens 
the file in with O_RDONLY (read only).

If mmap exists (in the build of ffmpeg) that is used to map the file with 
PROT_READ|PROT_WRITE, which IIRC means that the memory map of the file may 
be back written to.

Either way, changing the size of the underlying file would interfere with 
the memory map of it, and changing the size of a file can upset programs 
that aren't expecting it.

In the end, drawtext in the ffmpeg executable doesn't appear to be the right 
tool for the job.


More information about the ffmpeg-user mailing list