[FFmpeg-user] drawtext reload=N > 1?
ffmpeg at gyani.pro
Wed Mar 2 09:29:29 EET 2022
On 2022-02-28 12:28 pm, Gyan Doshi wrote:
> On 2022-02-28 10:37 am, Steven Kan wrote:
>> I am overlaying real-time weather on streaming video:
>> I have a script reading from openweather.org every 10 minutes and
>> writing to weather.txt*, and then drawtext reads weather.txt and
>> applies it via:
>> ./ffmpeg -thread_queue_size 2048 -hwaccel videotoolbox -i
>> 'rtsp://anonymous:firstname.lastname@example.org:554' -hwaccel videotoolbox
>> -i 'rtsp://anonymous:email@example.com:554' -vcodec
>> h264_videotoolbox -b:v 5000k -acodec copy -t 2:00:00 -filter_complex
>> textfile=/tmp/weather.txt: fontcolor=white: fontsize=48:
>> x=(w-text_w)*0.01: y=(h-text_h)*0.01:reload=600'" -f flv
>> It’s working, but it seems very inefficient to read weather.txt every
>> 1 frame when it gets updated only every 12,000 frames.
>> According to the documentation, reload is a Boolean to read every
>> frame or not, and attempting reload=2 or reload=600 results in:
>> [drawtext @ 0x7fa696010600] Unable to parse option value "2" as boolean
>> 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).
> This has come up before. I'll patch it to make it an interval.
Patched in git master.
More information about the ffmpeg-user