An FFmpeg concat file is a text playlist that lets the concat demuxer present a sequence of media files as one virtual input. It does not make incompatible files match, encode a YouTube-ready livestream, or grant you permission to broadcast the music.
For a continuous channel, treat the job as separate steps: check and prepare the inputs, write the sequence, decide how the sequence repeats, encode and send the live output, then confirm YouTube receives it and that you have the necessary music rights. Keeping those layers separate makes a failure easier to locate.
What the concat demuxer does
The concat demuxer reads a text script containing file paths and presents those files in order as though they were one input. FFmpeg adjusts timestamps so the next file follows the preceding one. The files themselves are not joined into a new file by this step, and the demuxer does not re-encode their audio or video.
That distinction matters for a 24/7 broadcast. The list answers “which file comes next?” It does not answer “can these streams be joined cleanly?”, “what should the live encoder output?”, or “how does the broadcast continue indefinitely?” Each question belongs to a different part of the workflow.
The concat demuxer works best when the inputs already meet its compatibility requirements. FFmpeg’s concat demuxer documentation says: “All files must have the same streams (same codecs, same time base, etc.).” A matching filename extension is not enough to establish that. Two MP4 files, for example, may have different video codecs, audio layouts, frame rates or time bases.
A text list is useful if you already have a consistent set of files and want to sequence them without converting each one. If conversion is needed to make the material consistent, use a workflow that does that conversion deliberately rather than expecting the playlist to fix it.
Check the inputs before sequencing
Inspect the streams inside each file before building the list. For every track, note whether it contains audio, video or both; the codecs; the audio channel layout and sample rate; and the video dimensions, frame rate and time base. FFmpeg’s ffprobe can report stream details, but you still need to compare the results and choose a consistent target where conversion is necessary.
The demuxer’s compatibility condition concerns streams, not just the order of names in the file. A playlist of audio-only files and a playlist of video-plus-audio files are different cases. Within a set of video files, a change in time base or stream layout can matter even when every file plays normally on its own. Check the actual metadata rather than assuming that a shared format label means they are interchangeable.
Duration deserves particular attention. The demuxer uses file durations when calculating where later files begin. If duration metadata is inaccurate, or if audio and video streams within an input end at different times, a transition can have a gap, overlap or timestamp artefact. The concat demuxer supports a duration directive to supply a duration where appropriate, but that is not a substitute for inspecting a file whose reported timing is wrong.
For a music channel, decide what the viewer should experience at the boundary. If one song’s video runs longer than its audio, for instance, the next item’s start depends on the file’s stream timing and the demuxer’s duration calculation. Check a sample sequence from beginning to end before planning around a long unattended run.
If the files are not compatible, make compatible versions first or choose the concat filter workflow when you need conversion during joining. FFmpeg’s concat FAQ describes the filter approach for files that need re-encoding. It takes more processing and requires you to define the output format, but that is the right layer to address stream differences. The demuxer is not a compatibility fixer.
Write the concat list
Create a plain-text file with one entry for each file, in the order you want them played. A basic example looks like this:
ffconcat version 1.0
file 'track-01.mp4'
file 'track-02.mp4'
file 'track-03.mp4'
The first line is a format marker. For FFmpeg to recognise the format automatically, it must be exactly ffconcat version 1.0 at the very start of the file: no blank line, leading whitespace or byte-order mark before it. If FFmpeg does not recognise the list, inspect the first bytes and line before changing codecs or output settings.
Paths are resolved in the context in which FFmpeg is run. Relative paths are convenient when the list and media files sit together, but they still need to resolve from FFmpeg’s working directory. If the files live elsewhere, use paths that are valid from the process that will run FFmpeg.
The list format uses quoting and escaping rules. The example’s single quotes accommodate ordinary names, but paths containing quotes or other special characters need care. Shell quoting is a separate issue from quoting inside the concat file, and the details vary by operating system and shell. Test the actual path with your own environment; do not assume a quoting trick is universal.
Keep the list simple while testing. Use a few files first, confirm the order and transitions, then expand it. A single typo or path that resolves on your desktop but not in the intended run context can stop processing before YouTube is involved. If you need to adjust how an item’s duration is read, use the documented duration directive only after checking the media’s timing.
Run FFmpeg with the concat input
A typical demuxer invocation begins by specifying the concat input format and the list file, for example -f concat -safe 0 -i playlist.ffconcat. The -f concat option tells FFmpeg which demuxer to use. -i identifies the list. The -safe setting affects which file paths the demuxer accepts; do not disable its safety checks reflexively. Review FFmpeg’s documentation and use paths appropriate to your environment.
The demuxer sequences a finite list once. Repeating it for an always-on channel is a separate decision. FFmpeg has input looping options, but the placement and behaviour depend on the input and build. Do not copy a command meant for an audio-only playlist into a video-plus-audio workflow without checking it. Test whether the sequence starts again where intended and whether timestamps remain usable across the repeat.
Likewise, an input file being read faster or slower than real time is not the same thing as encoding a live output. Live pacing, timestamp behaviour, loop behaviour and output options need to work together. Test the full command with the exact FFmpeg version and representative files that you plan to use. The concat documentation defines sequencing; it does not establish one universal command for every playlist and livestream.
During an initial test, send output to a local file or a controlled test event rather than assuming the final stream will work. Read FFmpeg’s log from the beginning: a demuxer or path error occurs before any YouTube ingest issue. Once local playback and transitions are sound, add the live output stage and inspect its messages separately.
For a broader comparison of ways to keep a playlist running, see the guide to looping a media playlist in OBS. OBS and FFmpeg have different control surfaces, but the same practical separation applies: a looping playlist is not, by itself, proof that the live output is healthy.
Choose the right join method for different files
There are two distinct FFmpeg approaches worth separating. The concat demuxer treats compatible files as a sequence without requiring a re-encode at the joining step. The concat filter places streams into a filter graph, where you can convert or shape them to a common output before encoding. Which is suitable depends on the source differences and whether you need to encode anyway.
| Approach | Use it when | Trade-off |
|---|---|---|
| Concat demuxer | The files have matching stream layouts, codecs and relevant timing properties | Avoids a joining re-encode, but does not correct incompatible inputs |
| Concat filter | Inputs need conversion or deliberate stream shaping as they are joined | Gives you control over a common output, but requires an encode and more configuration |
The table is a decision aid, not a promise that the demuxer will work merely because two files look alike. A filter graph also needs careful setup: audio and video segments must be mapped and aligned in a way that matches your intended output. If the only problem is inconsistent source encoding, standardise the files first or build and test a filter workflow instead of layering fixes onto the demuxer list.
“Copy” output options can avoid encoding, but only when the incoming streams are suitable for the chosen output container and YouTube ingest. Copying a stream does not change its codec, bitrate, dimensions or timing. If the source does not fit the output requirements, choose a deliberate transcode rather than treating -c copy as a general-purpose shortcut.
This choice also affects resource use. Copying compatible streams avoids the work of decoding and encoding them again. Transcoding needs processing capacity and adds settings to manage, but it can create a consistent output from sources that differ. Test the result through the transitions, not only during one file, because a setup can start correctly and fail when the next item changes characteristics.
Configure live encoding and YouTube output
A concat input does not create a livestream. For a broadcast, FFmpeg also needs an output configuration that encodes or passes through suitable audio and video and sends them to the channel’s current ingestion address. YouTube’s live encoder settings list RTMP and RTMPS ingest and support H.264, H.265 or AV1 video, with AAC or MP3 audio. Follow the current settings for the codec, resolution and frame rate you choose; do not infer a recommended bitrate from the concat list.
YouTube recommends constant bitrate (CBR) and a two-second keyframe interval, with intervals not exceeding four seconds. Its guidance also recommends AAC or MP3 audio at 128 kbps and 44.1 kHz stereo. These are platform recommendations, not a guarantee that a particular source will sound right or remain uninterrupted. Set video bitrate from YouTube’s current table for your selected resolution, frame rate and codec, and allow headroom on the upload connection.
RTMPS is the encrypted transport choice YouTube recommends. Use the current ingest address and stream name or key supplied in your channel’s live interface, rather than a remembered endpoint copied from another setup. Keep the key private. The YouTube Live Streaming API documentation describes ingestion address and stream name fields, along with stream status and health information.
There is no single FFmpeg output command that is safe to prescribe for every audio-only or audio-plus-video source. A schematic output uses the user’s own ingest URL and key as the destination and explicit codec, bitrate, frame rate and keyframe options. Replace placeholders with the values from your YouTube account, and confirm that the chosen FFmpeg build supports the encoder and options you selected. Never put a real stream key in a public script or article.
Create or select a live event in YouTube Studio, start the FFmpeg output and keep the Live Control Room open during a preflight. Confirm that YouTube reports incoming data and inspect its stream-health messages. Test with material representative of the final programme: similar audio level and, if video is present, similar motion and scene changes. A still image test alone may not reveal an issue that appears during a moving music video.
When the local encoder drops or the network fails, the list is not the layer that reconnects to YouTube. For the separate issue of reconnect behaviour, see how to handle an FFmpeg reconnect. Reconnect logic, YouTube event settings and the input playlist should be tested independently so a recovery attempt does not hide a persistent source or output error.
Keep rights and diagnosis in the same plan
Before broadcasting, confirm that you have the rights needed for the music and any accompanying video in a live YouTube stream. Owning a download, crediting the artist, or seeing a “royalty-free” label does not by itself establish that you can use it in a continuous livestream. Read the terms attached to the music and check that they cover the channel, platform, territory, duration and live use that you intend.
YouTube says livestreams are scanned for third-party content and may be interrupted or terminated when a match is found. A licence for third-party music can still need a separate step: YouTube’s copyright guidance for live streams notes that a rights holder may need to add a licensed channel to its Content ID allowlist. Confirm the current requirements with the rights holder and YouTube before going live. A successful technical preflight does not clear the music rights.
Diagnose failures at the layer where they occur:
- The list is not recognised: Check that the marker is precisely the first line and that the file has no preceding whitespace or byte-order mark. Confirm you explicitly selected the concat demuxer if automatic recognition is not being used.
- FFmpeg cannot open an item: Check spelling, quoting, path resolution and working directory. Test each path from the same environment that runs the broadcast.
- The transition has a gap or artefact: Compare stream layouts and time bases, then inspect stream lengths and duration metadata. The demuxer bases later timestamps on earlier durations, so a bad duration can shift a boundary.
- YouTube sees no or unhealthy input: Check that the current ingest address and stream key are correct, then review supported codecs, output bitrate and keyframe interval, upload capacity, and YouTube’s health messages.
- The stream is interrupted despite a licence: Check the notice in YouTube Studio and ask the rights holder whether the channel needs Content ID allowlisting.
For issues that occur after a Windows restart or update, use the separate guide to keeping a YouTube Live loop running after Windows updates. That is an operating-system continuity problem, not a concat compatibility fix.
A cloud-based workflow can remove the need to keep your own computer running for the broadcast: StreamNeo takes an uploaded video and runs it as a YouTube live stream, so the playlist owner does not have to leave a desktop encoder open overnight. It does not alter the need to prepare compatible files, configure the channel correctly or secure the music rights.
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 an FFmpeg concat file loop the playlist forever?
No. The file lists items in order, and the concat demuxer presents that sequence as one input. Repeating it indefinitely is a separate FFmpeg input and live-workflow decision, which you should test with your own files and version.
Can the concat demuxer join MP3 and AAC files?
Not simply because both contain audio. The demuxer expects matching streams, including codecs and time bases; differing inputs may need conversion or a concat filter workflow. Inspect the streams before choosing a method.
Does a successful YouTube test mean I can broadcast the music?
No. A technical test confirms that the output reaches YouTube; it does not establish that you have the necessary rights. Check the terms for each recording and video, and verify any Content ID allowlisting requirement with the rights holder.
Should I use stream copy or re-encode?
Copying avoids an encode only when the source streams are suitable for the selected output container and YouTube ingest. If the files differ or the output requirements call for different streams, plan and test a transcode rather than expecting stream copy to normalise them.