Live stream with changeable overlay My point is to create a continuous video stream with overlay that will change depending on external events. Like YouTube radio channels, where the song name is changing depends on which track is currently playing.

I saw one of the interesting ways with using several ffmpeg instances and local streams for audio and video: one ffmpeg is playing audio to local port, and other combining it with video, taking the audio source from local audio stream. So I can change the audio during the stream without restarting it.

My question is, can I use the same scene for changing the overlay. Let's say I need to change the song name on the screen, is there any ways to do so with ffmpeg?
drawtext filter

If you just want to update some text on the screen the easiest method is to use the drawtext filter with the textfile and reload options.

ffmpeg -i input -vf "drawtext=textfile=songs.txt:reload=1" output


songs.txt will be reloaded once per frame. Be sure to update it atomically, or it may be read partially, or even fail.

overlay filter

If you prefer an image instead of text you have to manually select the image demuxer, loop the image, and replace overlay.png atomically whenever you want it to be updated.

ffmpeg -i input -f image2 -loop 1 -i overlay.png -filter_complex overlay output