Skip to content
streamneo.
Setup Guides14 min read

How to Add an On-Screen Clock to an FFmpeg YouTube 24/7 Stream

Add a local-time or UTC clock to an FFmpeg YouTube stream with drawtext, then check escaping, font support and legibility before going live.

sn.
StreamNeoPublished 4 October 2026
Worth sharing?

To add an on-screen clock to an FFmpeg YouTube 24/7 stream, use the drawtext video filter before the video is encoded and sent to YouTube. Choose whether it should show the FFmpeg host’s local time or UTC, then test the exact command and display before leaving it to run.

drawtext burns the text into the outgoing video frames. Viewers see the clock as part of the picture, not as a separate control they can move or turn off. The filter uses the host’s clock; it does not make the display viewer-local or establish that the clock is synchronised to an external time source.

Decide which time the clock should show

Use localtime when the intended display is the timezone configured on the machine running FFmpeg. That can make sense for a local news loop, a place-based devotional channel or a business channel whose audience is being given the operator’s local time. Do not assume that “local” means India Standard Time: it means the host’s configured local timezone, wherever that machine is running.

Use gmtime when the display should be UTC. It avoids dependence on the machine’s timezone setting, which can be useful if the same stream may move between machines or regions. It still relies on the host clock being correct; UTC is a timezone choice, not an independent time source.

A wall clock is different from a media timestamp. It reflects the host’s clock as frames are processed. If your aim is to show elapsed time or a timestamp tied to a point in the video, that is a different display requirement. FFmpeg documents clock expansions such as localtime and gmtime separately from its pts expansion in the drawtext filter reference.

Choose the meaning before settling on the appearance. A time-only display is less likely to cover the content and can suit a continuous ambience or study stream. A date plus time can help viewers understand which day the clock refers to, especially around midnight, but takes more screen space. If you label the display “IST” or “UTC”, ensure that the label matches the setting you actually selected.

For a stream serving viewers across regions, do not describe a host-local clock as each viewer’s local time. The filter renders one value into the video. Everyone receiving that video sees the same overlay, and you should explain plainly which timezone it represents.

Check that your FFmpeg build has drawtext

The filter must exist in the particular FFmpeg executable that will run the stream. A command working on your laptop does not prove that a different executable on a VPS, relay or always-on computer has the same build options. FFmpeg’s documentation is updated over time, and its documentation page advises checking documentation appropriate to the version you are using.

The drawtext reference describes the filter as drawing text using libfreetype, and lists FreeType and HarfBuzz as build requirements. Font discovery through font or fallback depends on additional fontconfig support; specifying a file with fontfile can make the font choice explicit. The exact options accepted can vary with the build, so inspect the local executable rather than assuming an online example will work unchanged.

A practical first check is to ask the same executable used for streaming to list its filters and look for drawtext. For example, run ffmpeg -filters and inspect the output. If you use a wrapper or a service that invokes FFmpeg, make sure the check refers to the binary that wrapper will actually call. When the filter is absent, installing another font alone will not add it; you need a build that includes the necessary support.

Also identify which account runs the long-lived process. A font path that works in an interactive terminal may be unreadable to a service account, or may not exist after a machine rebuild. This matters more for a continuous stream than for a one-off render: the command can appear correct while the unattended process starts under different permissions or a different environment.

Put drawtext in the video path

The clock needs to be applied to the video before that video is encoded for the live output. A simple command may put the filter in -vf; a more involved workflow can include it in a -filter_complex graph. In either case, integrate it with the actual input, audio handling, codec and output options you already use. FFmpeg explains its command and filtergraph conventions in the FFmpeg manual.

Here is a schematic filter value for showing host local date and time:

drawtext=fontfile=/path/to/font.ttf:text='%{localtime\\:%Y-%m-%d %H\\:%M\\:%S}':x=20:y=20:fontsize=32:fontcolor=white:box=1:[email protected]

This shows the intent and the main parts: a font file, a clock expansion, an x/y position, a text size and colour, and a semi-transparent box. It is not a complete streaming command and should not be pasted blindly into every shell. The backslashes shown are part of an example filter value; the shell and the way the filter is passed can require additional or different escaping. Test the complete command in its real context.

To display UTC, replace localtime with gmtime in the expansion and retain the formatting you want. To show only the time, you can remove the date portion of the format. If you do that, check carefully that punctuation and separators still parse correctly after shell and filtergraph processing.

Adding a video filter means the outgoing video must be filtered and encoded rather than simply copied as already encoded video. The clock is part of the picture at that point. Keep your existing audio stream mapped and handled as appropriate for your setup; do not accidentally drop audio while changing a video filter. The input source, output protocol, codecs and YouTube ingest settings remain specific to your command. YouTube’s live encoder settings guidance is the place to check current requirements for your own configuration; this guide does not prescribe numeric encoding settings.

If your current workflow is a playlist loop, keep the overlay change separate from the playlist logic while testing. The walkthrough on streaming a playlist to YouTube with FFmpeg may help you distinguish input and loop behaviour from the new video filter. Likewise, if the stream relies on a Windows machine rather than a command-line host, the guide to running a 24/7 YouTube stream on Windows with OBS covers a different workflow; do not mix instructions for its application interface with FFmpeg filter syntax.

Position and style it for legibility

The filter can control coordinates, font size, text colour and a background box, among other styling options. Start with a position well inside the visible picture rather than at the edge. A player may be shown at different sizes or cropped in different viewing contexts, so a clock touching a corner can become hard to read or partly obscured.

Choose contrast against the material behind the clock. White text can disappear against a bright sky, a lamp, a pale temple wall or a changing video frame. A box gives the text a more consistent background; a border or shadow can also help separate letters from detail. Treat these as controls to test against your own footage, not as guarantees of readability.

Size depends on the output resolution and the amount of other visual material. A value that looks modest in a full-resolution preview can become tiny on a phone. Review the clock at the actual output dimensions and at a smaller playback size. If the time is a key service to the viewer, use a larger, simpler display; if it is secondary, keep it unobtrusive without making it illegible.

Avoid placing the clock over subtitles, lyrics, a logo, a face or the main subject of the loop. For a bhajan stream, for example, a corner may overlap a singer or devotional artwork in one part of the video even if it is clear in another. Preview several points in the loop, not only its opening frame. A background box can make a changing scene easier to manage, but it also takes up more of the image.

Make the content and visual treatment agree. A time-only clock with a small “UTC” label can be clearer than a long date and time string if the purpose is simply to orient viewers. A news loop may benefit from a date as well as time. Do not add a timezone abbreviation merely for decoration; if you include one, verify it against the actual clock expansion and host settings.

Escape the filter for your command context

Filter syntax passes through more than one parser in many commands. The shell may interpret quotes and backslashes before FFmpeg receives them; then FFmpeg parses the filtergraph and the drawtext options. As a result, a colon or backslash in the format string can need escaping at more than one level. A string that works in one shell or in an application’s command field may fail in another.

The schematic example includes escaped punctuation to show the issue, but it does not define a universal spelling. Do not assume that copying it into Bash, PowerShell, a batch file, a YAML configuration, or a web form will preserve the same characters. The quoting and escaping rules depend on the shell, the filtergraph context and how the command is assembled. FFmpeg’s filter documentation discusses multiple levels of escaping and notes that using a text file can avoid some text-escaping problems.

For a clock format, add complexity gradually. First confirm that a basic drawtext label displays. Then add the time expansion, then the date or seconds if needed, and finally the styling. If an error appears after adding a particular character, inspect that exact layer rather than changing the whole command at once. Keep a copy of the known-working command so a troubleshooting change does not become the new unattended setup by accident.

If you build a filtergraph in a script, record the literal argument that the process passes to FFmpeg, not only the version as written in source code. A programming language can consume backslashes or quotes before the command is executed. If a text file is used for the overlay text, confirm that your chosen clock expansion is supported through the exact mechanism you use; a text file can simplify some escaping but is not a reason to skip testing.

Test the timezone and clock updates

Render a short sample or run a brief private test using the same FFmpeg binary, account, shell and filter value planned for the continuous stream. Examine the output video itself. Confirm that the clock appears, the date and time format is as intended, and the seconds or minutes update rather than remaining as literal text. Check that the chosen local or UTC setting produces the expected value for the host you are testing.

Do not infer the timezone from the machine’s physical location or a server-region label. Check the host’s configured timezone and compare the displayed result with a clock you trust for that timezone. If you expect local time, make sure the host has the intended timezone configured. If you choose UTC, verify that the value is UTC rather than merely assuming the gmtime token compensates for an incorrect system clock.

Test at a moment when a meaningful boundary is near, such as a date change, if the date is part of the display. This is a way to inspect formatting and updates, not a claim that the clock is externally synchronised. Also inspect the clock across several scenes or points in your loop, on a phone-sized view and at the output resolution. Confirm that the box, position and text remain clear over both dark and bright frames.

For a live test, use a private or otherwise appropriate test destination before changing a public continuous stream. Verify the resulting picture in the platform’s live preview, and check that the audio still behaves as expected. If the stream has a separate restart process, test a restart too: a command that works only in an interactive session is not ready for unattended operation. Guidance on restarting a 24/7 stream after a disconnect is relevant to that operational layer, but the restart mechanism does not correct a timezone or filter error.

Write down the exact executable path, font path, timezone choice and tested command alongside your stream notes. That gives you a concise checklist after a rebuild or migration. If you use localtime, revisit the setting after moving the process to another host. If you use UTC, still recheck the host clock and the rendered output after a change.

Troubleshoot fonts, missing text and filter errors

If FFmpeg reports that drawtext is an unknown filter, first check the executable and its build rather than editing the format string. Confirm that the process uses a build with the required libraries. Online documentation can describe options that an older or custom local build does not provide, so compare against that build’s own help and filter list.

If FFmpeg recognises the filter but reports a font error, check that the fontfile path exists on the machine running the stream and is readable by the process account. Use a stable path rather than a font stored in a temporary directory or in a user profile that the service cannot access. A specific fontfile also avoids relying on font discovery when that support is not present, though the file itself must still be available and usable.

If the command fails while parsing options, simplify it. Remove the styling options, retain a short literal label, and check whether that renders. Then add the clock expansion and format separators carefully, testing after each change. This isolates whether the problem is filter availability, font access, quoting or an unsupported option. Keep the exact error text; changing many parts at once makes the cause harder to identify.

If the clock appears but shows the wrong hour, investigate the host timezone and clock rather than moving the overlay. Verify whether the expansion is localtime or gmtime, and check that the label matches it. A moved or rebuilt host can have a different local timezone configuration. A correct-looking overlay position cannot fix a time-source mismatch.

If the clock is present but difficult to read, inspect it against the full loop rather than selecting a new font size from a single frame. Move it clear of important content, add or adjust a box, or simplify the displayed format. For a continuous stream, document the working filter and repeat the sample check after changing the video, machine, FFmpeg build or command launcher.

The clock is only one part of a reliable stream. A filter or font error can stop the video process, while a separate connection failure can interrupt the broadcast. If you are diagnosing the latter, use a distinct checklist such as common causes when a live stream ends unexpectedly, rather than treating the clock overlay as the explanation for every interruption.

Keep the clock maintainable in a 24/7 workflow

Once the sample is correct, preserve the tested command and make any future edits deliberately. Record whether the display uses local time or UTC, the font path, the position and style, and the exact command context in which escaping was verified. This is especially useful when another person has to restart or edit the channel later.

Plan for the overlay to be part of the encoded picture. If you later decide to remove it, reposition it or change its text, you must change the video processing and produce new frames without the old overlay; viewers cannot independently edit this burned-in clock. Keep an unmodified source video or a clean loop where possible so that you can revise the presentation without layering a new clock over an existing one.

An FFmpeg setup gives you direct control over the filter, but it also means you are responsible for the process, host configuration, font and recovery path. If maintaining the machine and command is the part you are trying to avoid, StreamNeo removes that specific operational burden for a file-based continuous broadcast: you upload the video and provide the YouTube stream key, while your own computer can be switched off. The clock still needs to be part of the video you supply if you want it visible; StreamNeo is YouTube-only and does not turn the overlay into a separate viewer control.

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 drawtext show each viewer’s local time?

No. It renders one clock value into the outgoing video, so viewers see the same overlay. Choose the host’s local time or UTC according to what you want that shared display to mean, and label it accurately.

Does localtime mean Indian Standard Time?

Only if the FFmpeg host is configured to use that timezone. Check the host setting and the test output instead of relying on its location or name. Use gmtime if the intended display is UTC, while remembering that the host clock still needs to be correct.

Why does the sample command fail in my terminal?

The shell and filtergraph may each interpret quotes, colons and backslashes. The example is schematic, not a command guaranteed to work unchanged in every context. Test the exact assembled command, simplify it to a literal label first, and add the time format in small steps.

Can I switch off or move the clock as a viewer?

No. The filter draws it into the video frames before encoding, so it is not a separate viewer-editable overlay. To change or remove it, alter the processing and send video frames without that rendered text.

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 Setup Guides guides ↗ · All topics ↗