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?

  • You might also want to look at avisynth+ avs-plus.net
    – stib
    Feb 3 '20 at 23:33
  • I'd suggest taking a look at "streamlabs" or "obs", which are made specifically for those instances. Feb 4 '20 at 13:36
  • Thanks, Florian! But I'm using headless server, and OBS needs access to the GPU. It does not work even over VNC with installed linux GUI like Gnome or KDE. So i need to use only software that does not uses GPU for streaming. Feb 4 '20 at 16:40

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.