To keep an FFmpeg YouTube stream from ending between playlist videos, make the playlist one continuous FFmpeg input and leave the output process running while it advances through the files. For compatible files, the concat demuxer can present them in sequence without re-encoding; if their streams need normalising, use a concat-filter workflow instead.
Neither method guarantees a gap-free transition for every playlist or FFmpeg build. Check stream compatibility, timestamps, durations and YouTube’s ingest status before relying on the result overnight.
Why a stream may end between playlist videos
A playlist in a media player and a sequence of inputs to an encoder are not necessarily the same thing. If you start FFmpeg separately for each video, the first process can reach end-of-file and stop sending data before another process begins. YouTube then sees a break in the incoming feed. Even if each video works on its own, that does not make a chain of separate jobs continuous.
A second cause is treating the files as interchangeable when their media properties differ. One item may contain audio and video, another only video; codecs, time bases, dimensions, frame rates or stream order can also differ. A method that copies packets from one file to the next does not repair those differences. The playlist can fail, produce unexpected timing, or create a visible or audible disturbance at the boundary.
Finally, a stream can stop for reasons unrelated to the playlist. FFmpeg may still be running but unable to send data, or YouTube may report an ingest configuration issue. Distinguish an input reaching its end from a transport or ingest problem before changing the playlist. If your setup uses OBS rather than FFmpeg, the separate issue of keeping an OBS video playlist moving has different controls.
Keep one output process active
For a fixed sequence of local files, the basic idea is to give FFmpeg one playlist-like input and one live output, rather than launching a new live stream for each item. The output process remains active as FFmpeg reads the next file. On YouTube, this means the encoder continues sending the configured live feed rather than deliberately ending and reopening it at every boundary.
That describes the workflow, not a universal command. The correct input and output options depend on the FFmpeg build, the files, the desired output codecs and the ingestion protocol configured for the YouTube stream. A command copied from another machine may use unavailable features or assumptions that do not match your playlist. First establish the file order and inspect media properties; then choose whether packet concatenation is appropriate or whether the material needs re-encoding.
Keep the output settings consistent for the whole sequence. Verify the destination, stream key handling and protocol once, and avoid changing the output target at a file boundary. Keep the process logs visible or captured so you can tell whether FFmpeg is advancing through inputs, reporting an error, or simply reaching the end of the supplied sequence. A single fixed list ends when it has played through; if you need the channel to continue beyond that point, plan explicitly for another cycle or another scheduled input rather than assuming a fixed list repeats by itself.
If your current approach starts a fresh encoder for every clip, the broader principles in creating a continuous YouTube live stream can help separate continuity of the broadcast from the choice of media-input method.
Use the concat demuxer for compatible files
The concat demuxer is designed to read a list of files in sequence as though their packets formed one longer input. A plain text list contains one file directive for each local file, in playback order. The FFmpeg Project’s concat demuxer documentation describes the format and its requirements. In outline, a list might look like this:
file '/media/playlist/opening.mp4'
file '/media/playlist/main.mp4'
file '/media/playlist/closing.mp4'
Use paths that exist on the machine running FFmpeg. If a path contains a quote, backslash or other special character, follow the concat-list escaping rules rather than assuming ordinary shell quoting will protect it. The list file is parsed by FFmpeg, not by your shell. Test the list with a short local output before attaching it to a live broadcast.
The important limit is compatibility. The documentation says, “All files must have the same streams (same codecs, same time base, etc.).” In practice, compare not only the filename extensions but also the streams FFmpeg detects. MP4 files can contain different codecs or stream layouts; identical-looking files are not necessarily compatible for packet-level concatenation.
When the files do meet the demuxer’s requirements, it can avoid decoding and re-encoding their media merely to play them in order. That can be useful when you want to preserve the existing encoded streams, but it also means the demuxer is not a repair tool. If file two has a different audio format, it will not transform that audio to match file one. The FFmpeg FAQ on concatenation distinguishes the demuxer approach from using a filter when re-encoding is required.
Check streams, codecs and time bases
Before committing a long-running channel to a playlist, inspect every item with FFmpeg’s media-probing tools or equivalent metadata reporting. Record the number and type of streams, codec names, dimensions, frame rate, sample rate, channel layout and reported duration. The goal is not to make every file look identical by eye; it is to find differences that matter to the concat method you intend to use.
For the demuxer, look for matching stream structure and compatible codecs and time bases. Compare stream order as well: a video-only file followed by a file with audio may not behave like a uniform programme input. If the material includes subtitle, data or additional audio streams, decide whether they should be carried, ignored or converted. Do not assume a simple video-and-audio example covers a playlist with a more complex layout.
Time bases describe how timestamps are represented for a stream. A mismatch can matter at a boundary even where both clips play correctly by themselves. Likewise, different frame rates or audio sample rates may be acceptable in a re-encoding workflow but should not be waved away when using packet copying. If the files do not satisfy the demuxer’s compatibility assumptions, prepare normalised outputs or use a filter graph that decodes, aligns and re-encodes the sequence.
Also match your tests to the output you will actually send. A local test that writes a file can reveal demuxer and timing problems, but it does not prove YouTube is receiving the expected feed over your chosen protocol. Conversely, an ingest error does not by itself prove that the files are incompatible. If you run FFmpeg on a VPS, the practical setup issues described in configuring Ubuntu for FFmpeg YouTube streaming are separate from the concat rules: both the local input and the live output have to work.
Account for duration mismatches and gaps
The concat demuxer uses file durations to determine where the next file begins. If duration metadata is missing or inaccurate, the calculated boundary may not reflect the media’s actual timestamps. The result can include gaps, overlaps or other timestamp artefacts. A file’s container-reported length is useful evidence, not an absolute guarantee that its audio and video streams end together.
Compare the overall duration with the durations of the individual streams. In particular, check whether audio runs longer than video, whether a final frame or audio packet extends beyond the nominal end, and whether timestamps start at zero or include an offset. For devotional, music or ambience playlists, a small pause or repeated fragment can be more noticeable than it would be in a spoken programme, so listen and watch across each boundary rather than checking only that FFmpeg exits successfully.
The concat list format allows an explicit duration directive for a file. This can override inaccurate or unavailable duration metadata, but only use it when you have a reason to trust the value you supply. A guessed duration can move the next item to the wrong point just as easily as bad metadata. Measure or verify the relevant length, then test the boundary in a local output before broadcasting it.
Do not describe a playlist as seamless merely because the demuxer accepts it. The files can still have different content, loudness, frame cadence or encoded boundaries. If there is a short black frame, silence or abrupt change, first determine whether it is already present in the source media or introduced by timestamp handling. That distinction tells you whether to edit the files, correct duration information, or change the concatenation method.
Use the concat filter when re-encoding is needed
When source files need normalising, the concat filter is the appropriate direction to consider. Unlike the demuxer, a filter workflow decodes streams and joins them in a filter graph before encoding the result. That gives you a place to convert inputs to a common resolution, frame rate, pixel format, sample rate or channel layout. The FFmpeg FAQ identifies the concat filter as the route when re-encoding is needed.
This flexibility has costs. Re-encoding uses more processing capacity than copying compatible packets, can change quality, and adds choices about codecs and output settings. Each input must be prepared to match the filter’s expectations; merely naming several files in a filter graph does not automatically reconcile every difference. Work from the actual stream properties, and use a short test that includes the transitions you care about.
The filter is particularly relevant if clips come from different cameras or editing exports, or if one has a different frame size or audio format. Decide the target format first, then normalise each segment to it and test both picture and sound at joins. Keep an eye on timestamps and output duration. If the encoding machine cannot sustain the chosen settings, the broadcast may fall behind or become unstable even if the filter graph is valid.
| Method | Best fit | Main trade-off | What to verify |
|---|---|---|---|
| Concat demuxer | Files with matching stream structure and compatible codecs and time bases | Avoids re-encoding, but does not normalise incompatible inputs | Streams, timestamps and reported durations |
| Concat filter | Files that need conversion or re-encoding to a common format | More processing and encoding choices; filter inputs must be prepared | Target format, output load and each transition |
Neither row is a promise that a particular command will work on every build or playlist. Choose based on the files in front of you, then test with the FFmpeg version and output settings you will use live.
Validate the playlist and transition behaviour
Start with a copy of the playlist and a test output that is not your live broadcast. Confirm that the list parses, files open in the intended order, and the output continues across every boundary. Review FFmpeg’s logs for missing streams, timestamp warnings, decode errors and premature end-of-file. Play the resulting test output around joins, including the audio; a process that runs to completion is not proof that the transition sounds or looks right.
Then test the live ingest in a controlled session. YouTube’s live-streaming Help page describes supported streaming protocols and setup considerations. Confirm whether your stream is configured for RTMP/RTMPS, HLS or DASH, and whether the encoder’s output matches that choice. Protocol settings are not interchangeable. In particular, YouTube’s HLS guidance includes requirements for segmented uploads and a rolling playlist; do not apply HLS-specific settings to an RTMP output as a speculative fix.
YouTube exposes stream status and health information through its LiveStreams API documentation. Use those signals alongside FFmpeg logs: the API distinguishes receiving data from inactive or error states and includes health information that can point to configuration problems. If FFmpeg says it is still sending but YouTube is not receiving data, investigate the output connection and ingest settings. If FFmpeg reports that the input ended, check whether the fixed list simply completed or whether a source file failed to open.
Write down the result for the exact playlist, FFmpeg build and ingest protocol tested. If you later replace a clip or alter encoding settings, recheck the relevant boundaries; a successful test of one set of files does not validate a different one. If the operational burden is keeping a computer on and watching a long-running prerecorded feed, StreamNeo can remove that specific task by letting you upload a video and keep its YouTube broadcast running without your computer; it is YouTube-only, so it does not change the need to prepare and validate compatible media.
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
Will the concat demuxer stop YouTube from ending the stream?
It can present a fixed list as one sequential input, so FFmpeg need not stop and restart output for each file. It does not guarantee continuous ingest if the files are incompatible, the process fails, or the network or YouTube configuration has a problem. Check both FFmpeg’s logs and YouTube’s status.
Can I use the same concat list for any MP4 files?
No. The extension does not tell you whether streams, codecs and time bases match. Inspect the files first; if they need normalising or re-encoding, consider the concat filter and test the result.
Why is there a pause or glitch between two files?
Check actual stream durations, timestamps and the duration values used to place the next file. Also listen to the source files around their ends: a pause may already be in the media. Correct duration information only when you have verified it, then test the transition again.
Should I switch to HLS if an RTMP playlist has a gap?
Not as a first troubleshooting step. YouTube documents different requirements for RTMP/RTMPS, HLS and DASH, and HLS uses segmented uploads. Confirm the current ingest protocol and diagnose compatibility, timestamps and connection status before changing protocols.