I would like to make a jpg background and put local time on the screen and then live stream to udp , so other applications can receive this , the following command has been tried:
ffmpeg -loop 1 -i background.jpg -vcodec libx264 -preset ultrafast -r 30 -vf drawtext="fontsize=120:fontfile=FreeSerif.ttf:rate=25:text=%{localtime\}:x=(w-text_w)/2:y=(h-text_h)/2:box=1: boxcolor=white@0.75" -f mpegts udp://127.0.0.1:20000
it looks ok, but when I tried the results via mpv or vlc mpv udp://127.0.0.1:20000
time shows on screen are very slow, what's wrong?
FFmpeg aims to process media as fast as possible, so the timestamp being printed corresponds to the time at whichthe drawtext filter is applied.
You can use the realtime filter to limit processing speed.
ffmpeg -loop 1 -i background.jpg -vcodec libx264 -preset ultrafast -r 30 -vf realtime,drawtext="fontsize=120:fontfile=FreeSerif.ttf:rate=25:text=%{localtime\}:x=(w-text_w)/2:y=(h-text_h)/2:box=1: boxcolor=white@0.75" -f mpegts udp://127.0.0.1:20000