Skip to content
streamneo.
Setup Guides12 min read

How to Use FFmpeg Concat Files for a Continuous YouTube Livestream

Build an FFmpeg concat playlist, check file compatibility and timestamps, and test the output before sending it to YouTube Live.

sn.
StreamNeoPublished 4 October 2026
Worth sharing?

An FFmpeg concat file is a text playlist that tells the concat demuxer which media files to read, and in what order. It can feed a repeating YouTube livestream, but it does not by itself guarantee gapless playback, recover a failed encoder, or keep a broadcast online around the clock.

The practical checkpoint is whether the listed files have compatible streams, codecs and time bases, and whether FFmpeg can estimate their durations correctly. Once the playlist works locally, you still need to choose a suitable YouTube ingest route, configure the output, test it with your actual files and monitor the live stream.

What the concat demuxer does

The concat demuxer reads a script of file entries and presents the packets from those files in sequence, as though they had been muxed together. FFmpeg adjusts packet timestamps so the first file begins at zero and each following file is placed after the preceding file according to its duration. This is a way to join compatible inputs without decoding and re-encoding them.

That distinction matters. The demuxer is handling media packets, not making a new video from arbitrary clips. It does not automatically resize mismatched images, change frame rates, repair damaged files or smooth a cut between two recordings. If one file ends with a different stream layout or timing basis, the sequence may fail or behave unexpectedly.

For a devotional channel, for instance, you might list a short opening visual followed by several bhajan recordings. For a study channel, the playlist might contain a sequence of lesson files. In both cases, the concat file is an ordered input plan. What viewers receive depends on the files, FFmpeg's output choices and the ingest connection as well as that plan.

The guide to streaming pre-recorded video from a cloud server covers the broader source-to-YouTube workflow. Here the focus is the playlist and the compatibility details that determine whether this particular FFmpeg input is dependable enough to test.

Build the concat script

Create a plain UTF-8 text file in the directory where you keep the media, or use paths that correctly point to the files from the process's working directory. A minimal script looks like this:

ffconcat version 1.0
file 'intro.mp4'
file 'program-a.mp4'
file 'program-b.mp4'

The first line is a format marker. For automatic recognition, FFmpeg requires it to be exactly ffconcat version 1.0, at the beginning of the file, with no leading spaces or byte-order mark. Put one file directive on each line and list the files in the order you want them played. The order is explicit: the demuxer does not sort names or infer a schedule.

Relative paths are interpreted in relation to the playlist location in typical use, but verify the behaviour in your command and working environment. Absolute paths can remove ambiguity, though they make a playlist less portable if you move it to another computer. Keep filenames simple where possible. If a path contains quotes, backslashes or other special characters, follow FFmpeg's concat script escaping rules rather than assuming shell quoting rules will apply; the playlist parser and your shell are separate layers.

Save the script with a clear name such as playlist.ffconcat. Then test it as an input before adding a live output. A local probe or short playback test can catch a misspelled path, a missing file or a playlist syntax issue without involving YouTube. Keep a copy of the exact tested playlist so later changes to the sequence can be compared against a known version.

If you want the sequence to repeat, looping is a separate input choice in FFmpeg. Check the documentation for the installed FFmpeg build and its input-loop option, including where that option must appear in the command. Do not assume that repeating the playlist also handles an interrupted connection or restarts a process that exits.

Check stream, codec and time-base compatibility

The concat demuxer is most useful when files are already compatible. FFmpeg's concat documentation calls for matching streams, codecs and time bases across the inputs. In practice, compare the video and audio stream layout, codec parameters, dimensions, frame rates and timing information before you rely on a multi-file sequence. The formats do not become compatible simply because their filenames end in .mp4.

A useful check is to inspect each file with ffprobe, which is distributed with FFmpeg, and compare the reported streams. Look for the same kinds of streams in each file, compatible codec configuration, and consistent time bases. If one clip has AAC audio and another has no audio, or the video streams have materially different properties, do not treat a successful playlist parse as proof that the joined input will behave correctly from start to finish.

There are two broad approaches when the sources differ. The concat demuxer is the no-re-encode route for compatible inputs. If you need to normalise or transform sources, FFmpeg's FAQ points to the concat filter for concatenation that requires re-encoding. That route gives you more control over a common output format, but it uses encoding resources and adds configuration decisions such as frame size, frame rate, audio format and quality. See the FFmpeg FAQ on concatenation and the concat demuxer documentation for the distinction and the script syntax.

Do not switch to re-encoding just to conceal an unexplained mismatch. First identify which stream differs and decide whether to prepare consistent source files or build a deliberate filter pipeline. That diagnosis is especially useful if your playlist mixes material from different cameras, editing applications or download sources.

A local news loop might combine a studio segment and a weather card. If their video dimensions or audio layouts differ, a packet-level join is not the same as editing them into one consistent programme. Prepare and inspect both assets, then test the exact sequence. If you need to build a longer catalogue of varied recordings, the 24/7 Indian music stream setup guide offers broader planning context, but compatibility still has to be checked for your own files.

Understand timestamps and duration estimates

The playlist has no independent clock that measures the true playback length of a file. The demuxer uses media duration information to place the next file's timestamps. When that estimate is wrong, the boundary can be mistimed and the output can show artifacts or gaps. Truncated media is one reason an estimated duration may not match the useful content that is actually present.

The concat script supports a duration directive for a file. It can override the stored duration, which can help when you know the correct duration and the embedded value is inaccurate. It is not a request to guess. An incorrect override can shift the next file's timestamps just as surely as a poor estimate can, so use it only when you have verified the real duration.

If you do add duration lines, keep each one associated with the file it describes and maintain a record of how you established the value. A media player's displayed length may be rounded, while timestamp-based inspection may reveal a more precise endpoint. When the right value is not known, investigate the source or prepare a clean copy rather than inventing one for the playlist.

Timestamp continuity also is not the same as an audible or visible seamless edit. A file can start at the expected time and still begin with silence, a black frame or a different musical phrase. Conversely, a small difference at a boundary may be a source-editing issue rather than a scheduling error. Inspect both packet timing and what a viewer hears and sees around the transition.

Keep a local log of the playlist version, input files and FFmpeg messages during testing. If a transition is consistently early, late or malformed, compare its estimated duration and stream details with the neighbouring file. Change one thing at a time, then replay the boundary. This is more reliable than adding duration overrides across the whole list without knowing which file caused the problem.

Connect FFmpeg output to YouTube Live

A working concat input still needs an output workflow. Choose the YouTube ingest mode first, then configure FFmpeg's output container, protocol and encoding to suit it. Do not assume that a command line intended for one ingest route can be reused unchanged for another. The basic RTMP-style continuous output workflow and YouTube's segmented HLS ingestion have distinct requirements.

For a typical encoder setup, YouTube provides an ingest server address and a stream key. Depending on the encoder application, the server URL and stream name or key may be entered separately or combined. Consult the current YouTube Live stream configuration documentation and the settings shown in Live Control Room rather than copying a stale endpoint from an old tutorial.

Treat the stream key like a password. Use a placeholder in saved examples and avoid pasting the actual key into public logs, screenshots, shared scripts or support requests. If it leaks, revoke it and create a replacement; the stream key revocation guide explains that account-side response. Use the RTMPS endpoint when that is the configured encrypted transport option for your ingest path.

The output settings need to be chosen, not guessed. YouTube's encoder settings guidance recommends constant bitrate and a two-second keyframe interval, with a maximum interval of four seconds. Select video and audio encoding settings that match the current YouTube guidance and the capabilities of your content and connection. These are configuration recommendations, not a promise that a stream will be accepted or stay healthy.

For a repeating source, the command conceptually reads the concat script, loops that input using the installed version's supported option, paces it in real time where appropriate, encodes or copies streams as justified by compatibility, and sends the output to the chosen YouTube ingest address. Option placement, source layout, protocol support and copy suitability all affect the actual command. There is no universal line that can be claimed to work for every FFmpeg build and every playlist.

If you want a command template, treat it as a starting point only: replace paths and endpoint placeholders, keep the key private, confirm option syntax against your installed FFmpeg version, and test the actual files before going live. The research for this guide did not execute an end-to-end command, so no example should be read as a verified recipe. For broader choices between a local and hosted process, see how to automate daily gaming VOD reruns; the right operating location depends on who will monitor it and what happens when the local machine or network is unavailable.

Test transitions and playback

Start with a private test or an unlisted test stream, using the same type of audio and motion you expect in the real programme. A static image with a short voice clip is not a sufficient test for a playlist of moving music videos. YouTube specifically advises testing with similar audio and motion before going live and monitoring stream health during the event.

Check the beginning, each boundary and the point where the sequence returns to its first file. Listen for abrupt silence, a sudden level change, a clipped phrase or doubled audio. Watch for black frames, frozen images, jumps in framing, aspect-ratio changes and overlays that disappear. If the list is long, sample representative transitions, but include the transitions most likely to differ in source, codec or duration.

Use FFmpeg's output log as one source of evidence, not the only one. Check whether files open, whether streams are mapped as expected, whether timestamps or decoding warnings appear, and whether the process continues through the end of the list. Then check YouTube's incoming video and audio indicators and the viewer playback itself. A process that has not exited can still be sending no useful picture or sound.

Keep the test settings and the live settings aligned. If you change the output encoder, keyframe interval, audio mapping or ingest route after testing, repeat enough of the test to cover the change. Likewise, changing one file in the playlist can affect its boundary and all later timestamp placement, so retest the relevant portion instead of assuming the old result still applies.

Plan for gaps and encoder failures

A concat playlist specifies sequential input; it is not a 24/7 operations plan. The FFmpeg process can stop because of an error, the host can lose power or connectivity, and YouTube can report an unhealthy incoming stream. The playlist does not itself supervise the process or ensure that an interrupted broadcast reconnects.

Decide who will notice a failure and what they will do. For a self-managed setup, that may mean checking process status and logs, receiving an alert, and having a documented restart procedure. A restart should be followed by a check that YouTube is receiving healthy video and audio, not simply a check that a command launched. Consider whether a restart begins at the first playlist item or resumes at a desired point, and how viewers will experience that choice.

Also plan for content problems. A missing file, a corrupt segment, unexpected silence or an inaccurate duration can disrupt the programme even if the network is sound. Keep the playlist and media in a location the streaming process can access, avoid editing files while they are in use, and retain known-good copies. Test recovery behaviour deliberately in a private setup rather than discovering it during an overnight broadcast.

If running a computer continuously, maintaining the process and the machine's network connection are part of the work. StreamNeo removes the specific burden of keeping your own computer switched on to run an uploaded video as a YouTube live stream, while monitoring and restarting it if it drops; it does not make playlist compatibility or content checks unnecessary. Consider whether you need a locally controlled FFmpeg workflow or a hosted route before selecting your operating approach.

No workflow removes the need to monitor the actual live event. YouTube's health indicators can show whether the incoming stream has a problem, but you still need a person or a practical alerting routine to respond. Keep the YouTube encoder guidance and current Live Control Room settings close at hand, since platform recommendations and interface details can change.

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 a concat file make clips play without a gap?

No. It tells FFmpeg how to sequence compatible media and how to place timestamps based on duration information. A boundary can still contain silence, a visual discontinuity, a timing error or another source problem, so test transitions with the actual files.

Can I use files with different codecs in one concat playlist?

The concat demuxer expects matching stream layouts, codecs and time bases for a reliable packet-level join. If your files differ, inspect them and consider preparing compatible sources or using the concat filter with re-encoding, as described in FFmpeg's FAQ.

Does looping the playlist keep YouTube live if FFmpeg stops?

No. Looping concerns what the input does while FFmpeg is running; it does not supervise or restart a failed process, restore a network connection or confirm YouTube is receiving healthy media. Plan monitoring and a tested recovery procedure separately.

Should I use RTMP-style ingest or HLS?

Use the ingest mode and current settings presented for your YouTube workflow. HLS has separate segment and rolling-playlist requirements and higher latency than a continuous RTMP-style stream, so do not mix an HLS packaging recipe into a basic RTMP output command.

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 ↗