To stream a local playlist continuously with FFmpeg, put the video files in order in a concat manifest, pass that manifest to FFmpeg, and use -stream_loop -1 to repeat it. Pace the input with -re and send the result to the current YouTube Live ingest URL using the matching stream key.
The important caveat is compatibility: the concat demuxer is designed for files with matching streams, codecs and time bases. Packet-copy concatenation is not a promise of gapless joins; mismatched files may need normalising and re-encoding, or the concat filter. This guide covers files you have locally and have permission to broadcast, not downloading or rebroadcasting YouTube videos.
Confirm rights and set up the YouTube event
Before preparing the command, confirm that you have the right to broadcast every video and audio track in the playlist. A local file is not automatically cleared for a public or continuous broadcast. For devotional, music, news or business material, check the relevant permissions for the exact use you intend, and consult YouTube’s current guidance if you are unsure. Do not assume that a particular encoding workflow changes the rights position.
In YouTube Studio, create or select the live event and choose the visibility and audience settings that fit the channel. Unlisted can be useful for a private technical rehearsal, but confirm the event’s settings yourself rather than relying on a command to configure them. YouTube explains the encoder workflow in its guide to creating a live stream with an encoder.
The event provides a stream URL and a stream key. Treat the key like a password: do not publish it in a screenshot, a public script, or a troubleshooting message. The command later in this guide uses a placeholder destination; replace it with the current values from Live Control Room. If you are working on a shared computer, consider how your shell history or saved files could expose the key.
A playlist is a single outgoing live feed assembled from multiple local files. It is different from queuing YouTube videos, and it is not the same as making a series of separate live events. If you are deciding what kind of pre-recorded channel to run, the practical planning in a guide to a 24/7 Malayalam storytelling channel may help you think through content order and channel format.
Prepare and order local media files
Collect the files you intend to use into a predictable location and decide their order before writing the manifest. Use filenames that sort unambiguously, such as part-01.mp4, part-02.mp4 and part-03.mp4, but remember that the manifest order—not the apparent order in a file browser—controls playback. Include only files you have checked and intend to broadcast.
Inspect each file for its video and audio streams, codec, dimensions, frame rate, time base and duration. FFmpeg’s ffprobe can report this information; if you are not comfortable with command-line output, a media information utility can also help. The point is not to make every source identical for its own sake, but to find out whether the concat demuxer’s compatibility assumptions are likely to hold. A video-only file mixed with a file that has audio, for example, is not the same stream layout.
Play the beginning and end of each item locally. Check that sound is present where expected, that the end is not cut off mid-sentence, and that black frames or silence are intentional. A technically readable file can still make a poor transition in a devotional sequence, a study station or a local news loop. Write down any awkward joins and decide whether to trim, replace or normalise the material before testing the broadcast.
Keep the playlist on a disk that will remain available for the whole run. If a removable drive sleeps, disconnects or changes its mount path, FFmpeg may lose access to the source. This is a local-file workflow, so a laptop sleeping, a reboot or a full disk can also interrupt delivery even when the command itself is valid.
For more on the relationship between a local encoder and YouTube’s ingest, see the explanation of RTMP, HLS, SRT and other streaming protocols. The practical distinction here is simple: FFmpeg reads your source files and pushes one encoded or copied output stream to the destination YouTube supplies.
Create the concat manifest
Create a plain text file named playlist.txt in a location you can identify. For automatic format recognition with the concat demuxer, its first line must be exactly ffconcat version 1.0. Then put one file line per item, in the intended playback order. For example:
ffconcat version 1.0
file '/media/show/part-01.mp4'
file '/media/show/part-02.mp4'
file '/media/show/part-03.mp4'
Change those example paths to the real paths on your machine. Each quoted path must identify an existing local file. Paths with spaces need careful quoting; if a path contains unusual characters, check FFmpeg’s concat demuxer documentation rather than guessing at escaping rules. Keep the manifest and source files in a place you control.
The concat demuxer treats the manifest as a virtual input: it reads the listed files one after another and adjusts timestamps using their durations. It does not simply create a new, independently encoded movie. FFmpeg’s concat demuxer documentation states that the files need the same streams, codecs and time bases. It also describes how duration information affects timestamp construction, so inaccurate duration metadata can contribute to gaps or artefacts.
The example command below uses -safe 0 to allow ordinary absolute paths in the manifest. That relaxes path restrictions, so only use it with a manifest and file paths you trust and control. Do not use it to process a manifest supplied by an unknown party. If you can keep the manifest paths within the accepted safe format for your setup, you may not need to relax that restriction.
Before streaming, check that every manifest entry is present and spelled correctly. A short test that reads the manifest is a useful way to catch a typo, but successful opening does not establish that transitions will look or sound right. You still need to test joins and the loop boundary with the actual output settings.
Repeat the concatenated input with FFmpeg
For compatible sources, this schematic command shows the main pieces:
ffmpeg -re -stream_loop -1 -f concat -safe 0 -i playlist.txt \
-c copy -f flv 'rtmps://<ingest-host>/<stream-key>'
It is an adaptable example, not a tested command for every FFmpeg build or YouTube event. Replace the destination with the URL and key currently supplied by YouTube Live Control Room, and do not leave the placeholder in place. Confirm your FFmpeg build supports the required input and output options, and confirm that the chosen output settings match the event’s current ingest guidance.
Option order matters in FFmpeg. Here, -re, -stream_loop -1, -f concat, -safe 0 and -i playlist.txt describe the input. The -stream_loop -1 option means to repeat that input indefinitely. The concat demuxer presents the manifest’s files in sequence; FFmpeg then sends the result as the FLV output format shown in the example. -c copy asks FFmpeg to pass through the existing encoded streams rather than decode and encode them again.
Packet copy can reduce processing and avoids another lossy encode, but it is appropriate only when the inputs are compatible with one another and with the required output. It does not repair differences in resolution, codec parameters, audio layout or timing. If the copied stream is not accepted by the ingest or the joins behave badly, changing the destination format alone is not a reliable fix. Revisit the media structure and the encoder settings instead.
The loop option repeats the concat input, not an individual file. Once the last manifest entry ends, FFmpeg begins the listed sequence again. This does not guarantee a seamless transition from the final file to the first: duration metadata, edit points and media structure still matter. If you are looking for a different approach to a single repeated asset, the guide to creating a loop for YouTube Live with FFmpeg covers a related but distinct workflow.
Pace output and send it to YouTube Live
The -re input option paces file reading at a real-time rate, which is appropriate when reading stored media for live output. Without real-time pacing, a file can be processed faster than its intended playback duration, which is not the behaviour you want from a live feed. Pacing is not a substitute for adequate processing capacity or a stable network connection.
YouTube’s current encoder guidance should determine the output profile. Its settings page covers supported protocols and codecs, bitrate guidance by resolution and frame rate, and keyframe expectations. It recommends a two-second keyframe interval and says not to exceed four seconds; treat those as YouTube’s encoder recommendations, not universal values for every pipeline. It also lists frame rates up to 60 fps. Check the current YouTube encoder settings guidance before selecting or changing output parameters.
For broad compatibility, H.264 video and AAC audio over RTMPS are common choices, but this example uses -c copy and therefore does not convert a source that is encoded differently. If your sources do not already meet the intended output requirements, use a normalisation and encoding workflow rather than assuming that copied media will satisfy YouTube. Choose a bitrate based on YouTube’s current recommendations for the actual resolution and frame rate, and make sure your available upload capacity can sustain it. There is no single bitrate that is correct for every playlist or connection.
In Live Control Room, wait for the preview and inspect stream health before making the event public. Check both picture and sound, and confirm the event shows the expected incoming signal. YouTube recommends testing before going live and monitoring stream health. A short unlisted rehearsal lets you validate the complete path—including the command, network, event configuration and media—without treating successful FFmpeg startup as proof that viewers will see a healthy stream.
The process depends on the computer running FFmpeg, the source files staying accessible, and the network continuing to carry the output. If you need a machine-independent way to keep a file playing after your own computer is switched off, StreamNeo removes that specific need to leave this local FFmpeg process running on your computer; it is for YouTube, not a replacement for checking your content rights or event settings.
When ending a test or broadcast, stop the outgoing stream from the encoder and end the event in Live Control Room as appropriate. YouTube says encoder streams shorter than 12 hours are automatically archived after they end; do not rely on that behaviour for a stream that exceeds that duration. Decide in advance whether you want an archive and check the current YouTube event controls.
Handle mismatched files and test joins
A manifest can be syntactically correct while its media is unsuitable for packet-copy concatenation. The demuxer expects matching stream structure, codecs and time bases. If one item has a different video codec, a different audio arrangement, or a substantially different format, copying packets from each file into one output may fail, be rejected, or produce playback problems. A join that works at the start of the playlist does not prove all later joins work.
There are two broad remedies. If you can make the source files conform to a common output profile, decode, normalise and re-encode them before concatenation. This gives you a chance to align properties such as frame rate, dimensions and audio layout, at the cost of processing time and an additional encode generation. Avoid copying a universal conversion command without first knowing the sources and target profile: a command that is suitable for one set of files may distort or discard information in another.
Alternatively, use FFmpeg’s concat filter where you need a filter-based, re-encoded concatenation. The filter works on decoded streams and requires the inputs to be brought into compatible forms for the operation; it is not a magic switch that removes the need to define a consistent output. FFmpeg’s concat FAQ distinguishes the concat demuxer, which can avoid re-encoding when inputs are suitable, from the concat filter for workflows where re-encoding is needed.
| Situation | Better starting point | Main trade-off |
|---|---|---|
| Files have matching streams, codecs and time bases, and joins have been tested | Concat demuxer with packet copy | Less processing and no additional encode, but sensitive to compatibility and duration information |
| Files differ or need a common output format | Normalise and re-encode, using the concat filter where appropriate | More processing and an encode step, but more control over consistent output |
| You are sending to YouTube Live | Use the event’s current URL and key with settings checked against YouTube guidance | Ingest settings and network capacity must suit the stream |
Test every transition, not just the first few seconds. Listen for abrupt changes in loudness, clipped speech, missing audio and silence. Watch for a black frame, a frozen image, a timestamp jump or a pause when one file gives way to the next. Also test the last-to-first transition, because it is a separate join created by the repeat loop. If the files are long, plan a test that reaches that boundary before relying on it in a public schedule.
When you find a bad join, note which two files meet there and inspect their metadata and edit points. A short test output around the transition can help isolate the issue, but do not assume a locally clean test guarantees a clean YouTube ingest. Check the actual Live Control Room preview and stream health as well. For more on matching media properties across a long-running channel, see how to normalise frame rates across videos.
If the stream stops, distinguish an input problem from an ingest or network problem. FFmpeg output can reveal that a source file could not be opened, while Live Control Room can show whether YouTube is receiving data and whether its stream health has warnings. Keep the key private when sharing diagnostic output, and do not publish a full command if it contains the key. Once you change a manifest, re-encode a source or alter output settings, repeat the relevant transition and ingest tests.
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 I use -c copy with any MP4 files?
No. The container extension does not establish that the files have matching streams, codecs or time bases. Inspect the media and test the joins; use normalisation and re-encoding or the concat filter when the inputs are not suitable for packet-copy concatenation.
Does -stream_loop -1 make every transition seamless?
No. It repeats the input indefinitely, but does not fix inaccurate durations, incompatible streams or abrupt edit points. Test all file-to-file joins and the boundary between the last and first files.
Where do I get the YouTube destination and stream key?
Create or select the live event in YouTube Studio and copy the current stream URL and key from Live Control Room. Keep the key confidential, and confirm the event’s ingest settings before using it in FFmpeg.
Can the playlist continue if my computer is off?
Not with a local FFmpeg process that depends on that computer and its files. If you need the file to continue as a YouTube stream while your computer is switched off, use an operating arrangement that does not depend on that local process, and still verify the event and stream health.