> On Mar 1, 2022, at 11:29 PM, Gyan Doshi <ffm...@gyani.pro> wrote: > > 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: >>> >>> https://www.youtube.com/channel/UCIVY11504PcY2sy2qpRhiMg/live >>> >>> 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:password1@192.168.1.13:554' -hwaccel videotoolbox -i >>> 'rtsp://anonymous:password1@192.168.1.45:554' -vcodec h264_videotoolbox >>> -b:v 5000k -acodec copy -t 2:00:00 -filter_complex >>> "hstack=inputs=2,fps=20[stacked];[stacked]drawtext='fontfile=/System/Library/Fonts/Helvetica.ttc: >>> textfile=/tmp/weather.txt: fontcolor=white: fontsize=48: >>> x=(w-text_w)*0.01: y=(h-text_h)*0.01:reload=600'" -f flv >>> "rtmp://a.rtmp.youtube.com/live2/<my-youtube-streaming-key>” >>> >>> 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.
Wow! That was a very elegant, efficient patch! One line of code, other than the modified variable declaration: if (s->reload) { if (s->reload && !(inlink->frame_count_out % s->reload)) { _______________________________________________ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".