To stream several videos from a folder to YouTube Live with FFmpeg, make an explicit playlist in the order you want, then feed that list to FFmpeg and connect its output to the stream URL and key from YouTube Studio. This works most simply when the files have compatible streams, codecs and time bases; the concat demuxer does not convert arbitrary mixed media into a consistent broadcast.
The workflow below is a source-based command template, not a universally tested recipe. Your files, FFmpeg build, encoder settings and YouTube’s current ingestion options determine whether it works as written. Check a short test stream before relying on it overnight.
How the concat demuxer reads a playlist
FFmpeg’s concat demuxer reads a text script containing files in sequence and presents their packets as one input to the rest of the command. It is different from a playlist player that independently opens each item, and it is not the same as FFmpeg’s concat filter. The demuxer is useful when the inputs are already aligned well enough to be read as a continuous sequence without re-encoding each one.
That distinction matters. A file list tells FFmpeg what to open and in what order; it does not standardise frame size, frame rate, codec, audio layout or timestamps. The FFmpeg concat demuxer documentation describes the expected matching streams, codecs and time bases. If those properties differ, the demuxer may reject the input, or the resulting output may have transitions or timestamps that do not behave as expected.
For a devotional channel, for example, a set of bhajan videos exported with the same video and audio settings is a more plausible direct-concat set than a folder assembled from phone clips, downloaded music videos and animations in several formats. That example is not a compatibility guarantee: inspect the actual streams. If the sources do not match, prepare them for a common output format before attempting a single continuous feed.
A key benefit of an explicit playlist is predictable order. A directory scan can return files in an order you did not intend. A script makes the sequence visible and reviewable, so you can place a morning prayer recording before a longer bhajan collection, or keep a news loop in editorial order.
Check file and stream compatibility first
Before building a long-running command, compare the files you intend to join. Inspect at least the video and audio streams, including whether a file has no audio or has multiple tracks. Check codec, dimensions, frame rate, time base, sample rate and channel layout. The concat demuxer’s requirement is about matching stream structure and codec parameters, not merely having familiar extensions such as .mp4.
An extension is only a hint about the container. Two .mp4 files may contain different video codecs or audio arrangements. Two files with H.264 video may still differ in dimensions, frame rate, profile, time base or audio streams. Conversely, different containers do not by themselves establish that the underlying streams are compatible. Let inspection, not the filename, guide the decision.
A practical inventory can use ffprobe to report each file’s streams, but the exact fields and command depend on how you prefer to inspect output. You can also open the files in a media information tool. Make a small table for yourself with filename, video codec and size, audio codec and layout, and duration. The aim is to catch differences before a broadcast, not to prove compatibility from a single label.
| What to compare | Why it matters | If it differs |
|---|---|---|
| Number and type of streams | One file may have video and audio while another has only video or extra tracks | Decide whether to add, remove or map streams during preparation |
| Video and audio codecs | Direct packet concatenation expects matching codec parameters | Convert to a chosen common format if needed |
| Time bases and timing | Timestamp continuity depends on how packets are timed | Test transitions; prepare common timing if artifacts appear |
| Resolution and frame rate | A downstream live output needs a coherent video profile | Scale or frame-rate convert during pre-processing, if appropriate |
| Audio sample rate and channel layout | Uneven audio formats can cause gaps or mapping problems | Resample or remap during pre-processing |
Do not infer from this table that every difference causes the same failure or that a particular conversion will solve it. The appropriate output depends on your material and desired quality. If your task is a podcast playlist with separate audio considerations, the OBS podcast playlist workflow offers a useful contrast in how a playlist can be handled; here the focus is specifically FFmpeg’s packet-level concat path.
Build an ordered ffconcat list
Put a plain-text playlist alongside the media where practical, and use simple relative filenames. Start the file with the exact line ffconcat version 1.0, then put one file directive per input in playback order. For three compatible files in the current directory, the list looks like this:
ffconcat version 1.0
file 'clip-01.mp4'
file 'clip-02.mp4'
file 'clip-03.mp4'
Save it with a clear name, such as playlist.ffconcat. Do not assume that a wildcard or an operating system’s directory order is the sequence you want. Review the list itself, especially when filenames contain dates, numbers or different naming styles. Explicit order is safer than trusting alphabetical sorting when, for example, clip-10.mp4 might otherwise appear before clip-2.mp4.
FFmpeg’s script syntax has rules for quoting and escaping whitespace and special characters. Safe mode is enabled by default; it accepts relative paths with a restricted set of portable characters and disallows unsafe paths and directives. Simple names such as those above avoid many problems. If paths contain unusual characters, consult the FFmpeg concat script syntax rather than guessing at shell quoting: the playlist is parsed by FFmpeg separately from the command line.
Avoid disabling safe mode merely because FFmpeg reports a rejected path. First move the list and files into a directory where relative, simple paths work. An option such as -safe 0 allows less restricted entries, but should only be considered when you trust the playlist contents and understand the paths it can reference. Do not take a list from an unknown source and relax this check to make it run.
If you generate the list automatically, sort filenames deterministically and escape each path according to FFmpeg’s concat-script rules. Test the generated text by opening it and checking the order; “sorted” is not always the same as your intended sequence. Keep source files and the generated list stable while the stream runs, rather than renaming or moving them mid-broadcast.
The demuxer estimates timestamps for the next file using the prior file’s duration. Incorrect or missing duration information can cause gaps or timestamp artifacts. FFmpeg supports a duration directive when you know the correct duration and need to override an estimate, but do not add guessed values. Compare a suspicious file’s actual playback duration with its reported duration, then test whether an explicit known value improves the transition.
Choose stream copy or prepare a common output
With stream copy, FFmpeg passes compressed audio and video packets through rather than decoding and re-encoding them. It usually avoids the extra processing and quality changes associated with re-encoding, but it depends on suitable matching inputs. Treat it as the first option only when the file inspection supports it and a representative test plays cleanly.
When source properties differ, pre-conversion or transcoding can create a consistent set of files for the playlist. That takes more preparation and processing, and you must choose an output profile that fits your material. It may involve re-encoding video and audio, changing dimensions or frame rate, or removing unnecessary tracks. There is no one safe conversion command for every source: a phone clip with variable frame rate, a music video with two audio tracks and a low-resolution animation need different decisions.
A sensible order of work is to pick the intended output profile, make copies of the source media, convert a few representative files, inspect their resulting streams, then create a short playlist and test transitions. Keep originals intact. If the converted set matches and behaves consistently, process the remainder using the same intentional settings. If you cannot decide on scaling, frame rate, audio mapping or quality settings, resolve those choices before scripting the full library.
For YouTube’s ingest profile, use its current encoder guidance rather than borrowing a setting from an unrelated setup. The YouTube Live encoder settings page currently recommends H.264 video at 10 Mbps for 1080p30 and 4 Mbps for 720p30, with CBR and keyframes every two seconds, not exceeding four seconds. These are platform recommendations checked on 2026-10-03, not a promise that either profile fits your source or connection. The same page lists other video codec options and separate guidance; verify it at publication and choose according to your actual output.
Your source profile, sustained upload capacity and the chosen YouTube settings all matter. A high output bitrate does not improve a low-resolution source, and a setting your connection cannot sustain can produce health warnings. For a more focused explanation of the trade-off, see the FFmpeg bitrate and resolution guide. Do not set a profile solely because it is labelled 1080p or because another channel uses it.
Send the playlist to YouTube Live
Create or select a live stream in YouTube Studio, then open the Live Control Room and copy the stream URL and stream key shown for the encoder. YouTube’s live streaming setup instructions describe the URL-and-key workflow. Prefer the RTMPS URL offered there if your FFmpeg build and chosen protocol support it; YouTube describes RTMPS as RTMP over TLS/SSL and notes that encoder support can vary in its RTMPS guidance.
The command below is a template showing where the pieces fit, not a tested universal recipe. Replace the URL and key placeholders locally, confirm the selected output options against your files and current YouTube guidance, and keep the key out of any published text:
ffmpeg -re -f concat -safe 1 -i playlist.ffconcat \
-c:v copy -c:a copy -f flv "rtmps://YOUR_INGEST_URL/YOUR_STREAM_KEY"
This copy-output example assumes the listed inputs are suitable for direct concatenation and that the output is accepted by the selected ingest endpoint. It does not encode to a chosen bitrate, normalize mismatched files or compensate for an unsupported stream. If your sources need normalization, prepare compatible files or use an intentionally designed transcoding command instead; do not paste this template and assume FFmpeg will fix every input.
The -re option reads media at its native rate rather than sending the file as fast as possible. The concat input and FLV output are shown because they express the basic playlist-to-live workflow, but actual option placement and encoder settings should be checked against the FFmpeg version and chosen output. If FFmpeg cannot open the playlist, address the input or path error before troubleshooting YouTube. If it connects but YouTube shows no preview, verify the URL, key, protocol and stream health indicators.
Treat the stream key as a credential. YouTube says, “Stream keys are like your YouTube stream’s password and address.” Do not commit it to a repository, include it in a screenshot, share it in a public support post or leave it in a script that others can read. Use a private local configuration method appropriate to your environment, and reset the key in Live Control Room if you believe it has been exposed. YouTube’s stream settings help explains stream-key management.
For a scheduled broadcast, YouTube instructs you to wait for the encoder preview and then select Go live. Do a trial run with a private or unlisted stream as appropriate to your needs, and confirm that the picture, sound and transitions are right before the public event. Channel eligibility and account restrictions can change, so recheck YouTube’s current live streaming eligibility requirements or relevant Help pages for the account you will use.
Test transitions and troubleshoot failures
A playlist that opens is not necessarily ready for a 24/7 channel. Test several transitions, including the change from the last file back to the first if you plan to repeat the sequence. Listen for silence, doubled audio or sudden level changes. Watch for a black frame, a resolution jump, a timestamp warning or a freeze at the cut. Use representative files rather than testing only the first two items in a large collection.
| Symptom | First checks | Likely next step |
|---|---|---|
| FFmpeg reports streams do not match | Compare stream count, codecs and time bases | Prepare common-format copies and test again |
| A file is rejected by the list | Check spelling, relative location, quoting and safe mode | Simplify the path or carefully review documented escaping rules |
| Gap or timestamp artifact at a transition | Compare actual duration with reported duration | Use a known duration override only when you can establish its value |
| No preview or connection failure | Recheck copied URL, key, RTMP/RTMPS selection and encoder support | Correct the connection details or use a supported protocol |
| YouTube reports poor stream health | Check sustained upload, selected bitrate and representative content | Lower or adjust the profile, then run another test |
When a stream mismatch occurs, do not keep adding command-line switches at random. First identify which file differs. If one file has no audio and the others do, decide whether to add an audio track or adjust mapping during preparation. If frame dimensions or rates vary, choose whether to convert them to a common profile. Then rebuild a short list from the prepared versions and check again.
Unexpected timing is often more subtle. Because the demuxer calculates the next file’s start from the preceding duration, an inaccurate duration estimate can move timestamps. Inspect a transition in the output and compare it to the source durations. A duration directive can help when the correct value is known, but it is not a general repair for every timestamp or source-timing issue.
For connection issues, separate local FFmpeg errors from YouTube ingest errors. A malformed playlist can stop FFmpeg before it ever connects. A key copied from the wrong stream, an RTMP/RTMPS mismatch or an encoder that does not support the selected protocol can prevent preview. YouTube’s status and stream-health messages are useful evidence; change one cause at a time and retest rather than changing protocol, bitrate and encoding settings together.
For an always-on channel, decide how the process will recover after an interruption and who will notice that it has stopped. Running FFmpeg on a desktop means the machine, network and process all remain part of the chain; the Raspberry Pi overheating guide covers one hardware concern if that is your host. If leaving a computer running and investigating overnight interruptions is the pain you are trying to remove, StreamNeo lets you upload the video, provide your YouTube stream key and have the broadcast run without your computer switched on, with monitoring and automatic restarts if it drops. It is YouTube-only, so it is not a replacement for a local FFmpeg workflow when you need custom processing or another destination.
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 stream multiple videos in a folder to YouTube Live with FFmpeg?
Create an ffconcat text file with one file entry per video in the exact order you want, then use it as the concat demuxer input and send FFmpeg’s output to the YouTube URL and key from Live Control Room. First verify that the inputs have compatible streams, codecs and time bases, and test a short stream before relying on it.
Why does the concat demuxer say the streams do not match?
The files may differ in stream count, codec parameters or time bases, even if their extensions look alike. Inspect the inputs and prepare compatible copies if needed; the demuxer is not a general format converter.
Where do I put the YouTube stream key in FFmpeg?
The key is part of the output destination assembled from the ingest URL and key shown in Live Control Room. Keep it private and out of example commands, screenshots and public repositories; use placeholders when sharing a command.
Should I use stream copy or re-encode the playlist?
Use stream copy only when the inputs are compatible and a representative test behaves correctly. Re-encoding or pre-conversion adds work and requires output choices, but is often the practical route when the sources have different stream properties.