To stream a playlist continuously with FFmpeg, put compatible local files in a concat demuxer list, loop that list, and read it at real-time speed before sending the encoded output to YouTube Live. The command below is an illustrative template, not a tested configuration; you still need to check the source files, use the current ingest details from YouTube, and monitor stream health.
This approach suits a channel built from recorded clips that should play in order and repeat: for example, a set of devotional videos or a collection of ambience scenes. It does not make your internet connection or YouTube ingest uninterrupted. A repeatable input is only one part of a live broadcast.
What the concat demuxer workflow does
FFmpeg’s concat demuxer reads a text list of files as if they were a single input. It adjusts timestamps so the first file begins at zero and each later file is placed after the previous one. With -stream_loop -1, FFmpeg repeats the entire listed input rather than stopping at the last clip. With -re, it reads the files at their native rate instead of consuming them as quickly as the computer can process them.
Those options have separate jobs. The concat demuxer defines what plays and in what order; looping repeats that sequence; real-time pacing simulates a live source; and the output settings define what FFmpeg sends to YouTube. The demuxer does not repair mismatched media or decide whether the encoded stream meets YouTube’s current ingest requirements.
This is a local-file workflow: the files need to be available to the computer running FFmpeg, and that process must stay running. If you want background on a related setup, the guide to running FFmpeg on a VPS for a continuous YouTube stream covers the broader operating context. A VPS does not remove the need to verify media, network capacity, or stream health.
Prepare the concat list
Make a plain text file such as playlist.txt, with one file directive per line and clips in the order you want them played:
file 'clip-01.mp4'
file 'clip-02.mp4'
file 'clip-03.mp4'
Keep the file paths accurate. Relative paths are interpreted from the working directory of the FFmpeg process, not necessarily the folder where playlist.txt is saved. If you start FFmpeg from another directory, a relative path that looked correct in a text editor may fail. Absolute paths remove that ambiguity, although they make the list less portable between machines.
Names containing spaces or special characters need correct quoting or escaping. Test the list with your actual filenames before scheduling a broadcast. If you use the optional header ffconcat version 1.0, it must be exact: no leading byte-order mark and no extra spaces. Otherwise, selecting the concat demuxer explicitly with -f concat avoids relying on automatic script-type recognition.
The -safe 0 option in the template below permits paths beyond the demuxer’s safe-path subset. Use it only when the playlist and its paths are under your control. Do not copy a list of unknown origin into a process that has been given permission to access arbitrary local paths.
The concat demuxer is not the same as joining clips into a new permanent file. It reads them in sequence during playback. That distinction is useful if you want to change the playlist without first rendering a single long video, but it also means the source files and list must remain present and readable throughout the run.
Check stream compatibility and durations
Before trying to stream, check every file for its video and audio streams, codecs, time bases, frame rates, dimensions, and duration. FFmpeg’s concat demuxer documentation warns that “All files must have the same streams (same codecs, same time base, etc.).” Similar-looking clips are not necessarily compatible at the stream level.
Different durations or inaccurate duration metadata can place the next clip at the wrong timestamp. That can produce gaps or visible and audible artefacts around transitions. Check the files rather than assuming the duration shown by a media player is precise enough for concatenation. The demuxer supports a duration directive for cases where a probed duration is unavailable or inaccurate, but it does not make an incorrect value harmless: the value affects where the next file is positioned.
If the clips differ in a way the demuxer cannot handle cleanly, normalise or re-encode them to a consistent format before using the list. Alternatively, consider the concat filter when re-encoding is needed. The FFmpeg FAQ’s discussion of concatenation distinguishes the demuxer, which can avoid re-encoding when inputs fit, from the filter route used when re-encoding is needed.
You may see stream-copy examples using -c copy. Copying avoids decode and encode work and does not add another lossy encode, but it cannot apply filters and is not guaranteed to fit every source and destination combination. For YouTube ingest, re-encoding the output gives you control over its codec, frame rate, bitrate, and keyframe cadence. Choose based on the files and required output, not on a blanket assumption that copying is always better.
If you are building a channel around a sequence of music or devotional items, compare the file preparation step with the practical playlist workflow in setting up a Marathi devotional playlist as a continuous YouTube Live stream. The subject matter does not change the media requirements: check rights for the material you use, and check the current YouTube rules that apply to your channel and content.
Loop the input and use real-time pacing
The key options belong before the input they modify. -re reads the file input at its native rate, equivalent to -readrate 1; it is useful when a file is standing in for a live source. -stream_loop -1 tells FFmpeg to loop the input indefinitely. Put both before -i playlist.txt so they apply to the concat input.
The following is an illustrative template for 30 fps H.264 video with stereo AAC audio. It is not tested, is not a universal preset, and may need changes for your files, FFmpeg build, output resolution, network, and current YouTube requirements:
ffmpeg -re -stream_loop -1 \
-f concat -safe 0 -i playlist.txt \
-c:v libx264 -preset veryfast -tune zerolatency \
-b:v 5M -maxrate 5M -bufsize 10M \
-g 60 -keyint_min 60 -sc_threshold 0 \
-c:a aac -b:a 128k -ar 44100 \
-f flv 'rtmps://YOUR_INGEST_ADDRESS/YOUR_STREAM_KEY'
The numeric settings here describe one example, not a promise that it will work for your channel. In that example, 60 frames at 30 fps gives a two-second group of pictures (GOP), the interval between keyframes. A different output frame rate requires reconsidering the frame-based GOP settings. The resolution, frame rate, bitrate, audio settings, and keyframe interval should be chosen to match the actual output and YouTube’s current recommendations.
A command-line option can also be in the wrong place. In particular, moving -stream_loop after -i changes how FFmpeg applies it. When diagnosing a run, keep the input and output options distinct, and read the FFmpeg messages rather than treating a command copied from an article as proof that a stream is configured correctly.
Send output to YouTube’s current RTMPS endpoint
Do not use a fixed address copied from an old tutorial. Retrieve the current server URL and stream key for your broadcast from YouTube Live Control Room, or from the applicable YouTube Live Streaming API documentation. The API describes ingestion details and stream status; your actual endpoint and stream name are specific to your channel and stream setup.
Replace both placeholders in the command with the current values shown for your stream. Treat the key like a password: do not publish it in a tutorial, paste it into a public log, or share a screenshot that exposes it. If you suspect it has been exposed, use YouTube’s current controls to manage the key and update the command accordingly.
The command uses RTMPS, YouTube’s recommended encrypted ingest option, and an FLV output container. YouTube documents RTMP and RTMPS ingest, along with other ingestion types. Use the protocol and endpoint YouTube currently provides for the stream, rather than assuming every broadcast uses one universal URL. Keep the destination in quotes, especially where shell characters in the key might otherwise be interpreted by the terminal.
For an H.264 output, YouTube Help currently lists a recommended bitrate of 14 Mbps for 1080p30 and 8 Mbps for 720p30, with minimums of 5 Mbps and 3 Mbps respectively. It recommends a two-second keyframe frequency and says not to exceed four seconds; for stereo audio it recommends 44.1 kHz and 128 Kbps. These are YouTube’s published operating recommendations, not a claim that a particular upload connection can sustain them or that they suit every source. Confirm the current YouTube encoder settings before production use, because guidance can change.
| Output example | YouTube H.264 bitrate guidance | Related settings to check |
|---|---|---|
| 720p30 | 3 Mbps minimum; 8 Mbps recommended | Frame rate, keyframe interval, audio format |
| 1080p30 | 5 Mbps minimum; 14 Mbps recommended | Frame rate, keyframe interval, audio format |
Choose the row that matches the output you intend to send, then check that your upload connection has enough sustained capacity for the stream. Bitrate is not a measure of audience demand, and a recommendation is not a guarantee against congestion. If the output is not H.264, consult the relevant current YouTube guidance instead of applying H.264 figures to it.
Preview and monitor stream health
A successful FFmpeg launch only tells you that the local process started. Watch YouTube Live Control Room for the incoming preview and stream-health feedback before treating the broadcast as ready for viewers. Check that both picture and sound arrive, and inspect transitions between clips rather than only checking the first frame.
Use a test with audio and motion representative of the actual programme. A static image and silent track do not reveal every problem that could arise in a music stream, a devotional sequence, or a news loop. Confirm the preview, listen for level or continuity problems, and look for a black frame, freeze, unexpected silence, or a visible discontinuity when the playlist changes files.
YouTube’s stream health information can report configuration concerns such as low or high bitrate, unsupported codecs, a frame-rate mismatch, or ingestion starvation. If it reports an issue, compare the actual outgoing settings with the current encoder guidance and check whether the upload connection can sustain the chosen bitrate. Also verify that the correct current endpoint and key are in use. A locally playable playlist can still fail as a live ingest.
The distinction matters overnight. A process that continues to read files does not prove that the network is carrying them or that YouTube is receiving a healthy stream. If you need to assess the wider operating choices for a channel, the article on OBS settings for a 24/7 YouTube stream on an Indian 4G hotspot discusses a different source and connection context; its settings should not be transferred blindly to this FFmpeg workflow.
Treat commands as templates and plan recovery
There is no single command line that fits all playlists. You need to confirm the FFmpeg version and available encoders, file properties, output specification, operating system shell, and YouTube’s current requirements. The template assumes a particular kind of output; it does not establish that your files share compatible streams or that the selected bitrate is sustainable at your location.
Plan what you will do if the process stops or the ingest drops. Keep the playlist and media in a known location, avoid editing or moving them while FFmpeg is using them, and preserve a private copy of the correct command with sensitive key material stored safely. If you arrange automatic process restart, understand what it restarts and how you will notice repeated failures. Restarting FFmpeg cannot fix a missing file, a malformed playlist, a bad key, a failing connection, or an incompatible output.
For a truly unattended channel, the operational question is not only how to begin playback, but how you will detect and respond when it stops. A continuously repeating input can still have a gap when the process exits, the computer loses power, the connection fails, or YouTube reports an ingest problem. StreamNeo can remove the specific burden of keeping your own computer running for a file-based broadcast: you upload the video, supply the YouTube stream key, and the broadcast runs with monitoring and automatic restart if it drops. It is YouTube-only, so it does not replace an FFmpeg setup when you need local command-line control or a destination beyond YouTube.
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 -stream_loop -1 loop each file or the whole playlist?
With the concat list supplied as the input, it repeats the input sequence: the listed files play in order and then the sequence starts again. It does not mean that each file is independently repeated before FFmpeg advances to the next one. Keep it before that input’s -i option.
Why does my playlist have a gap or artefact at a transition?
Check that the files have matching stream layouts, codecs, time bases, and suitable duration information. The demuxer places later files according to timestamps and duration, so inaccurate durations or mismatched streams can cause discontinuities. Normalise the media or use a re-encoding workflow if the inputs are not compatible.
Does this template guarantee a nonstop YouTube stream?
No. It illustrates how to concatenate, loop, pace, encode, and send a local playlist; it has not been presented as a tested configuration. Your process, computer, upload connection, endpoint, and YouTube ingest can all fail, so monitor stream health and have a recovery plan.
Can I use -c copy instead of encoding again?
Possibly, if the source streams are compatible with one another and with the selected YouTube ingest requirements. Stream copy avoids re-encoding but cannot apply filters or adjust the encoded output. Check the actual files and output requirements before choosing it.