If FFmpeg keeps returning to the first clip in a YouTube rotation, first check whether it is looping one input or whether the process is being restarted. A common configuration mistake is placing -stream_loop -1 before an individual clip’s -i instead of before the concat playlist’s -i.
-stream_loop applies to the next input; it does not independently mean “repeat this playlist”. The distinction matters: if the next input is one clip, that clip can repeat, while a concat-list input presents a sequence of files. This is a likely diagnostic branch, not a confirmed cause. Without your command, list and logs, it is not possible to identify the cause with certainty.
First identify what is repeating
Watch or inspect the output long enough to establish what comes after the first clip. Does the same clip begin again while FFmpeg remains running, or does the FFmpeg process exit and then start again? Those are different failure modes, even if both look like the stream has returned to the beginning.
An input loop means FFmpeg is still processing an input configured to repeat. A process relaunch means something outside that input sequence may have started a new FFmpeg process: for example, a service supervisor, script, container policy or scheduler. Do not assume a restart policy is involved just because the first clip appears again. Check the process state or logs around the transition.
Also establish whether the rotation ever reaches its later entries. If it repeats the first clip immediately and predictably, inspect option scope and input order first. If it reaches later clips but stalls, glitches or fails at a join, investigate the playlist paths, stream compatibility and duration information as well. The visible symptom narrows the checks but does not prove a single cause.
For a channel built from a fixed sequence of recordings, this is a command and playlist problem to diagnose before changing hardware or moving the broadcast elsewhere. If you are planning a longer-running channel, how to run a 24/7 YouTube stream of Tamil songs from a cloud server discusses the broader operating setup; it does not replace checking the FFmpeg input sequence that is actually running.
Which input receives -stream_loop
FFmpeg command lines contain options that apply broadly and options that are associated with a particular input or output. The FFmpeg documentation describes -stream_loop as an input option: it configures the next input file specified. Its value -1 means to loop indefinitely. Read the FFmpeg command-line documentation for the option behaviour and current details.
That “next input” rule is the key to this symptom. Consider a command that first has -stream_loop -1 and then -i first.mp4. In that position, the loop setting belongs to first.mp4, not to a concat list that appears later in the command. FFmpeg can therefore keep returning to that single clip rather than advancing through the intended rotation.
A concat demuxer input is different. It reads a text script containing file entries and presents those files one after another as a single input sequence. If the intended rotation is represented by playlist.txt, it is that list file—not one of its individual entries—that needs to be the input following the loop option when you want to loop the sequence.
This explanation is about option scope, not a guarantee that every “first clip again” report has this cause. A malformed or incomplete list, a separately restarted process, or another command construction issue can produce a similar appearance. Confirm the actual command and the process behaviour before changing it.
Inspect the option’s position in the command
Read the full command from left to right and mark each -i. For every -stream_loop, identify the next -i that follows it. Then write down what that input represents: a standalone video, an audio file, or the concat list. Do not infer the scope from the order of filenames inside the list; the command option is scoped by the command-line input order.
For example, if the command contains a standalone clip input before the playlist input, and the loop option sits before that standalone input, the clip is the next input and receives the setting. Moving the playlist’s -i later in the command does not retroactively move the option’s scope. The order of options and inputs is part of the configuration, not merely a formatting choice.
If your command is assembled by a script, inspect the final command the script launches as well as its template. Variables, conditional branches or an older saved command can make the running invocation differ from the line you expected. Copying the relevant command line into a note and annotating each input is often enough to make the mismatch visible.
Keep input options near the input they are meant to affect. This makes a long command easier to review and reduces the chance that a later edit inserts another -i between an option and its intended file. For a concise walkthrough of adapting media before a playlist broadcast, see converting MPEG-2 files to H.264 for a YouTube playlist stream. Conversion and input-loop scope are separate issues, but both depend on knowing which files and streams the command is processing.
Put the loop option before the concat input
A typical command shape for looping a concat list is:
ffmpeg -re -stream_loop -1 -f concat -safe 0 -i playlist.txt ... OUTPUT
This is a shape to adapt, not a universally tested command. In it, the loop option appears before the concat input, so the next input is the list file. The ellipsis and OUTPUT are placeholders, not literal settings; use the appropriate output options and destination for your setup. The example also includes -safe 0, which should not be copied automatically.
The concat demuxer is selected here with -f concat, and playlist.txt is its input script. Keep the loop option attached to that input rather than placing it before a separate clip’s -i. If your command has more than one input, check the position of every input option and ensure the intended input follows it.
The order of -re and other options in the example should not distract from the central point: the loop setting must govern the concat-list input if the goal is to repeat the list. The full command still needs suitable input and output settings for your media and broadcast destination. The example does not establish that your files are compatible, that your paths resolve, or that a live output will run correctly on your machine.
Once the command is changed, make one controlled test before relying on it overnight. Use a short list with recognisable clips and observe whether FFmpeg advances beyond the first entry and eventually returns to the beginning. Keep a copy of the previous command so that you can revert if the output behaves differently than expected.
Verify the concat list and its file order
The concat demuxer reads a text script with file entries and other directives, presenting the files sequentially as one input. FFmpeg adjusts timestamps so each subsequent file starts after the preceding one. The concat demuxer section of the FFmpeg formats documentation explains the script format, path rules and stream requirements.
Open the exact list file that the running command names. Confirm that it contains every intended entry, that the file lines appear in the intended order, and that each path points to the expected clip. A list that contains only the first file, or that is generated incorrectly, will not produce the rotation you planned, regardless of loop-option placement.
Paths are interpreted in the context of the process and its working directory unless you use paths that resolve independently of that context. Check them from the environment where FFmpeg actually runs, not only from a desktop file browser. A command launched by a service or scheduled task can have a different working directory from an interactive terminal, so a relative path that works in one place may fail in another.
The concat demuxer’s safe-path check is enabled by default. -safe 0 permits filenames and directives that the default check would reject, but it also broadens what the list can refer to. Use it only when the paths genuinely require it and you trust the list’s contents. If the list is generated from user-controlled or otherwise untrusted data, do not disable a safety check without understanding the consequences.
If automation creates or updates the playlist, inspect that generator and the resulting file at the time of the problem. A process might replace or truncate the list, but the symptom alone does not show that this is happening. Compare the generated list before and after a repeat, and check whether its entries remain complete and in order.
Check media compatibility and output settings
The concat demuxer is useful when the files can be joined as a sequence without re-encoding, but its inputs need matching stream structures, including codecs and time bases. Differences in stream layout or incorrect duration information can cause problems at transitions. A playlist can therefore have the right order and still produce glitches or stalls when it reaches a particular join.
If the clips are not compatible in the way the demuxer expects, do not treat -stream_loop as the fix. Inspect their streams and durations, then decide whether to normalise the files or use a different concat approach. FFmpeg’s FAQ on concatenation distinguishes the concat demuxer from the concat filter and discusses when re-encoding is needed. The filter may be more appropriate when the inputs need processing to join reliably, but that changes the workflow and encoding requirements.
Output choices also depend on the actual files and destination. Video dimensions, frame rate, audio layout and encoding settings should be selected for the material and YouTube workflow you are using; there is no single output line to append safely to every command. If you are changing files before streaming, setting the aspect ratio for recorded regional videos on YouTube Live is relevant to presentation, though it addresses a different part of the setup.
Make one change at a time. First establish that the intended input is the concat list. Then verify that the list advances through the entries. Only after that should you investigate output encoding or normalisation if the sequence fails at a join. This order helps separate a loop-scope mistake from a media-compatibility problem.
Test the rotation and inspect logs
A practical test needs recognisable inputs and a way to distinguish the clips in the output. Use a small temporary playlist whose entries have different visible content or audio, then observe whether the process advances, returns to the beginning, or exits. Do not begin by testing only a long, indistinguishable ambience file: it can be difficult to tell whether the sequence moved forward.
Watch the FFmpeg process as well as the stream. If FFmpeg remains active while the first input repeats, revisit option scope and the list being opened. If the process exits, record the final log lines and determine what starts a replacement process. A service supervisor can restart a failed command, but changing its restart behaviour will not correct an input option attached to the wrong file.
Logs can show which input was opened, whether a path failed, and where a decode or muxing error occurred. Keep the complete command, the relevant playlist contents and the log around the transition together; a short error excerpt without the command may omit the detail needed to identify the responsible input. If the playlist is produced by a script, note the generated file as well as the script version.
For an unattended channel, test the exact launch method you intend to use, not only a command copied into an interactive terminal. The process environment, working directory and restart policy can differ. If your goal is to keep a recording playing while you are not at the computer, streaming a looping Hindi Yoga Nidra recording without a phone offers related setup context; it does not establish that a particular FFmpeg command will suit your files.
StreamNeo can remove the need to keep your own computer running when the specific pain is operating a prepared video as a continuous YouTube broadcast, but it does not diagnose or repair an FFmpeg playlist command. If you stay with FFmpeg, the useful next step is to retain a tested command, playlist and launch procedure together so you can tell what changed when the rotation fails.
When the file and channel are ready, compare the operating options before choosing how to run the broadcast.
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 a concat playlist?
It loops the next input specified in the command; it does not automatically mean “loop the playlist”. If the next input is the concat list, the list is the input being looped. If the next input is a single clip, that clip can repeat instead.
Why does FFmpeg return to the first clip before playing the rest?
One possible cause is that -stream_loop -1 appears before the first clip’s -i, so the clip rather than the concat list receives the option. Check the full command and the input that follows the option, then verify that the list itself contains all entries in the expected order.
What if FFmpeg exits and then starts again?
That is different from FFmpeg staying alive while an input loops. Check the final log lines and identify whether a service, script, scheduler or other launch mechanism starts a new process. The title alone cannot show whether this is happening.
When should I use the concat filter instead?
The concat demuxer expects inputs with matching stream structures and can be affected by incorrect duration information. If your files need re-encoding or have incompatible streams, review FFmpeg’s concat guidance and consider whether the concat filter fits your workflow. Test with representative files before relying on the result for a continuous broadcast.