Skip to content
streamneo.
Setup Guides12 min read

How to Rotate YouTube Live Playlists Using FFmpeg Concat Files

Create a fixed FFmpeg concat playlist, check file compatibility, loop it for YouTube Live and troubleshoot transitions.

sn.
StreamNeoPublished 5 October 2026
Worth sharing?

An FFmpeg concat file lets you place a fixed sequence of local video files in order and present them as one input to a YouTube Live stream. You write the sequence yourself, check that the files are compatible, then tell FFmpeg to repeat the input with -stream_loop -1.

That is a playlist workflow, not a scheduler: the text file does not find new files, change the order by itself or decide what should play at a particular time. If you need an overnight stream, the important work is validating the inputs and output before you leave it running.

What a concat file is for

FFmpeg’s concat demuxer reads a plain-text list of files and presents them sequentially as a single virtual input. When one file ends, FFmpeg moves to the next entry; with a compatible sequence, you can encode or copy that combined input to an output such as an RTMP feed. The FFmpeg documentation for the concat demuxer describes its input format and behaviour.

This is useful when you have a prepared set of clips—perhaps devotional music for a fixed bhajan rotation, a study ambience collection, or a local business information loop—and want that exact order to repeat. It is especially straightforward when all clips have already been exported to matching properties.

There are two different jobs that are easy to confuse. The concat file defines which local files are played and in what order. FFmpeg’s command defines how that combined input is read, encoded and sent out. YouTube Live receives the resulting stream; it does not read the text file or control the local sequence.

If you are deciding whether a continuous live feed is the right format at all, compare it with the on-demand approach in YouTube playlist versus a 24/7 livestream. A live loop has operational responsibilities that a normal uploaded playlist does not.

Check compatibility before you concatenate

The concat demuxer is not a general-purpose converter. It expects the listed inputs to have matching streams: compare the number and type of streams, codecs, and time bases, along with practical properties such as dimensions, frame rate and audio layout. FFmpeg joins compatible packets; it does not automatically resize a landscape clip, repair a missing audio stream or turn different codecs into one consistent format.

Use a media inspection tool such as ffprobe to examine each file before building a long rotation. A simple check might be:

ffprobe -v error -show_streams -show_format segment-01.mp4

Repeat it for the other files and compare the output. In particular, look for a video stream in every file if the channel is meant to show pictures, and check that audio is present and arranged as expected. A still-image clip with no audio, a stereo music video, and a screen recording with a different frame rate may not form a clean demuxer sequence without preparation.

You have two main choices when the properties differ. The concat demuxer with stream copy avoids an encoding step and uses less processing, but only suits a sequence whose streams are already compatible. The concat filter can combine and transform inputs, but requires re-encoding and therefore more processing time; it is the route to consider if you need consistent sizing, frame rate, or other filtering. FFmpeg’s FAQ on concatenation distinguishes these approaches.

Approach Best fit Main trade-off
Concat demuxer, stream copy Files already have matching streams and properties Low processing demand, but little flexibility to repair differences
Concat demuxer, encode output Compatible files that need a chosen output encode Adds encoding work, but gives control over the outgoing format
Concat filter with re-encoding Inputs need normalization, scaling, or other filtering More preparation and processing; useful when inputs differ materially

Do a short test after preparing a sequence. A few clips may expose an audio discontinuity or a timestamp issue that is difficult to spot by looking at file names alone. If the playlist is meant to run all night, do not assume that files which play individually will join properly.

Write the concat list in the order you want

Create a plain-text file in the same folder as the clips, for example playlist.ffconcat. The first line is the format declaration, followed by one file directive for each entry:

ffconcat version 1.0
file 'segment-01.mp4'
file 'segment-02.mp4'
file 'segment-03.mp4'

The sequence in the text is the sequence FFmpeg uses. Put an opening title or quiet lead-in first if that is how you want the live stream to begin, and place the remaining clips in the desired rotation. Reorder the lines to change the sequence; the demuxer does not sort by date, scan a folder or notice that you copied another file into it.

Relative paths are easier to move with the playlist: the example assumes the listed clips are beside the text file and the command is run from the expected working directory. If you use paths with spaces, quote them as shown. The demuxer’s safe-path checks are enabled by default and favour portable relative paths. Keep that protection where possible. The FFmpeg concat demuxer reference explains the safe-path option; -safe 0 relaxes path restrictions and should only be considered for a list and files you control.

Avoid placing a secret stream key in the concat file. That file needs only media paths and, if genuinely required, directives such as a duration. Keep the list readable and test it with a few entries before making a larger fixed rotation.

Duration deserves care. The demuxer uses file duration information when positioning the next file. If the metadata is inaccurate, timestamps at the join can be wrong, leading to a pause, a jump or other transition artefacts. A duration directive can override a duration, but use it only when you have a sound value for the actual media. Guessing a duration can create a different timing problem rather than fixing one.

Build and validate the FFmpeg command

For compatible files, a command template can look like this:

ffmpeg -re -stream_loop -1 -f concat -i playlist.ffconcat \
  -c:v libx264 -c:a aac -f flv 'rtmp://INGEST_ENDPOINT/STREAM_KEY'

This is a shape to adapt, not a guaranteed, current YouTube recipe. Replace the ingest URL and stream key with the values shown for your live setup, and choose output settings according to YouTube’s current guidance and the capabilities of the installed FFmpeg version. The research for this article did not verify a current official YouTube ingest specification, so do not treat codec, bitrate, frame rate, resolution or keyframe values copied from an old forum post as authoritative.

The ordering of options matters. -f concat tells FFmpeg how to interpret the input list, and -i playlist.ffconcat selects that input. -stream_loop -1 is an input option and belongs before the relevant -i; -1 means repeat without a preset end. -re makes a file input read at a rate intended to approximate real time, rather than simply consuming the file as quickly as possible. Validate its behaviour for your source and FFmpeg build instead of assuming a flag makes a stream healthy.

The sample encodes video as H.264 and audio as AAC, then selects FLV output for an RTMP-style endpoint. Those are illustrative command components, not a statement that they suit every channel or current account configuration. Confirm the current values in YouTube Help on live encoder settings before you choose them. Select or map streams deliberately if your files contain extra audio tracks, subtitles or other streams; an unexpected stream can lead to confusing output or a failed command.

Run the command for a short test before relying on it. Watch FFmpeg’s console output for input errors, timestamp warnings, encoder failures and reconnect attempts. At the same time, check the YouTube Live control room to confirm that it receives a usable signal and reports stream health. Seeing FFmpeg print that it opened a connection is not the same as confirming that the live preview has sound and picture.

Treat the stream key as a password. Do not put it in a public script, a screenshot, or a log you intend to share. If a command line is saved for reuse, protect the file and consider how your operating system or shell history records it.

Loop the list for continuous playback

A finite concat list normally reaches its final entry and ends. To keep repeating that fixed input, use -stream_loop -1 before the concat input’s -i, as in the template above. FFmpeg then starts the input again after it reaches the end of the sequence, subject to the files being readable and the process remaining active.

Test the boundary between the last and first clips as carefully as the boundaries between clips in the middle. A quiet final frame followed by a loud opening, for example, will still be jarring on each repeat even if the command runs correctly. Listen and watch through a full cycle during testing, not only through the first transition.

A repeat flag does not supervise the computer, maintain a changing schedule, or guarantee that a broadcast will survive a network or process failure. If you run FFmpeg on your own machine, the operating system must stay awake, the network must remain available, and the process must remain running. For a home-PC workflow, how to keep FFmpeg running after an SSH disconnect covers one separate process-management problem; it does not remove the need to test the media or output.

If your purpose is a single recorded loop, rather than an editable set of files, you may prefer a prepared video with the sequence already assembled. The choice depends on how often the order changes and whether you want to encode the material in advance. Re-encoding for every live run may be unnecessary if the input files are already compatible, while a prebuilt file can simplify the live command at the cost of flexibility.

Diagnose transitions and compatibility problems

When the stream breaks as a new clip starts, first identify where the failure occurs. Check the FFmpeg log at the transition and note whether the input could be opened, whether the streams changed, and whether timestamps or duration produced warnings. Then inspect the corresponding files rather than changing several command options at once.

Common symptoms suggest different checks:

Symptom Check first Possible next step
FFmpeg refuses a later file Path spelling, permissions, and stream layout Correct the list or prepare inputs with matching streams
Picture pauses or jumps at a join Durations, time bases, and timestamps Inspect metadata; only set a duration when you know it accurately
Picture works but audio disappears Audio stream presence, codec, and mapping Ensure the intended audio stream is selected and output correctly
YouTube preview is unhealthy Output format and current account ingest guidance Check the live control room and official encoder settings
The repeat starts with an abrupt change End and beginning content, levels, and duration Edit or normalize the two boundary clips

A video may have different dimensions or frame rate from its neighbour while still opening on its own. That does not mean the concat demuxer will reconcile the mismatch. Standardize the clips to a consistent set of properties, or build a filter-based workflow that explicitly handles the differences and re-encodes. If your machine cannot encode the prepared output at the chosen settings, that is a capacity constraint to test, not a reason to assume stream copy will fix incompatible inputs.

A list path can also cause a failure that looks like a media problem. Start with simple relative file names and the default safe mode. If a controlled playlist genuinely requires paths the safety rules reject, understand what relaxing them permits before using -safe 0; do not use it as a routine troubleshooting switch for lists you did not create.

For mixed-frame-rate sources, check both the prepared files and the output status rather than relying on a single warning line. The relevant practical comparison is whether clips were normalized, how transitions look and whether the live console reports a usable feed. The troubleshooting ideas in YouTube RTMP stream health warnings when looping mixed frame-rate videos are useful context, but current platform settings should still come from YouTube’s official guidance.

Understand what the list does not automate

The concat file is static. It names the files and their order when you write it. It does not discover newly added media, remove expired items, rotate based on time of day, or implement a full scheduling system. If you want a new rotation, edit the list deliberately, validate the paths and test the revised sequence.

It is also not a media repair tool. A file with the wrong codec, no intended audio, a damaged index or unreliable duration information can still cause trouble. The list combines inputs; preparation is what makes the inputs suitable for the job. Keep a known-good version of the list and media set so you can return to a tested sequence if an edit introduces a problem.

Nor does a correct concat list decide how long a live broadcast should continue. FFmpeg has to stay connected to the ingest endpoint, and YouTube has to accept the outgoing stream. That means the operating system, power, network, process and live configuration remain part of an unattended setup. A useful comparison is what happens when a YouTube 24/7 stream’s source playlist ends: the source sequence and the status of the live broadcast are related but separate concerns.

If maintaining the machine, command and restart behaviour is the part that makes an overnight loop fragile, StreamNeo can remove the need to leave your own computer running for this file-to-live workflow. It turns an uploaded video into a YouTube live stream; it does not change the need to prepare suitable content or confirm YouTube’s current requirements.

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

How do I make an FFmpeg concat playlist repeat forever?

Put -stream_loop -1 before the concat input’s -i, for example -stream_loop -1 -f concat -i playlist.ffconcat. The option repeats that input; it does not monitor the process or recover every possible connection failure.

Can the concat file pick up new videos automatically?

No. It is a text list with explicit file entries and order. Add or remove entries yourself, then check that paths and media properties are valid before using the revised list.

Why does FFmpeg fail when the next video starts?

The next file may have a different stream layout, codec or time base, or its duration metadata may be inaccurate. Inspect the log and both files around the join; prepare consistent inputs or use a filter-and-re-encode workflow when the demuxer’s compatibility requirements are not met.

Should I use stream copy or re-encode for YouTube Live?

Use stream copy only when the inputs are compatible and the resulting output suits your current ingest setup. Re-encoding offers more control for normalization, but costs processing time; confirm current requirements in YouTube Help and test the live preview before leaving the stream unattended.

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 ↗