Skip to content
streamneo.
Troubleshooting13 min read

Fix FFmpeg Concat Errors When Looping Recorded Lessons for YouTube Live

Diagnose FFmpeg concat failures in stages: playlist syntax, paths, stream compatibility, duration, looping and YouTube Live output.

sn.
StreamNeoPublished 4 October 2026
Worth sharing?

When FFmpeg fails while joining recorded lessons for YouTube Live, first identify whether it cannot parse the playlist, open a file, join the streams, or send a valid output. Those are different failures, and changing YouTube settings will not repair a malformed playlist or incompatible lesson files.

For compatible files, the concat demuxer can join packet streams without re-encoding; put -stream_loop -1 before the playlist input to repeat that input. If the files differ in stream layout, codec or time base, normalise them or decode, join and re-encode with the concat filter instead. Neither approach guarantees seamless boundaries or indefinite playback without monitoring.

Identify the failure stage before changing the command

Start with the exact command, the complete error text, and the point at which it appears. FFmpeg processes inputs and output in stages. A message about an unknown directive or unsafe file name points towards playlist interpretation; “No such file or directory” usually points towards a path or permissions problem. Errors about stream parameters, timestamps or muxing tend to appear later, after files have been opened.

Run a short diagnostic with the same playlist but without the live destination. For example, try writing a small test output to a local file, or ask FFmpeg to report input information. If it fails before identifying the first file’s streams, focus on the playlist header, syntax and paths. If it reads the files but fails when switching between lessons, investigate compatibility, durations and timestamps. If a local output works but YouTube does not accept the broadcast, then check the encoder output and ingest path independently.

Keep a copy of the failing command, but redact the stream key before sharing logs or asking for help. Note the FFmpeg version, operating system, whether paths are relative or absolute, and whether the error occurs on a specific lesson boundary. A useful diagnostic report says, for example, “the list parses and both files open, but the output reports a timestamp warning at the change to lesson two”. That is more actionable than “concat does not work”.

The same separation helps if you are building an ongoing channel rather than testing one command. A playlist workflow and its operating environment are distinct concerns, as discussed in this guide to automating a YouTube Live playlist with a VPS in India. Fix the media sequence first; decide where and how to run it only after the sequence behaves as expected.

Write the concat-demuxer playlist as a script

A concat playlist is a text manifest, not a video file. A minimal version looks like this:

ffconcat version 1.0
file 'lesson-01.mp4'
file 'lesson-02.mp4'

The automatic-detection header must be the exact text ffconcat version 1.0 on the first line, with no leading spaces or byte-order mark. A word processor can add invisible characters or formatting, so use a plain-text editor. Each file directive names one input in playback order. Check spelling, quotation marks and line breaks if FFmpeg reports an unknown directive or fails to interpret the list.

You can explicitly select the concat demuxer when supplying the manifest:

ffmpeg -f concat -safe 0 -i lessons.ffconcat -c copy test-output.mkv

This is a diagnostic shape, not a command that will work for every set of files. The -safe 0 option relaxes checks on playlist paths and is often needed for absolute paths or paths outside the safe subset. Use it only with a playlist you trust. It does not fix misspelled paths, malformed lines or incompatible media. If all files sit beside the manifest and use simple relative names, try the safe default first.

You can also use an .ffconcat filename with the exact header to allow automatic format detection. Explicit -f concat makes the intended input format clear and is useful when the file has another extension, such as .txt. The official FFmpeg concat demuxer documentation explains the manifest directives and the requirement for compatible streams. If a test works after correcting the header, keep the fix in the manifest rather than adding unrelated output flags.

Check paths and whether the process can read them

A path that works in your file manager may fail in FFmpeg because the process starts in a different working directory. Relative entries are resolved from the process context, so record the directory from which you launch FFmpeg. As a test, use a known local file and an uncomplicated filename, then add the other lesson entries back one at a time.

Paths containing spaces or special characters need correct escaping or quoting according to the concat script syntax. Do not assume that shell quoting rules automatically apply inside the manifest: the shell handles the command line, while the concat demuxer parses the playlist contents. Follow the FFmpeg script syntax documentation when creating entries with unusual characters. If a path is especially awkward, copying the file to a simple working directory and using a plain filename can isolate the cause.

Check that the account running FFmpeg has permission to read every listed file and the manifest itself. On a Windows system, confirm drive letters and backslash handling; on Linux, check case-sensitive spelling as well as directory permissions. If the files are on a removable or network-mounted location, confirm that the location is available to the process at launch and remains available during playback. A playlist can be syntactically correct but still refer to a file the process cannot open.

Add entries gradually: first one file, then two, then the full list. This helps identify a single bad path without confusing it with a failure at a later stream boundary. If you maintain a changing lesson archive, document the manifest format and file naming in the workflow. The operating choices in VPS versus a spare computer for a YouTube loop stream in India matter to availability and access, but do not change FFmpeg’s parsing rules.

Verify codecs, stream layout and time bases

The concat demuxer joins packet streams; it does not decode each lesson and make their formats agree. FFmpeg’s documentation states that all files must have the same streams, codecs and time bases. Compare every input rather than checking only the extension or video codec. Two MP4 files may differ in audio presence, channel layout, frame rate, dimensions, pixel format, stream order or timing properties.

Use ffprobe to inspect each lesson. Compare the number and order of streams, codec names, video dimensions, pixel format, reported frame rate, audio sample rate and channel layout, stream time base, start time and duration. Pay particular attention to a lesson that was exported from a different editing preset or contains no audio track. A silent video may have no audio stream at all, while another has AAC audio; matching video codecs does not make those input layouts identical.

For compatible inputs, -c copy avoids decoding and re-encoding, so it is often the lower-compute choice and preserves the encoded packets. It is appropriate only when the input streams and the chosen output container can carry those packets and the resulting timestamps behave correctly. Copying does not repair incompatible streams, and a boundary can still expose timestamp or parameter problems. If the failure appears only when switching lessons, check the boundary rather than treating the loop option as the cause.

A useful comparison is:

Approach Inputs it suits Main trade-off Boundary checks
Concat demuxer with stream copy Same stream layout, codecs and time bases Avoids re-encoding, but cannot reconcile differences Verify timestamps, durations and muxer acceptance
Normalised intermediate files Lessons that can be converted to consistent streams Adds a preparation step and encoding work Test the normalised sequence at each change
Concat filter with re-encoding Inputs that need decoding and joining despite differences More processing and explicit mapping/settings Check output timing, audio continuity and transitions

If inputs are heterogeneous, make a deliberate choice between preparing normalised files and building a filter graph. The FFmpeg concat filter documentation describes joining decoded streams; it requires appropriate inputs and output mapping. The concat protocol is different again: it joins resources at the file or container level and is limited to compatible formats. It is not a general substitute for either the demuxer or the filter.

Put -stream_loop before the playlist input

-stream_loop -1 is an input option: it tells FFmpeg to loop the input indefinitely. Place it before the -i that reads the playlist. The same placement rule applies when the playlist is treated as one input rather than listing individual lesson files on the command line. See the FFmpeg command-line documentation for -stream_loop for the option’s scope.

A representative command shape for a re-encoded live output is:

ffmpeg -re -stream_loop -1 -f concat -safe 0 -i lessons.ffconcat \
  -c:v libx264 -pix_fmt yuv420p -c:a aac \
  -f flv "$INGEST_URL/$STREAM_KEY"

Treat this as a starting shape, not a universal prescription. The output mapping, frame rate, bitrate, keyframe interval, audio settings and destination depend on the source and the YouTube stream configuration you select. Keep the stream key private; do not paste it into a public command, screenshot or unredacted log. Confirm the current stream URL and key in YouTube Live Control Room.

-re is commonly used with file inputs to pace reading in real time for a streaming workflow. It does not fix stream incompatibility, bad duration metadata or timestamps, and it is not a substitute for the correct output settings. Likewise, putting -stream_loop after the playlist input can mean it no longer applies to that input as intended. Check option placement before testing more complex changes.

Before relying on a continuous run, test a finite session that crosses every lesson boundary, including the transition from the last item back to the first. Listen for cut-off audio and inspect whether video freezes or timestamps jump. A loop repeats the input sequence; it does not smooth hard cuts or fill gaps already present in the recordings. Test long enough to observe the actual transitions, then monitor the live output when you move to YouTube.

Normalise mismatched lessons or use the concat filter

When ffprobe shows that files do not have matching stream layouts, codecs or time bases, do not expect stream copy to reconcile them. One route is to transcode each lesson to a common set of properties before using the concat demuxer. Choose consistent video dimensions, frame rate, pixel format, codec and audio layout; check that every output file really contains the expected streams. This creates an extra preparation stage, but the resulting list is easier to inspect and repeat.

The other route is the concat filter, which works on decoded streams and then encodes the joined result. It is suited to inputs that need conversion or explicit stream handling, but you must account for the streams you map and the settings of the encoded output. For example, decide what to do when one lesson has no audio: supply silence, omit audio consistently, or prepare an audio track. The correct choice depends on what the channel needs, not on a single command that can infer your intended programme.

Re-encoding uses more processing and can change quality; stream copy uses less processing but only works when the packet streams are suitable. If a long filter graph is difficult to maintain, normalising files in a separate preparation step may make faults easier to isolate. If you add or replace lessons frequently, keep a repeatable export preset and inspect new files before putting them into the live manifest.

Test the prepared sequence as a local output before sending it to YouTube. Review the lesson boundaries for audio duration differences, black frames, abrupt volume changes and timestamp warnings. If only one file causes a failure, replace or re-export that lesson and test again. A successful parse is not proof that the content has clean transitions.

Check duration metadata and timestamp continuity

The concat demuxer uses the duration of one file to place the next file’s timestamps. If a duration is wrong or missing, later content can be shifted, causing gaps, overlap or other boundary artefacts even though every file opened successfully. Truncated recordings and files whose container metadata does not reflect their actual playback length deserve particular attention.

Compare the reported duration with playback and with the stream-level start and end information from ffprobe. If the demuxer’s timing is wrong for a particular entry, the playlist syntax supports a per-file duration directive to override a wrong or missing duration. Use it only after verifying the intended duration; an inaccurate override moves the problem rather than solving it. Retest the boundary immediately after the affected entry, and the loop back to the first file.

Audio and video streams can have different durations or start times within one lesson. A sequence that appears visually continuous may still have a short audio gap, or the reverse. Inspect the transition in both picture and sound, and check FFmpeg’s warnings rather than suppressing them before you understand what they say. Re-encoding a test sequence can help determine whether a boundary issue comes from packet timing or from the source content itself.

Do not treat every timestamp warning as proof that YouTube rejected the stream. First confirm whether the local output has the same symptom. If it does, the issue is in the input sequence or FFmpeg’s treatment of it; if it does not, move on to output configuration and ingest checks.

Check output settings and YouTube ingest health

Only after the playlist parses, the files open and the media sequence behaves locally should you treat the YouTube output as a separate diagnostic stage. YouTube’s live encoder settings guidance lists RTMP/RTMPS as supported protocol choices, recommends constant bitrate, and gives codec and keyframe guidance. The page lists H.264, H.265 and AV1 video options, AAC or MP3 audio, a recommended two-second keyframe interval and a four-second maximum. Check the current official page for the stream type you are setting up; platform guidance may change.

For H.264, that guidance lists a recommended bitrate of 10 Mbps for 1080p30 and 14 Mbps for 1080p60. These are YouTube recommendations for those output formats, not universal values for every source or connection. Pick settings that match your selected resolution and frame rate, and make sure the available upload connection can sustain the outgoing stream. Avoid copying a bitrate from a command without checking what it applies to.

Test with movement and audio representative of the lessons, then watch YouTube’s stream health indicators during the test. Confirm that the selected stream key and ingest URL belong to the intended broadcast. A local file that plays correctly but an unstable YouTube preview calls for checking the output encoder, connection and ingest status; a failed local boundary still calls for fixing the source sequence first. This distinction prevents troubleshooting the wrong stage.

If your main concern is keeping a prepared file-based channel running while your own computer is off, StreamNeo removes the recurring task of starting and watching the encoder on that computer: you upload the video, supply the YouTube stream key, and the broadcast is monitored and restarted if it drops. It does not change how the lesson files should be prepared, and you still need to confirm that your channel and stream are configured appropriately. For a different workflow using scenes and local software, see the practical notes on keeping a 24/7 YouTube stream playing during OBS scene changes.

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

Why does FFmpeg say it cannot open a file in the playlist?

Check the spelling, quoting, working directory and permissions for that specific entry. Relative paths depend on where FFmpeg is launched; absolute paths may require -safe 0, which relaxes safety checks but does not correct a malformed manifest. Test with a simple local filename to isolate path handling.

Can I use -c copy for every set of lessons?

No. Stream copy avoids re-encoding, but the concat demuxer requires compatible streams, codecs and time bases, and the output container must accept the packets. When those properties differ, normalise the files or join decoded inputs with the concat filter and re-encode.

Does -stream_loop -1 fix a concat error?

It only requests indefinite looping for the input before which it appears. It does not fix playlist syntax, unreadable paths, mismatched media or duration and timestamp problems. Put it before the playlist’s -i, then test the full sequence and its return to the first lesson.

When should I investigate YouTube instead of the files?

Investigate ingest after FFmpeg reads and processes the playlist correctly, especially if a local output passes but YouTube’s preview or stream health does not. Check the current official encoder settings, selected stream key, output codec and connection. If the local test already fails at a lesson boundary, fix that sequence before changing YouTube settings.

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 Troubleshooting guides ↗ · All topics ↗