A playlist can look continuous in a media player and still freeze, go black or lose audio when FFmpeg moves from one file to the next. The first thing to check is whether the files have compatible streams and properties; changing YouTube’s ingest settings will not make mismatched inputs compatible.
When the files match, FFmpeg’s concat demuxer can join them without re-encoding. When they do not, prepare consistent copies or use the concat filter and re-encode. Neither path guarantees a gap-free result for every file, network and viewer, so test the transitions before relying on the feed.
What happens between playlist items
A playlist is not necessarily one continuous video. FFmpeg has to read each item, pass its streams onward and handle the timestamps and duration at the boundary. If it is copying streams, it does not decode and rebuild them to make differences disappear. The next file needs to fit the stream structure and properties expected by the concat demuxer.
That is why an error or a visible pause often occurs precisely when the source changes. One video might be H.264 at one resolution while the next uses a different codec or frame rate. Audio could be present in only one file, or use a different channel layout. Their timestamps or stream durations might not line up cleanly either. These are source and transition issues; YouTube’s ingest URL cannot repair them.
FFmpeg offers two relevant approaches. The concat demuxer reads a sequence of files as an input and can avoid re-encoding when the streams are compatible. The concat filter connects decoded streams in a filter graph, allowing you to process inputs with different properties before encoding a new, consistent output. The FFmpeg concat FAQ describes the distinction. Neither method is a universal promise of seamless playback.
Before changing your command, note what you see and where it occurs. Does FFmpeg report an error at the transition? Does its output continue while YouTube’s preview stalls? Does video resume but audio disappear? A repeatable problem at one particular item points towards its media properties or timestamps. A problem that appears at different points under load may instead involve encoding capacity or network stability.
Inspect every file before changing the command
Make an inventory of all items, not just the first one. Use ffprobe on each file to check its video and audio streams, including codec, dimensions, frame rate, pixel format, time base, sample rate, channel layout and duration. Keep the output concise enough that you can compare one file with another. A spreadsheet or text table works; what matters is spotting differences before you choose a concat method.
For example, suppose the first three items all contain H.264 video at the same dimensions and frame rate, with AAC stereo audio, but a fourth item is a different resolution and has no audio stream. It is not safe to assume that the demuxer will adapt at that boundary. Decide whether to replace the outlier, add or prepare suitable audio, or process the files into a common output format.
Check stream count and order as well as headline values. One item may have more than one audio track, subtitles or another video stream. Decide which video and audio you want in the final feed, then make the mapping consistent. A file with a silent audio track is different from one with no audio stream at all, even if both seem silent when played. Inspecting stream details can explain errors that a quick visual check misses.
Duration deserves its own check. Video and audio may end at different times, or a file may contain irregular timestamps. A player can conceal some of this while buffering; a concatenated feed can expose it as a pause, a frozen frame or an audio discontinuity. Write down which transitions need attention instead of repeatedly changing encoder flags and hoping the symptom moves.
If YouTube rejects the format after FFmpeg has produced a stable output, that is a separate problem from joining the playlist. The guide to converting playlist files when YouTube Live rejects a format covers that kind of ingest mismatch. First establish whether the trouble begins in FFmpeg’s output at the file boundary.
Use the concat demuxer when sources conform
Choose the concat demuxer when the files already have compatible streams and properties. It can pass the media through without re-encoding, which avoids an extra generation of lossy encoding and reduces the processing required. It does not convert different codecs, change resolutions or fill in missing audio. If sources are mismatched, stream copying them does not make them match.
The usual input arrangement is a text file with one entry per source, in playback order. Each entry names a file, and the command reads that list with -f concat. If paths need it, -safe 0 relaxes path restrictions; use it only when you understand which paths the list will open. Protect the playlist and command if they contain private filenames or credentials.
A schematic command shape for a compatible playlist is:
ffmpeg -re -stream_loop -1 -f concat -safe 0 -i playlist.txt ...encoder and output options... -f flv "<YouTube ingest URL>/<stream key>"
This is not a drop-in command. The correct mapping, output encoder, rate control, container and protocol depend on your FFmpeg build, source streams and YouTube event. Check your installed FFmpeg documentation for option syntax and ordering. In particular, input pacing and looping options belong in the appropriate place for the input they affect; do not copy a command blindly because it worked with a different build or playlist.
For testing a finite playlist, leave out looping until you have checked a complete pass. Once transitions work, configure looping if the channel needs it and test the final-to-first boundary too. That boundary is another transition and can fail for the same reasons as any other item. If your sources do not conform, move to a preparation or filter-and-encode workflow rather than trying to persuade the demuxer to normalise them.
Normalise mismatched files to a common format
If you want to keep the simpler demuxer workflow, make staging copies of the files that do not match. Convert every item in the playlist to one target profile, rather than converting only the obvious outlier and leaving smaller differences to surface later. Standardise the chosen video codec, dimensions, frame rate and pixel format, along with the audio codec, sample rate and channel layout. Then compare the prepared files before concatenating them.
Choose a target that suits the channel and can be sustained by the machine that will encode or send the feed. A devotional image with modest movement, a lofi visual loop and a news sequence do not necessarily need the same resolution or frame rate. Your target also has to be acceptable to YouTube’s current ingest guidance. Lowering the output profile can make processing easier, but may reduce detail or motion smoothness; retaining a high source profile can cost more processing and bandwidth.
Normalisation takes time and storage. You need room for prepared copies while keeping originals, and you should retain the source files until you have tested the result. Re-encoding can reduce quality, especially if a source is already compressed, so choose settings deliberately and inspect the converted output. Do not assume that matching the visible resolution alone fixes a transition: time bases, streams, audio layout and timestamps still deserve attention.
Once prepared, the files should present the same intended streams in the same order and with compatible properties. If a file cannot reasonably be brought into that profile, use a filter graph that handles it explicitly or replace it. The FFmpeg concat documentation explains the filter approach. A common profile reduces one category of mismatch; it does not certify that every timestamp or content boundary is clean.
For an always-on channel, the preparation decision affects where you run the workload. Re-encoding a long playlist on a local PC uses that PC’s processing capacity; a cloud machine has its own capacity and storage constraints. The comparison of a Windows PC and VPS for a 24/7 video stream may help you assess that operating trade-off. It does not replace a test with your actual files.
Use the concat filter when you need to re-encode
Use the concat filter when inputs differ and you are willing to decode, process and encode a new output. In a filter graph, each input can be scaled or otherwise processed into the chosen profile before the streams are joined. The result is encoded as one continuous output stream. This is more flexible than stream-copy concatenation, but it costs more processing and may require careful filter construction.
The filter graph needs a deliberate plan. Select the video and audio streams you want from each input, make their properties consistent, and join corresponding video and audio streams in the same order. If a source has no audio, decide whether the output should include silence for that segment or whether the content should be changed. A graph cannot infer the editorial choice you intended. Verify stream selection and filter syntax against the FFmpeg version you use.
Re-encoding also introduces a practical constraint: the machine must keep up with the selected output settings while sending the feed. If encoding load spikes at a transition, reduce the target resolution or frame rate, simplify the processing, or prepare the files ahead of time. Test the actual workload rather than relying on a generic hardware claim. The relevant question is whether your setup processes and sends this playlist steadily over a full pass.
Keep an eye on quality as well as continuity. A filter can make the dimensions and timing more uniform, but it cannot restore detail absent from a source. Scaling a small video up to a larger frame does not add genuine detail. Listen at every join: abrupt cuts, mismatched loudness or a missing track may be technically valid output while still making the channel feel broken.
Choose between pre-normalising and filtering live based on where you want the work to happen. Preparing files in advance makes the live send less dependent on real-time encoding capacity, at the cost of preparation time and storage. Filtering and encoding into the live output keeps the source set in place, but the running pipeline has more work to sustain. Both approaches need a real transition test.
Send one continuous output to YouTube Live
Once FFmpeg is producing the intended continuous output, configure the YouTube connection. Create or select the live event in YouTube Live Control Room, then retrieve its stream URL and key there. Treat the key like a password: do not publish it in a script, screenshot, shared log or article. If it is exposed, reset it in Studio before using it again. YouTube explains the event and key workflow in its live streaming setup guidance.
Match the output encoder settings to YouTube’s current guidance for the selected codec, resolution and frame rate. Its encoder settings and bitrate guide lists supported ingest options and recommendations. For example, it recommends a two-second keyframe interval and says not to exceed four seconds. Its bitrate recommendations vary by format; use the applicable row rather than borrowing a value from another resolution or frame rate. Settings and recommendations can change, so check the current official page before an event.
YouTube recommends RTMPS, its secure extension to RTMP. Retrieve the RTMPS URL from Live Control Room if your encoder supports it, and use the URL and key for the event you intend to send. Do not paste a key from an old script simply because a previous test connected. Keep the output protocol and format compatible with both your FFmpeg build and the event configuration.
For a file-based live feed, real-time pacing is important: without it, FFmpeg may process a file faster than its intended playback rate. The -re input option is commonly used for this purpose, but confirm its behaviour and placement for your installed version and command. Looping can be configured with -stream_loop -1; test the start, ordinary joins and loop boundary rather than assuming the option makes them seamless.
The ingest connection is only one part of the path. YouTube advises testing before a live event, monitoring stream health and leaving upload headroom; its streaming tips recommend a 20% buffer above the stream’s bitrate. That is a recommendation, not a guarantee against network disruption. A stable wired connection may help avoid local wireless variation, but it cannot fix incompatible source files. For a persistent channel, consider how to keep a cloud-hosted stream online during maintenance as a separate operational concern.
Test transitions and diagnose what remains
Run a private or unlisted test using the actual playlist and intended output settings. Include audio and motion, and let the test cross every transition that matters. Watch the Live Control Room preview and its stream-health messages, but also check the viewer-facing playback. The preview can help locate an ingest issue; it does not prove that every viewer, on every connection, will see identical buffering behaviour.
Record the point and symptom of each failure. If FFmpeg reports errors at a particular file boundary, compare the two files’ streams and timestamps. If the output continues but YouTube reports poor health, check encoder load, bitrate settings and available upload bandwidth. If video and audio diverge, inspect their durations and timestamp behaviour. Change one relevant part of the pipeline at a time so the next test tells you something.
Check the loop boundary as carefully as the middle of the playlist. The last file may have a different duration, audio ending or stream layout from the first. Leave enough of the test to observe the transition, then confirm that FFmpeg is still running and YouTube is still receiving the event. For help with a source-selection issue rather than a join issue, see how an OBS media source can be made to loop; FFmpeg playlist handling is a different pipeline, but the distinction can help clarify where a loop problem begins.
If the test stalls under encoding load, first try a less demanding target profile or prepare normalised files offline. If the problem follows a specific transition, revisit stream compatibility and timestamps. If the output is clean locally but the live preview shows interruptions, compare stream-health messages and network stability before rewriting the concat graph. YouTube’s advice to test and monitor is more useful than trusting a command that has not been run against your files.
For a 24/7 channel, a test is a maintenance task, not a one-off ritual. Repeat it after changing the source set, FFmpeg build, output profile or network arrangement. Keep a known-good copy of the playlist and command with the stream key removed, plus notes about which transitions you checked. That gives you a way to distinguish a new media mismatch from a change in the sending setup.
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
Can the concat demuxer convert mismatched files?
No. It can avoid re-encoding when the input streams and properties are compatible, but it does not normalise different codecs, dimensions or audio layouts. Prepare compatible copies first or use the concat filter and re-encode.
Does one FFmpeg command guarantee a gap-free YouTube stream?
No. A continuous output depends on compatible media, timestamps, processing capacity and network conditions, as well as downstream playback and buffering. Test transitions with your actual files and monitor the live event.
Should I use the concat filter or prepare files in advance?
Use the filter when you need to process different inputs into one profile and your machine can sustain the encoding work. Preparing normalised files in advance shifts that work out of the live send, but uses preparation time and storage. Compare both with your playlist and equipment.
Do I need to change YouTube’s ingest settings to fix a black gap?
Not necessarily. First check whether FFmpeg’s output fails at the source boundary; ingest changes will not make incompatible inputs match. If the output is continuous but YouTube reports a connection or health problem, then check the event’s supported settings, stream key and upload stability.