Skip to content
streamneo.
Setup Guides14 min read

How to Loop Videos to YouTube Live with FFmpeg and a Text File Playlist

Build and test an FFmpeg concat playlist, check file compatibility, and connect it to YouTube Live with practical troubleshooting steps.

sn.
StreamNeoPublished 4 October 2026
Worth sharing?

To loop a sequence of local videos into YouTube Live, make a text playlist for FFmpeg’s concat demuxer, test that the files play in order, then encode the result to YouTube’s ingest URL with your stream key. The playlist format is simple; matching the media streams and checking the complete run are the parts that determine whether it works reliably.

This guide covers the concat-demuxer workflow and the checks around it. It does not assume that unrelated files will join seamlessly, or that FFmpeg can keep a broadcast uninterrupted if the computer, connection or ingest fails.

Prepare compatible input videos

The concat demuxer treats a list of files as a single sequential input. For that to work as intended, FFmpeg’s documentation says the files need the same streams, codecs and time bases. In practice, check that each video has the same video and audio stream layout, compatible encoding parameters and a sensible duration before you build a long-running broadcast. A playlist is not a format converter.

For example, a set of MP4 files may all play on your computer yet still differ in resolution, frame rate, audio sample rate or codec. Those differences can cause errors, timestamp jumps or awkward transitions when joined. Do not infer compatibility from the file extension alone. Inspect each file with a media probe, such as ffprobe, which is distributed with many FFmpeg builds, and compare the stream details.

If files do not match, convert them to a common format before creating the playlist, then test the converted files. Conversion settings depend on the source material and the output you intend to send; there is no single setting that is best for every devotional recording, music loop, news segment or ambience video. Keep the original media so you can return to it if the converted version has a quality or timing problem.

Pay attention to timestamps and duration as well as codecs. The concat demuxer adjusts timestamps so each file follows the previous one, but an inaccurate duration estimate can cause artifacts. Truncated files and files whose duration is hard to estimate are particularly worth checking. FFmpeg documents a duration directive that can override a file duration in a concat script, but only use it when you have a reliable value and have verified the result. See the FFmpeg concat demuxer reference for supported directives and constraints.

A useful first test is to play or decode every file separately, then check the end of one and start of the next. This catches a damaged file or an unintended blank section before you add the complication of streaming. If a file is not openable in your usual editor or player, investigate that before treating a playlist change as the fix. The checks in how to fix a video file that OBS cannot open also illustrate why file-level problems should be separated from live-ingest problems.

Create the concat playlist text file

Create a plain-text file in a text editor and put one file directive on each line, in the order you want the videos to play. Save it with a descriptive name such as playlist.ffconcat or playlist.txt. The extension is not the important part; the contents and how FFmpeg opens the file are.

A basic relative-path example looks like this:

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

Each entry points to one media file. The order in the text file is the playback order, so arrange episodes, station IDs, notices or music segments deliberately. Avoid editing the playlist in software that silently changes quotes, inserts formatting, or saves it as a rich-text document. It must be plain text.

Relative paths are resolved with respect to the playlist’s location, which makes a folder containing both the playlist and its media easy to move as a unit. If the playlist is elsewhere, relative paths may resolve differently than expected. For a first run, keep the playlist alongside the videos, use simple filenames, and verify the working directory or full playlist path you give FFmpeg.

If one entry is misspelled or points to a missing file, FFmpeg cannot follow the intended sequence. Check the spelling, capitalisation and extension against the actual filename. This matters especially when moving a project between operating systems, network shares or removable drives, where path rules and filename case handling may differ.

The concat script can contain more than file entries, but start with the minimum. Extra directives add decisions you must test. If you need a specific duration override or a path that does not work with the default safety checks, consult the documentation and make that change only for a clear reason. Avoid weakening safe-path behaviour just to get past an unexplained error.

Format paths and the ffconcat header

When using automatic format recognition, the header must be the exact first line: ffconcat version 1.0. Do not put a blank line, spaces, a comment or a byte-order mark before it. A text editor may insert a byte-order mark when saving a file as UTF-8; choose plain UTF-8 without BOM if the header is not being recognised. Alternatively, FFmpeg can be told explicitly to use the concat demuxer, but the header remains useful and should still be correctly formatted.

For filenames without spaces, a simple quoted entry is normally readable:

file 'morning bhajan.mp4'

The concat script follows FFmpeg’s quoting and escaping rules rather than shell quoting rules. A single quote or backslash in a filename needs appropriate escaping; putting double quotes around a path does not necessarily solve it. The clearest operational approach is to rename files to uncomplicated names, such as morning-bhajan-01.mp4, and avoid punctuation that needs escaping. If you retain special characters, check the escaping rules in FFmpeg’s format documentation and test that exact playlist.

Absolute paths can be useful when you want to launch FFmpeg from any directory, but they must use the syntax appropriate to the environment. Windows drive letters and backslashes, for example, can interact with script parsing, while Unix-like systems use forward-slash paths. Rather than copying a path from a file manager and assuming it is valid, test one entry and then the complete file. The default safe=1 rejects some paths considered unsafe. The FFmpeg documentation explains this option; disabling it broadens what is accepted and should not be a casual troubleshooting step.

A practical folder layout reduces path mistakes:

live-loop/
  playlist.ffconcat
  video-01.mp4
  video-02.mp4
  video-03.mp4

With this layout, the relative entries in the earlier example resolve from the playlist directory. If you use a different layout, either adjust the relative paths carefully or use a tested absolute path. Make a copy of the working playlist before experimenting, so an edit does not quietly break the version you already checked.

Test sequential playback locally

Before sending anything to YouTube, ask FFmpeg to read the playlist and produce a local output. This separates playlist and media problems from stream-key, network and YouTube settings. You can ask FFmpeg to write a test file or play the output locally, depending on the tools available on your system. First test a short sequence, then let the full list run through every transition.

The exact local command varies with the installed FFmpeg build and how you want to inspect the output. The important test is that FFmpeg opens each listed file, decodes the audio and video, and proceeds through the last entry without an error. Check both the console messages and the resulting picture and sound; a process that exits successfully can still produce a transition you would not want viewers to hear or see.

Listen at the joins. Look for a frozen frame, black gap, sudden loudness change, audio cut-off or unexpected silence. If the playlist will repeat, inspect the transition from the final item back to the first as well. A sequence can be valid at the demuxer level and still feel abrupt because the actual clips do not have matching content or editing points.

If the local test stops at a particular entry, temporarily test that file alone. Confirm the path and decode, then compare its streams and timestamps with the files around it. This can identify whether the problem is an invalid path, damaged media, a duration issue or a compatibility difference. Avoid changing encoder parameters until you know the playlist itself is readable.

A text-file playlist gives you direct control over order and makes changes visible, but it does not supply a scheduling interface or a preview of transitions. For a graphical alternative, OBS media source settings for a continuous rerun stream explain a different way to manage prerecorded material. Choose the workflow whose controls you can check and maintain, rather than assuming one method removes the need for testing.

Configure FFmpeg output and repeat behaviour

Once the local sequence works, configure the output as a live stream. The command has two distinct jobs: read the playlist as an input, then encode and send an output in a format YouTube accepts. The options you need depend on your FFmpeg version, operating system, input media and chosen ingest protocol. Check the installed build’s help and test a short broadcast before relying on a command copied from somewhere else.

For repeated playback, FFmpeg provides input looping options, but the exact placement and behaviour depend on the input and version. In general, an input-loop option needs to apply to the playlist input, not to the network output. Verify the option against the documentation or ffmpeg -h for the build you have installed, and confirm that the sequence returns from its last file to its first in a local test. This guide does not prescribe a universal loop command because a command that parses on one build or set of files may not behave as expected on another.

Decide whether to copy streams or encode them. Stream copy avoids re-encoding, but only makes sense when the input streams and output requirements are already compatible. Re-encoding gives you more control over output codec, frame rate, dimensions, audio and keyframes, at the cost of processing and another place for settings to be wrong. YouTube’s current live encoder settings guidance lists supported ingest and encoding choices, including RTMP/RTMPS and video codec options. Refer to the live table for the resolution and frame rate you actually plan to send.

YouTube’s guidance accessed in 2026 recommends a two-second keyframe interval and says it should not exceed four seconds. Its current table lists recommended H.264 bitrates of 14 Mbps for 1080p at 30 fps and 8 Mbps for 720p at 30 fps. These are YouTube’s recommendations for those settings, not universal FFmpeg values or a guarantee that your upload connection can sustain them. The appropriate video bitrate depends on resolution, frame rate and codec, and you should leave practical headroom for network variation.

YouTube recommends constant bitrate (CBR) for live encoding and supports AAC or MP3 audio in its guidance. Match the output to the selected profile and test actual playback rather than assuming the source’s audio or video properties are suitable. If the upload connection cannot sustain the output, reduce the output demands and test again. YouTube’s encoder setup instructions also recommend testing with content that has audio and movement similar to the real stream.

Running FFmpeg locally gives you control of the playlist and encoding process, but your computer, power and network connection must remain available for the whole broadcast. If you do not want a home or office machine to stay on or need recovery monitoring when the process drops, StreamNeo addresses that specific operational burden by taking an uploaded video and running it as a YouTube live stream without your computer staying on. It is YouTube-only, so it is not a replacement if you need a local FFmpeg process or another destination.

Connect to YouTube Live ingest

In YouTube Studio’s Live Control Room, create or select the stream and retrieve the stream URL and stream key for the encoder. You then provide those values in FFmpeg’s output configuration: the URL identifies the ingest destination, while the key authenticates your broadcast. YouTube’s encoder setup guide describes the setup flow. First-time live-stream activation may take up to 24 hours, according to YouTube Help accessed in 2026, so check channel eligibility and enablement before planning a launch.

Treat the key as a password. Do not place a real key in a public script, screenshot, shared support request or example command. A command line may be visible in shell history or process listings, so consider how you store and use credentials on your own system. If the key is exposed, reset it in Studio and update the encoder configuration. Use a placeholder such as YOUR_STREAM_KEY while building or documenting a command, then substitute the credential privately.

Prefer RTMPS when the available ingest endpoint supports it, and check that the URL and protocol in your command match the values YouTube provides. A typo in the endpoint, an old key, a mismatch between stream and key, or a channel that is not yet enabled for live streaming can all look like a media problem from a distance. Confirm the ingest connection independently from the playlist by sending a short, known-good test before you rely on a longer sequence.

Choose the stream’s visibility intentionally in Studio: public, unlisted or private. Check any scheduled-stream settings and the intended audience before going live. Also confirm that you have the rights needed for every video and audio track in the playlist; no encoder setting answers that question for you. YouTube’s help on managing live streams covers Studio controls, but you should check current official guidance for your channel and content.

If you are comparing ways to operate a recurring stream, local FFmpeg gives you file and process control but leaves power, restarts and monitoring to you. A hosted process can remove the need to keep a personal computer running, while adding a recurring service decision and reducing the control you have over the local process. The continuous playlist from Google Cloud guide is relevant if you are weighing a self-managed hosted setup rather than a machine in your premises.

Check stream health and troubleshoot failures

Once you send the feed, wait for YouTube Studio to show an incoming signal and inspect the preview. Confirm that video is moving, audio is present, the stream health panel has no unresolved warnings, and the broadcast reaches viewers in the intended visibility mode. Then let the playlist cross at least one file boundary and, if looping, its end-to-start boundary. A connection indicator alone does not establish that the viewer-facing result is correct.

When the stream does not appear, troubleshoot in layers. First verify that FFmpeg can still read and decode the playlist locally. Next check the output URL and key privately, then confirm that YouTube Studio is receiving a signal. Finally review encoder settings and the upload connection. This order makes it less likely that you respond to a bad key by reworking valid media, or respond to a corrupt file by changing network settings.

A stream that starts and then stops can have a different cause from one that never connects. Review FFmpeg’s output for a file-open or encoding error, check whether the machine slept or lost its network, and see whether Studio reports an ingest or stream-health issue. If the stream drops, YouTube’s control room and the encoder may require you to reconnect or restart the process. See how to recover a YouTube Live stream after a dropped connection for the broader recovery decisions; a concat playlist by itself does not restart a failed broadcast.

If the connection remains up but a transition fails, focus on the two files around that boundary. Compare their streams and duration metadata, test the transition locally, and make a compatible replacement or conversion where necessary. The concat demuxer cannot guarantee a seamless join between arbitrary files, and a duration override should not be used to conceal a mismatch you have not understood.

Keep a small runbook beside the playlist: where the files and text script live, how you verified the version of FFmpeg, how to retrieve or reset the key, and what to check in Studio when the preview is absent. For an unattended schedule, also decide who will notice a failure and what they are authorised to restart. FFmpeg can send the stream, but it does not ensure uninterrupted operation or provide an answer to every process or connectivity failure.

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 the concat playlist make different videos seamless?

No. It presents files sequentially, but the demuxer expects compatible streams, codecs and time bases, and the content itself may still have an abrupt edit. Check file properties and test each transition, including the loop boundary.

Can I use full paths or filenames with spaces?

Yes, but path parsing and quoting must follow FFmpeg’s concat-script rules, which are not identical to shell quoting. Relative paths from a simple folder layout are easier to validate; for special characters or absolute paths, consult the FFmpeg documentation and test the exact playlist.

Does FFmpeg keep a YouTube stream live if the connection drops?

No. FFmpeg can send the encoded feed, but it cannot guarantee uninterrupted streaming. Monitor Studio and the encoder, and decide how you will reconnect or restart if the process, computer or network fails.

What if YouTube does not show an incoming signal?

Check that the channel is enabled for live streaming, the correct stream URL and key are being used, and the output protocol and encoding settings match current YouTube guidance. Keep the key private; reset it in Studio if it has been exposed.

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 ↗