Skip to content
streamneo.
Setup Guides12 min read

How to Loop a Folder of Videos to YouTube Live with FFmpeg

Build an ordered FFmpeg concat playlist, repeat it to YouTube Live, and check compatibility, ingest credentials and stream health.

sn.
StreamNeoPublished 4 October 2026
Worth sharing?

A folder of videos will not automatically play as a playlist in FFmpeg. To send a deliberate sequence to YouTube Live and repeat it, list the files in a concat manifest, make sure their streams are compatible, then configure FFmpeg to loop that combined input and encode it for YouTube’s ingest endpoint.

The exact command depends on your operating system, paths, FFmpeg build and media formats. The examples below show the workflow, not a command tested against a live account; check your installed FFmpeg’s options and test privately before relying on it overnight.

Prepare and order the video files

Start by deciding the sequence yourself. A directory listing is not a dependable playlist: file managers and shells may sort names differently, and a newly added file can change the order. Write down the intended order, then give files clear names such as 01-opening.mp4, 02-prayer.mp4 and 03-reading.mp4. The numbers are a convenience for you, not a substitute for a manifest.

Play each source from beginning to end, or at least inspect it closely enough to catch a damaged file, unexpected silence, an opening slate you meant to remove, or a final frame that should not be part of the loop. Check that audio is present where expected and that transitions make sense. For devotional, study or ambience channels, listen to the joins as well as the body of each clip: a sudden jump in loudness or a brief silence can be more noticeable after repetition.

Keep the source files and manifest together in a folder whose location will not change while the stream is running. Avoid renaming or moving files after the manifest is made. If you work across Windows and Linux, note that path separators, drive letters and quoting rules differ; do not paste a path from one system into another and assume it will work.

If you are choosing between an FFmpeg workflow and a graphical encoder, the OBS workflow for looping Punjabi music videos gives a different approach. The principle is the same: define the sequence deliberately and verify the transitions rather than trusting a folder to behave like a playlist.

Create a concat manifest

The concat demuxer reads a text file that names the media files in sequence. Create a plain-text manifest, for example playlist.ffconcat, with one file entry per video. A simple illustration is:

ffconcat version 1.0
file '01-opening.mp4'
file '02-prayer.mp4'
file '03-reading.mp4'

The header is optional, but if you use it for automatic format recognition it must be the first line exactly, with no leading whitespace or byte-order mark. The paths shown here are relative to the manifest’s location. Relative paths can make a project easier to move as a unit, provided FFmpeg is launched with the expected working directory or given the manifest’s full path.

Paths containing spaces or special characters need the quoting and escaping rules supported by the concat script format. Do not assume that shell quoting rules and manifest quoting rules are interchangeable. For example, a name such as Evening prayer.mp4 needs to be represented in a way the manifest parser accepts; test it locally with your FFmpeg build before treating the list as complete.

By default, the concat demuxer’s safe option rejects certain paths it considers unsafe, including absolute paths and names outside its portable-character rules. That default is useful when a manifest might come from an untrusted source. For a manifest you created and trust, you may need to review the option if your paths are rejected, but changing it is a conscious security trade-off, not a general fix. Never disable path safety merely to make an unknown manifest run.

FFmpeg’s concat demuxer documentation describes the script format, path handling and compatibility requirements. Keep the manifest small and auditable: one entry per clip, in the order you want viewers to see them. A human-readable list is also easier to check when a track is updated than a command that hides the order in a long sequence of arguments.

Check compatibility before joining clips

The concat demuxer is most useful when the source files are already compatible. FFmpeg requires the files to have the same streams, including codecs and time bases. In practice, differences in video dimensions, frame rates, audio layout or codec parameters may prevent a clean transition or cause playback issues. Files that all end in .mp4 are not necessarily equivalent internally.

Duration metadata matters as well. The demuxer adjusts timestamps from one file to the next using the duration it reads for each source. If a duration is inaccurate, the next section can start at an unexpected timestamp; unequal audio and video stream lengths can also make gaps or artefacts at joins. A playlist that appears to work in a short preview should still be checked across several transitions.

When the sources do not match, there are two broad choices. You can normalise them first into a common set of video and audio properties and then use the concat demuxer, or use FFmpeg’s concat filter and re-encode as part of joining. The demuxer can avoid re-encoding compatible media, which saves processing and avoids another generation of encoding loss. The filter route is more flexible for mismatched sources but asks the machine to decode, process and encode the result continuously, so check that its CPU and upload connection can sustain the chosen output.

FFmpeg’s concat FAQ explains the distinction between the demuxer and filter approaches. Do not copy a command that assumes every clip is already normalised. Inspect stream details with a tool such as ffprobe, or use another media inspector you understand, then make the conversion plan before connecting to YouTube.

For channels where constant frame rate is part of that plan, the guide to setting a constant frame rate for an FFmpeg loop stream covers that separate decision. It is not a reason to force every source to the same settings blindly: retain a practical output format for your material and test the resulting file or stream.

Set YouTube’s ingest URL and stream key

In YouTube Live Control Room, create or select the live stream and retrieve its current server URL and stream key. Enter those values in the encoder’s output settings. The key is a credential that lets an encoder send video to your channel; treat it like a password. Do not put it in a public script repository, a screenshot, a forum post or a log you share for troubleshooting. If it is exposed, use YouTube’s controls to replace it and update the encoder.

YouTube recommends RTMPS, which protects the feed in transit. Get the RTMPS address from the current Live Control Room controls rather than assuming that a visible ordinary RTMP address is the secure endpoint. Confirm that your FFmpeg build supports the required protocol and TLS connection. If a connection fails, compare the protocol, server address and any port information against the actual URL YouTube shows; do not guess a replacement from an old command found online.

The YouTube Help guide to managing live stream settings explains stream keys and stream settings, while its encoder streaming guide covers the encoder workflow. The precise controls may depend on whether the stream is scheduled and on its auto-start or auto-stop settings. A scheduled event may show a preview that still requires you to confirm Go live.

Configure playlist looping and output encoding

The arrangement matters: FFmpeg should read the manifest as a single concat input, then repeat that combined input. If you put a looping option in the wrong place, it may apply to a different input or output, or fail because the installed build does not recognise it. FFmpeg generally applies most options to the next input or output, so option order is meaningful.

A schematic command shape is shown below. It is deliberately not a ready-to-run command: the loop option spelling and support, manifest path, stream URL, key handling and encoding parameters must be verified for your build and operating system. Do not publish a real key in a copied command.

ffmpeg [input options, including playlist loop if supported] -f concat -safe 1 -i playlist.ffconcat [video/audio encoding options] -f flv [RTMPS URL with protected key]

Check the installed version’s help and the FFmpeg command-line documentation for option placement and supported syntax. In particular, establish that the loop applies to the concat input as a whole, not just one source clip. If your build’s input looping behaviour is unclear, test a short playlist locally and observe that it reaches the next manifest entry before repeating the first.

Choose encoding settings to fit the source and available upload capacity rather than copying a universal recipe. YouTube’s current guidance accepts RTMP(S) ingestion with H.264, H.265 or AV1, lists frame rates up to 60 fps, recommends constant bitrate, and recommends a two-second keyframe interval with a maximum of four seconds. Its bitrate guidance varies with codec, resolution and frame rate. For context, the current H.264 guidance lists 10 Mbps for 1080p at 30 fps and 12 Mbps for 1080p at 60 fps; these are YouTube recommendations, not guarantees that your connection can sustain them.

YouTube recommends upload capacity with 20% headroom above the stream bitrate. Other people and devices sharing a connection can reduce what is available to the encoder. A 720p stream that remains stable is usually more useful than a higher-resolution feed that repeatedly buffers, particularly on a shared broadband connection. The bitrate guidance for a 720p devotional stream on a 5 Mbps connection is relevant when you are weighing that trade-off, but always check YouTube’s current live encoder settings rather than treating old figures as permanent.

Start a test and inspect Live Control Room

Before a public broadcast, run a private or unlisted test using the actual playlist, output settings and network you plan to use. Include representative motion and audio: a static title card will not reveal every encoding or sound issue. Watch the transitions, check that sound is neither missing nor clipped, and let the sequence reach its repeat point if you can do so without risking the public channel.

Once the encoder connects, open Live Control Room and confirm that YouTube sees the feed and reports a healthy status. Check the preview for the right programme and listen to the actual output. A successful FFmpeg connection only confirms that the encoder has connected; it does not tell you that the correct playlist is playing, that the sound is usable, or that viewers can see the intended live event.

During a live run, keep an eye on both picture and sound and read the warnings in Control Room. If YouTube reports unstable ingest, reduce the load or address the network before assuming the manifest is at fault. When ending, stop the encoder feed and follow the Live Control Room controls appropriate to the stream’s configuration. YouTube says streams shorter than 12 hours are automatically archived, but check current guidance for your event and do not rely on an archive as the only copy of source material.

For a 24/7 channel, the computer running FFmpeg is part of the broadcast path: if it sleeps, loses network or reboots for updates, the feed can stop. If the specific pain is keeping a local computer on and restarting a dropped feed, StreamNeo removes that particular burden by turning an uploaded video into a YouTube-only stream that runs with your computer switched off. It does not change the need to prepare suitable content, protect credentials or confirm YouTube’s stream status.

Troubleshoot paths, formats and disconnects

If FFmpeg says it cannot open a file, check the manifest spelling, path relative to the process’s working directory, case sensitivity and permissions. Try a simple filename and a manifest beside the source files to isolate path issues. If the path is absolute or outside the default safe rules, understand why before changing safe; a trusted local file list and an unknown downloaded manifest are different cases.

If the playlist opens but stops at a transition, inspect the streams and durations of the files on either side. A codec or time-base mismatch points towards normalisation or the concat filter and re-encoding rather than more quoting changes. If the transition works but audio drifts or a gap appears later, check the source durations and stream lengths, then test the whole sequence rather than only its first few seconds.

If YouTube does not receive a feed, verify that the current key and server URL were copied from the correct stream, that the selected protocol is RTMPS where supported, and that your network permits the connection. A key can be revoked or replaced, so an old saved value may no longer work. Never paste the key into a public support request while investigating.

If the feed connects and then drops, distinguish a local FFmpeg exit from a network or ingest interruption. Keep the terminal output private while looking for the failure, since commands and logs can reveal credentials. Check whether the computer slept, the network changed, a router reset, or the encoder could not sustain the selected bitrate. A restart can restore a feed, but it does not fix recurring upload instability or incompatible media.

If you prefer not to maintain a local FFmpeg process, compare workflows honestly: a cloud-based approach avoids depending on your home or shop computer being awake, while a local process gives you direct control and may suit a technically comfortable operator. The article on avoiding black screens between videos in a YouTube playlist stream can help you think about transitions as a viewer-facing issue, not just whether the command stays running.

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 FFmpeg loop a folder of videos directly?

No. A folder is not automatically a playlist in FFmpeg. Put the files in the intended order in a concat manifest, then configure FFmpeg to read and repeat that combined input.

Does the concat demuxer work with any videos?

No. Its files need matching streams, including codecs and time bases, and duration errors can affect timestamps at joins. Inspect the files first; normalise them or use the concat filter with re-encoding when their formats differ.

Is the command above ready to paste into a terminal?

No. It illustrates where the manifest input and encoded output fit, but option syntax and support depend on your operating system, paths and FFmpeg build. Verify the relevant options locally and test a private or unlisted stream before a public broadcast.

Should I use RTMP or RTMPS?

Use the RTMPS URL shown in Live Control Room when your encoder supports it. Copy the current URL and key for the selected stream, keep the key private, and follow YouTube’s current connection guidance if the feed does not connect.

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 ↗