Skip to content
streamneo.
Setup Guides12 min read

How to Create a YouTube Live Playlist from Files in a Folder Using FFmpeg

Build an ordered, repeating YouTube Live feed from local files with FFmpeg, with guidance on concat scripts, compatibility and stream settings.

sn.
StreamNeoPublished 4 October 2026
Worth sharing?

A folder of videos is not a YouTube playlist. With FFmpeg, you can read a deliberate sequence of local files and send that sequence as a repeating live feed to YouTube, provided the files are compatible and the encoder output is configured for your stream.

This is a documentation-based workflow, not a command tested against every combination of media. The important work is preparing the file order, checking stream compatibility, and testing the incoming preview before you take a broadcast live.

A local sequence, not a YouTube playlist

A YouTube playlist is an object on YouTube that groups videos for viewers. This guide does not create or update that object. Here, “playlist” means a text file that tells FFmpeg which local video files to read, and in what order, while FFmpeg sends a live encoder feed to YouTube.

That distinction affects how you plan the channel. The source files remain on the computer running FFmpeg, and the text file represents a fixed sequence. YouTube receives a live broadcast; viewers are not choosing an item from a YouTube playlist, and adding a video to a folder does not automatically insert it into a running sequence.

If your goal is a broadcast without keeping your own computer running, compare the mechanics with streaming a pre-recorded playlist through a cloud platform. For a local FFmpeg setup, you control the process and the machine that runs it: if that machine loses power or its connection, the outgoing broadcast can stop.

Choose and order the files

Start with a fixed set of source files that you have permission to broadcast. Decide on the sequence before starting FFmpeg. For example, a devotional channel might put an opening visual first, then several bhajan recordings, then a longer instrumental segment. A study channel might use a short station ident followed by recorded focus sessions.

FFmpeg follows the order in the text script, not a viewer-facing sort order and not necessarily the order you see in a file browser. Names such as clip-01.mp4, clip-02.mp4 and clip-10.mp4 can also sort unexpectedly in some tools. Numbering consistently and writing each entry explicitly makes the intended order easier to inspect.

A folder itself is not scanned continuously by the concat demuxer. If you add or remove a file, update the script and restart the process to use the new fixed set. For a folder that changes between broadcasts, generate the list in a deliberate, deterministic order before each run and verify its contents. Do not assume a file added while FFmpeg is running will appear at the next transition.

Keep source files together where practical, or use paths that are clear from the process working directory. A relative path such as media/clip-01.mp4 is interpreted in relation to where FFmpeg is launched, not necessarily the folder containing the playlist text file. If you use absolute paths, account for FFmpeg's default safety check, explained below.

Create the concat-demuxer text file

Create a plain UTF-8 text file named playlist.txt. For a simple case, save it in the directory from which you will run FFmpeg and use this format:

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

The first line must be exactly ffconcat version 1.0 for FFmpeg to recognise the script automatically. Put one file directive on each following line, with the path to one source file. The script is read as an ordered list, so move the lines to change the sequence.

Paths containing spaces or special characters need quoting and escaping according to FFmpeg's concat-script syntax. Do not treat ordinary shell quoting rules as a substitute: the playlist is its own text format, read by FFmpeg rather than by the shell. If a path is complicated, test it in a short run and check the error output before starting a public broadcast.

The concat demuxer uses a safety check by default and may reject absolute paths or other paths it considers unsafe. Prefer safe relative paths where possible. If your chosen paths require it, -safe 0 disables that check for the input script. Use it only with a playlist you control and trust; it is not a general fix for misspelled paths or incompatible media. See the FFmpeg concat demuxer documentation for the script format and path rules.

If your playlist contains relative paths, run FFmpeg from the working directory those paths are based on. If it contains absolute paths, confirm every entry exists and decide whether the safety setting is necessary. A missing file or a path interpreted from the wrong directory can stop the input before YouTube receives anything.

Check that the input streams match

The concat demuxer joins files by presenting their streams in sequence; it is not a general-purpose converter that makes any set of videos compatible. Inputs need matching streams, including compatible codecs and time bases. In practice, inspect more than file extensions: check whether each file has video and audio, the video and audio codecs, dimensions, frame rate, audio layout and relevant stream structure.

A collection of MP4 files is not necessarily a matching collection. One MP4 might contain H.264 video and AAC stereo audio, while another has a different frame size, frame rate or audio layout. The container name alone does not tell you that transitions will work cleanly. Use FFmpeg's probing tools to examine the actual streams, then decide whether the sources are sufficiently alike for this workflow.

Duration metadata matters too. The concat demuxer uses each file's duration to place the next one. If a duration is missing or incorrect, the boundary can produce gaps, overlap or other artefacts. Where you know a duration accurately, the concat script supports duration directives, but guessing at a duration can make the sequence worse. Consult the concat documentation and verify the result with your actual files.

When sources do not match, normalise them beforehand into a consistent format and stream structure. That may mean re-encoding to a common resolution, frame rate, video and audio codec, and audio layout. Re-encoding costs processing capacity, so choose settings your machine can sustain. If the sources already match, stream copying may reduce encoding work, but it does not remove the need to validate transitions or meet YouTube's ingest requirements.

For a small channel whose main constraint is an older machine, it is worth considering how FFmpeg playlist streaming affects CPU use. The useful choice is not simply “copy or encode”: copying is less processing work when streams are compatible, while re-encoding can make mixed sources more consistent at the cost of CPU or GPU load.

Loop the playlist with FFmpeg

For a file-based live output, FFmpeg needs to read the source at real-time pace rather than process it as quickly as the computer permits. The -re option provides input pacing. The -stream_loop -1 input option tells FFmpeg to repeat the input indefinitely. The FFmpeg command-line documentation describes these options; option placement matters because they apply to the input.

A starting command shape for a compatible set of H.264/AAC MP4 files and an RTMP-style endpoint is:

ffmpeg -re -stream_loop -1 -f concat -safe 0 -i playlist.txt \\
  -c:v libx264 -pix_fmt yuv420p -preset veryfast -b:v 5M -maxrate 5M -bufsize 10M \\
  -r 30 -g 60 -c:a aac -b:a 128k -ar 44100 \\
  -f flv "$YOUTUBE_RTMP_URL/$YOUTUBE_STREAM_KEY"

This is an illustrative template, not a universally correct command and not a recipe tested on every media file. In this example, the playlist is an input, followed by video and audio output choices and an FLV output destination. The -safe 0 choice is included for cases where the script uses paths rejected by the default check; remove it if safe relative paths work for your setup.

The values in the example are placeholders for a starting configuration, not YouTube requirements for every stream. Set resolution, frame rate, bitrate, GOP/keyframe interval and audio handling to suit your source files, available upload capacity and the current settings for your YouTube stream. If you change the source frame rate, for example, forcing a different output rate can alter the picture cadence. Test for that rather than assuming a command option is harmless.

YouTube's live encoder guidance lists CBR for RTMP/RTMPS, H.264 as a supported video codec, and a recommended keyframe frequency of two seconds, with a maximum interval of four seconds. It also gives codec-specific bitrate guidance. Use the current YouTube encoder settings to choose an output profile; treat its recommended bitrate as guidance, not as a promise that your connection can sustain it.

The example uses shell environment variables to keep the destination readable. Set them privately in the shell that runs FFmpeg, or use another protected method. Do not paste a stream key into a public script, screenshot, support post or public log. The key identifies the incoming broadcast, so anyone who obtains it may be able to send to that stream until you replace it.

Connect to the YouTube encoder endpoint

In YouTube Studio, open Live Control Room and create or schedule an encoder stream. YouTube provides an ingest URL and a stream key in the stream settings. The URL identifies where the feed should go; the key is the credential associated with the stream. Copy the active values carefully and use the endpoint format YouTube shows for that stream. See YouTube's encoder setup instructions for the current steps.

The destination in the example combines a URL and key in a common RTMP/FLV output pattern. Do not assume the exact destination string is identical for every stream: follow the values and format in your Live Control Room. If YouTube does not show a preview, first check that FFmpeg is sending to the right active endpoint and that the stream key has not been reset.

Start FFmpeg and wait for the incoming preview and stream health information. For a scheduled stream, YouTube's workflow is to wait for preview and then click Go live. If your channel requires a manual live-start action, starting the encoder alone does not necessarily make the broadcast public. Keep the Live Control Room open while you confirm picture, audio and status.

A local process puts responsibility for the running computer and its network connection on you. A power cut, operating-system restart or loss of upload can interrupt the stream. If you are weighing that against a computer-independent arrangement, a VPS-based nonstop sermon stream setup explains the different operating trade-offs without changing the basic requirement to protect your stream key and test the incoming feed.

Test the sequence and troubleshoot compatibility

Before using the setup for a long broadcast, run a private or unlisted test and watch the transitions, not just the opening frame. Listen across file boundaries for silence, abrupt level changes or missing channels. Check that the image changes when expected and that the next item begins at the intended point. A short local sequence can help reveal path and stream problems before you schedule a longer broadcast.

If FFmpeg reports that a file cannot be opened, check the spelling, working directory, quoting and whether the path needs a different safety setting. If it opens some files but fails at a transition, compare the streams and duration metadata for the files on either side. Matching extensions do not prove that codecs, time bases, dimensions or audio structure match.

If you see artefacts at boundaries, normalise the inputs or correct a duration only when you know the accurate value. If YouTube never shows a preview, check the active URL and key in Live Control Room, the output format and FFmpeg's error messages. If the key may have been exposed, reset it through YouTube rather than leaving it in a shared file.

Dropped frames or poor stream health point to a capacity or output-setting problem as well as possible source issues. Check sustained upload capacity and reduce resolution or bitrate if the connection cannot carry the chosen output reliably. YouTube recommends testing in advance and monitoring stream health; its published encoder settings are a better reference than copying an arbitrary bitrate from a sample command.

An endless input loop also does not mean an endless YouTube archive. YouTube says streams under 12 hours are automatically archived. Plan how you will end or restart a broadcast and check the current official guidance for archiving; do not infer that looping a file overrides YouTube's stated limit.

Choose the operating model and plan the run

FFmpeg is useful when you want direct control over a local, fixed file sequence and are comfortable maintaining the text file, command and running computer. It gives you a repeatable order, but it does not discover new files, monitor your channel on its own or remove the need to manage network interruptions. Those operational responsibilities matter more for a channel expected to run overnight than for a short test.

A hosted workflow can remove the need to keep your own computer switched on. StreamNeo turns an uploaded video into a YouTube live stream, so for someone already facing the problem of a local machine needing to stay awake, the files can be uploaded once and the broadcast can run without that computer; it remains YouTube-only and you still need to prepare the channel and source media.

For a local FFmpeg workflow, write down the exact file order, endpoint location, encoding settings and recovery steps before the scheduled run. Keep a private copy of the concat script and a way to replace the stream key if it is exposed. A written handover also helps if someone else must restart the broadcast while you are away.

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 FFmpeg create a YouTube playlist?

No. The concat text file orders local media for FFmpeg; YouTube receives an encoder live stream, not a newly created YouTube playlist object. To make a viewer-facing YouTube playlist, create that separately in YouTube.

Will any files in the folder concatenate?

No. The folder is only a location for files, and the concat demuxer expects an ordered script. Input streams need to match, including codecs and time bases, and duration problems can cause artefacts. Probe and test your actual sources, and normalise them if needed.

Will FFmpeg keep finding videos I add while it is running?

No. The concat script represents a fixed list for that process. Update or regenerate the list and restart FFmpeg when you want to use a changed sequence.

Does -stream_loop -1 make the YouTube archive run forever?

No. It repeats the input for FFmpeg, but it does not override YouTube's archive behaviour. YouTube says streams under 12 hours are automatically archived, so check the current official guidance and plan the broadcast accordingly.

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 ↗