<h1>drawtext filter</h1>

<p>If you just want to update some text on the screen the easiest method is to use the <a href="https://ffmpeg.org/ffmpeg-filters.html#drawtext" rel="nofollow noreferrer">drawtext</a> filter with the <code>textfile</code> and <code>reload</code> options.</p>

<pre><code>ffmpeg -i input -vf "drawtext=textfile=songs.txt:reload=1" output
</code></pre>

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

<h1>overlay filter</h1>

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

<pre><code>ffmpeg -i input -f image2 -loop 1 -i overlay.png -filter_complex overlay output
</code></pre>

CC BY-SA 4.0
2020-02-05T12:09:27.110Z
Thanks a lot! This is exactly what I was looking for.
Денис Кирин
CC BY-SA 4.0
2020-02-04T21:04:51.753Z
2020-02-04T21:04:51.753Z
llogan
<p>A slightly better solution in terms of CPU usage is to use <code>-stream_loop -1</code> instead of <code>-loop 1</code> and define a lower framerate (<code>-framerate 1</code> to read the image once a second):</p>
<pre><code>ffmpeg -i input -f image2 -stream_loop -1 -framerate 1 -i overlay.png -filter_complex overlay output
</code></pre>

CC BY-SA 4.0
2024-07-01T09:29:59.933Z
2024-07-01T09:30:12.980Z
2024-07-01T09:30:12.980Z
barroudjo
<p>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.</p>

<p>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.</p>

<p>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?</p>

CC BY-SA 4.0
2020-02-03T23:33:36.767Z
You might also want to look at avisynth+ http://avs-plus.net/
stib
CC BY-SA 4.0
2020-02-04T13:36:20.093Z
I'd suggest taking a look at "streamlabs" or "obs", which are made specifically for those instances.
Florian Claaßen
CC BY-SA 4.0
2020-02-04T16:40:42.513Z
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.
Денис Кирин
<ffmpeg>
Live stream with changeable overlay
Денис Кирин
# Live stream with changeable overlay

(Asked by: username_0 on 2020-02-03)

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?

**Tags:** ffmpeg

> **Comments:**
> **username_1**: You might also want to look at avisynth+ http://avs-plus.net/  
> **username_2**: I'd suggest taking a look at "streamlabs" or "obs", which are made specifically for those instances.  
> **username_0**: 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.  

---

## 2 answers

### Answer by username_3 on 2020-02-04. Score: 2 | Accepted answer

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

> **Comments:**
> **username_0**: Thanks a lot! This is exactly what I was looking for.  

---

### Answer by username_4 on 2024-07-01. Score: 0

A slightly better solution in terms of CPU usage is to use -stream_loop -1 instead of -loop 1 and define a lower framerate (-framerate 1 to read the image once a second):
ffmpeg -i input -f image2 -stream_loop -1 -framerate 1 -i overlay.png -filter_complex overlay output


---

