Skip to content
streamneo.
Tools11 min read

How to Show the Current Song or Video Title in an FFmpeg YouTube Stream

Use FFmpeg drawtext to put a current title in your YouTube stream, with a UTF-8 file and safe atomic updates.

sn.
StreamNeoPublished 4 October 2026
Worth sharing?

To show the current song or video title in the picture of an FFmpeg YouTube stream, use the drawtext video filter. For titles that change while FFmpeg is running, have the filter read a UTF-8 text file and have a separate process replace that file atomically.

That visible overlay is different from a YouTube broadcast title or FFmpeg output metadata. Those are metadata fields; they do not put text into the video frames. The steps below focus on the text viewers actually see in the stream.

Choose the title viewers should see

There are three related fields that are easy to confuse. An in-frame title is drawn over the image before it is encoded. YouTube's broadcast title is information attached to the live event or video on YouTube. FFmpeg output metadata is a key/value field associated with the output container or stream context. Only the first is text rendered into the picture.

Approach What changes What the viewer sees
drawtext overlay The encoded video frames Text inside the video image
YouTube broadcast title The broadcast or video metadata field The title shown by YouTube as platform information, not as an overlay
FFmpeg -metadata title=... Output metadata Metadata, not text composited over frames

FFmpeg documents -metadata as a way to set metadata, including an output title. Its command-line documentation does not describe that option as a drawing filter. Likewise, the YouTube Live API overview distinguishes a liveStream, which carries the transmitted audio and video, from a liveBroadcast, which represents the event or video. Broadcast metadata has a snippet.title field. That distinction is useful if you need to set both titles, but changing metadata should not be treated as a way to alter pixels already being sent.

Decide which title is needed before you configure anything. A devotional channel might want “Morning bhajans” visible over the video for viewers watching on a television. A radio-style playlist could instead show the individual current track. You can also keep the picture free of text and set a descriptive YouTube title for the event. These choices solve different presentation needs.

For a repeating video source, the overlay can help viewers understand what is playing without relying on the title in the YouTube page. If you are building that kind of channel, the practical points in how to loop a fireplace stream in FFmpeg without black frames apply to the video loop itself; drawtext is an additional layer in the video path.

Render text with drawtext

The drawtext filter writes text onto video frames. Its basic shape is drawtext=fontfile=...:text=...:x=...:y=..., with options for font, size, colour, position, and a background box. That is a filter description, not a complete command for every machine: your input, output, shell, operating system, and FFmpeg build all matter.

Before designing a command, check that your installed build includes drawtext. FFmpeg's filter documentation notes that libfreetype is required to compile the filter, while some font fallback and text-shaping features depend on other optional libraries. A command copied from another computer may fail if that build lacks the filter or the typography feature it uses. Check the filter list or run a small local test before changing a live command.

For a first test, use fixed text rather than a changing title. Add the filter to the video path, choose a font file that exists on that machine, and place a short label in an unused corner. Confirm that the stream output contains the text before you connect the filter to a title-update process. This separates font-path and filtergraph problems from file-reload problems.

Filtergraph syntax has several layers: FFmpeg parses the filter options, and the shell parses the command before FFmpeg receives it. Colons, commas, quotes, backslashes, and some characters in the text may need escaping. The exact escaping differs between shells and operating systems. The FFmpeg documentation recommends textfile as a way to avoid much of the complexity of embedding text directly in a filter string.

Keep the overlay readable rather than large by default. A compact label with a contrasting box can be easier to follow over changing footage than text placed directly on bright or patterned parts of the image. If your channel uses devotional artwork, a nature loop, or a static study background, test against the actual imagery: a colour that works over a dark scene may disappear over a pale one. The general concern is similar when you choose a green screen setup: the picture behind an element changes what remains legible.

Read a UTF-8 text file

For a title that can change, use textfile rather than embedding the current title in the filtergraph. The conceptual filter shape is drawtext=fontfile=...:textfile=...:reload=..., with your own file path, position, and styling. Save the file as UTF-8 so titles containing non-English scripts or accented characters have a suitable encoding. Rendering still depends on a font with the needed glyphs and on the installed FFmpeg build's text support.

The file provides the string; it does not discover the current song or video by itself. You need a source of title information and a helper process that writes the current string to the file. That source might be a playlist controller, a local player, or an external feed. There is no universal title detector for all media inputs, so first confirm how your playback setup exposes the current item. A filename is also not necessarily the track title you want viewers to read.

Treat the title source and drawing filter as separate parts. The helper decides that the current item is “Raga for the evening”, for example, and prepares that text. FFmpeg reads the prepared file and composites it into frames. If the helper stops updating, the last successfully read title may remain on screen even if the media has moved on. If the title source reports the wrong item, drawtext will faithfully display the wrong string.

Choose a file location both processes can access and keep its path stable for the lifetime of the FFmpeg run. Avoid putting the title in a temporary directory that a cleanup task may remove, or in a folder with permissions that differ between your desktop login and the account running FFmpeg. On a 24/7 machine, test after a restart as well as during an interactive session; a path that works when you launch FFmpeg manually may not exist for a scheduled process.

A text file is also easier to inspect when diagnosing a stale overlay. Check whether the file contains the expected current title, whether the helper is writing to the same path FFmpeg reads, and whether the filter is configured to reload. If the file is correct but the frame is not, look at the filter options and reload interval. If the file itself is old, investigate the title source or helper rather than changing FFmpeg's drawing settings.

Reload text while the stream runs

The reload option tells drawtext to reread its text file at a specified frame interval. In practical terms, FFmpeg checks for a new title after the configured number of video frames. A smaller interval can make a change appear sooner, while a larger interval means the old title can remain visible for longer. Choose an interval appropriate to the frame rate and how quickly a title needs to change; there is no single setting that suits every stream.

This is a polling pattern, not an event notification. The helper can write a new title at one moment, but viewers will see it only after FFmpeg next reloads the file and emits frames with the new text. If your playlist has long tracks and a short delay is acceptable, checking less often may be adequate. If titles must follow short clips closely, test the observed delay using the intended frame rate and workload. Do not infer exact latency from the setting alone.

The filter documentation describes reloading at a frame interval and cautions that the file should be updated atomically. Dynamic reload does not make partial or in-place updates safe. If FFmpeg happens to read while another process has truncated the active file or written only part of a title, it can encounter incomplete content or a read failure. Use the atomic replacement pattern in the next section rather than relying on timing to avoid overlap.

Keep the helper's responsibility narrow: obtain the current title, validate or format it, then publish the completed string. You can decide what to do with blank titles, missing metadata, or unusually long names. For example, a music source with no title field might use a known playlist label rather than leave a confusing empty area. Agree on that behaviour before leaving the channel unattended, and check the result on screen.

If the programme changes through a playlist switch, the title helper needs to learn about that transition too. The rendering filter does not know which playlist is active. This is related to the control side of switching between music playlists without ending a YouTube live stream: playback can continue while the programme changes, but a separate title source must stay in step with it.

Replace the file atomically

Do not have the helper open the active text file, erase it, and then write the new title into that same file. That creates a period in which the contents are empty or only partly written. Since FFmpeg may reload at any point, it could read during that gap. The documentation's atomic-update caution exists for this reason.

Instead, write the complete new title to a temporary file in the same directory, close it, then rename or replace it over the active file using an operation that is atomic on that filesystem. The reader should see the old complete file or the new complete file, rather than an intermediate half-written state. Use a temporary filename that is distinct from the active filename, and clean up an abandoned temporary file if the helper stops unexpectedly.

The same-directory detail matters because rename semantics can differ when moving between filesystems. A temporary file on another volume may turn the operation into a copy and delete rather than an atomic replacement. Confirm the behaviour for the operating system and filesystem you actually use, and make the helper report failures. If replacement fails because of permissions or an open-file policy, silently continuing can leave a stale title on screen for hours.

A simple process outline is:

  1. Obtain the current title string from the source you control.
  2. Encode the complete string as UTF-8 and write it to a temporary file beside the active text file.
  3. Finish and close the temporary file, then replace the active file atomically.
  4. Log or otherwise surface a failed write or replacement, and keep the last good title rather than publishing partial text.

The outline is not a portable script: exact APIs and replacement behaviour vary by language, operating system, and filesystem. Test it with an intentionally awkward title and with the helper interrupted during a write. Verify that FFmpeg continues to read a valid old or new title, and that the helper can recover. Atomic replacement reduces the risk of partial reads; it does not guarantee that every title source, filesystem, or process failure is handled.

Test placement and readability

Before running the stream unattended, test with the actual input video and a title that resembles what the channel will display. Check that the text is inside the visible frame, not clipped at an edge, and does not cover faces, subtitles, lyrics, or useful parts of the scene. If the background changes over a loop, watch enough of it to spot sections where the title becomes hard to read.

A box behind the text can create contrast without requiring a large font. Give the text comfortable spacing from the image edge, and use a font size that remains legible at the likely viewing size. A label that looks clear in a full-screen desktop preview may be too small on a phone, while a large label can dominate a quiet ambience stream. Compare both rather than assuming the preview window reflects the audience's screen.

Check the content as well as its appearance. Confirm that a title change is reflected after the expected reload opportunity, that non-Latin characters render correctly where relevant, and that empty or lengthy names have a defined treatment. If you use music metadata, check a track whose tags are missing or inconsistent. If titles come from filenames, decide whether extensions or internal naming codes should be removed before display.

When a text update does not appear, diagnose in order: verify the helper's source value, inspect the UTF-8 file, confirm the configured file path, check that reload is present and set as intended, then confirm the FFmpeg build and filter output. This avoids changing a YouTube broadcast title when the actual fault is a stale text file. If the stream's own video path needs a broader preflight, use the go-always-live checklist to review the other moving parts before leaving it overnight.

This arrangement can be useful when a computer-rendered overlay is more work to keep running than the channel needs. StreamNeo removes the need to leave that computer on by turning an uploaded video into a YouTube live stream, though the file itself must already be prepared with whatever fixed title treatment you want.

Before committing, compare the operating options on the pricing page. When the file and channel are ready, start free — 24-hour trial, no card.

FAQ

Does -metadata title=... show text on the video?

No. FFmpeg's metadata option sets output metadata; drawtext is the filter that renders words into video frames. Use both only if you separately need metadata and an in-frame label.

Can YouTube's live title update the overlay?

No. YouTube's broadcast title is metadata for the broadcast or video, not text drawn into the transmitted picture. An overlay needs to be rendered into the video before it reaches YouTube.

Can I overwrite the text file while FFmpeg is running?

Use atomic replacement rather than overwriting the active file in place. Dynamic reload does not make a partial write safe: FFmpeg could read while the file is truncated or incomplete.

Why does drawtext fail on my FFmpeg build?

The filter may not be included in that build; FFmpeg documents libfreetype as a compile-time requirement, with some text features depending on additional optional libraries. Check the installed build and test its filter support before relying on a command from another system.

YOU’VE REACHED THE END

Keep the ideas coming.

More guides, useful tools and a little help for your next broadcast.

Back to the journal ↗
YOUR NEXT READ

A little more to explore.

More Tools guides ↗ · All topics ↗