Skip to content
streamneo.
Setup Guides14 min read

How to Set Up FFmpeg Concat for a Continuous YouTube Livestream of Story Videos

Build and test an FFmpeg concat workflow for story videos, with attention to file compatibility, live pacing, looping and YouTube ingest.

sn.
StreamNeoPublished 5 October 2026
Worth sharing?

FFmpeg’s concat demuxer can play a prepared list of story videos in sequence and send the result to YouTube Live. To make that sequence behave like a continuous live programme, you also need compatible files, real-time input pacing, an explicit repeat option and a tested output configuration.

There is no single command that suits every FFmpeg build or every set of videos. Start by checking the tools and files you actually have, then choose stream copying or re-encoding, configure YouTube ingest, and test transitions before leaving the channel running.

Check your FFmpeg build before choosing a command

FFmpeg is a collection of tools whose available demuxers, decoders, filters and encoders depend on the build. A command copied from another computer may fail on yours because it lacks the concat demuxer, the libx264 encoder, AAC support, or a required input decoder. Check the installed build rather than assuming that an installation includes every component.

Run ffmpeg -version to identify the version and build configuration. Then ask the installed binary which formats and encoders it recognises: ffmpeg -formats lists formats, and ffmpeg -encoders lists encoders. You can narrow a search in a terminal, for example with ffmpeg -encoders | grep -E '264|aac' on many Unix-like systems. On Windows, use an equivalent search in Command Prompt or inspect the full output. These checks show what FFmpeg reports as available; they do not prove that a particular end-to-end stream will work.

The command later in this guide uses the concat demuxer as an input and libx264 and AAC as output encoders. If you plan to copy existing streams instead, output encoder availability matters less, but you still need the input formats to be readable and the resulting codecs and container to suit YouTube’s ingest settings. Consult the FFmpeg format and option documentation and its concat demuxer notes when an option behaves differently from the example.

If you do not want a computer in your premises to stay on, a hosted workflow can remove that particular operating burden: StreamNeo turns an uploaded file into a YouTube live stream, so you do not have to leave the computer that prepared the programme running. It is YouTube-only; whichever route you use, you remain responsible for preparing the content and checking that the channel and broadcast are ready.

Prepare story files and decide the playback order

Treat the sequence as a small programme, not merely a folder of videos. Decide the order deliberately, give files simple names, and keep a separate note of each story’s title, approximate duration and any intended transition. A sequence that opens with a long quiet introduction may be unsuitable for a channel where viewers arrive at any point; a devotional channel may instead want a stable opening prayer before stories begin.

Make a working copy of the media in one directory and avoid changing names after making the playlist. Confirm each file plays from beginning to end, with sound, in an ordinary player. Check for black frames at the beginning or end, abrupt audio cuts, missing narration, and unexpected silence. If you are assembling or trimming the stories first, the practical advice in YouTube Create’s editing guide can help you think through edits before constructing the live playlist.

Use FFprobe, which is distributed with FFmpeg in many builds, to inspect each file. For example, ffprobe -v error -show_streams -show_format story-01.mp4 reports stream and format details. Compare the number and type of streams, video and audio codecs, time bases, frame rates, dimensions, sample rates and channel layouts. Also look at duration metadata. The concat demuxer uses a file’s duration to calculate timestamps for the following file; inaccurate duration information can lead to a gap, overlap or timestamp problem at a boundary.

Do not infer compatibility from the .mp4 extension. Two MP4 files can contain different video codecs, frame rates, audio layouts or timestamp behaviour. If the files differ, either normalise them into a consistent set before using the demuxer, or choose the concat filter and re-encode. The filter offers more control but requires a filter graph and an encode; it is not a magical repair for every damaged or unusual source. FFmpeg’s FAQ on concatenation explains the distinction between the concat demuxer and filter.

For a devotional sequence, for example, a Telugu story video with stereo AAC audio and another with mono audio may look similar but still have a different stream layout. Preparing consistent files first can make a long sequence easier to diagnose than trying to solve a discontinuity in the middle of a broadcast. See also this guide to preparing Telugu devotional videos for a live loop.

Write a playlist with valid paths

The concat demuxer reads a plain text script, with one file entry per line in playback order. Save a file such as playlist.txt beside the videos, using a plain-text editor rather than a word processor. A simple playlist looks like this:

file 'story-01.mp4'
file 'story-02.mp4'
file 'story-03.mp4'

The relative paths above are resolved from the process’s working directory, so launch FFmpeg from the directory where those paths make sense, or write paths that correctly point to the media. You can identify the script explicitly by placing ffconcat version 1.0 as its exact first line, followed by the file entries. If you use that header, save the text file without a byte-order mark; an unexpected character before the header can prevent recognition.

Paths with spaces or special characters need careful quoting and escaping according to the concat script syntax. A filename such as Story 01.mp4 should not be typed into the playlist as though it were a shell command. The playlist parser and the command-line shell are separate layers, so quoting for one does not automatically solve quoting for the other. Keeping filenames simple—letters, numbers and hyphens—is often the easiest way to avoid confusion.

A build may reject absolute paths or certain path forms under its safe-path checks. Prefer simple relative paths within a trusted working folder when you can. The -safe 0 option relaxes those restrictions; it is appropriate only when the playlist and every path in it are trusted and locally controlled. Do not use that setting with a playlist supplied by an unknown person or downloaded from an untrusted source.

Before going live, test the playlist itself by reading it to a local output or by running a short test broadcast. If FFmpeg reports that a file cannot be opened, check spelling, letter case where relevant, the working directory and each path. If it reports unsafe paths, first consider rewriting the entries as safe relative paths; use -safe 0 only for your own trusted playlist. A playlist is a sequence of instructions to open files, so treat it as input that deserves the same care as a script.

Check stream and format compatibility

The concat demuxer does not join arbitrary videos by making them alike. The FFmpeg documentation’s core requirement is that files have the same streams, codecs and time base for this method. In practice, inspect the actual stream details and test the transitions, since nominally matching properties do not guarantee that every file has clean timestamps or accurate duration metadata.

You have two broad paths. If each file already matches the others and the desired live output, stream copy can reduce CPU work because FFmpeg does not decode and re-encode the video and audio. But copied timestamps and codecs still have to form an acceptable continuous output, and the output container must suit the destination. Test before relying on it. If the inputs differ, re-encoding to a consistent output is usually the more controlled route, at the cost of processor load and another lossy generation if the source is already compressed.

Situation Practical route Main trade-off
All clips have matching streams, codecs and time bases, and the result is accepted by the intended output Test concat demuxing with stream copy Lower encode workload, but less room to correct mismatches or timestamp issues
Clips differ in dimensions, frame rate, codec, audio layout or time base Normalise beforehand, or use the concat filter and re-encode More processing and setup, with greater control over a consistent output
You need conventional YouTube live ingest and supported codecs Configure RTMPS using the current Live Control Room values Simple destination path, but codec, bitrate and keyframe settings still need to fit the channel and connection
You need an ingest mode for a format RTMP does not support, such as some HDR workflows Read YouTube’s current HLS requirements before choosing HLS Segmented delivery has different configuration and latency characteristics

Do not select a target resolution merely because one file has that resolution. Consider what the source can support, what your encoding computer can sustain and the upload rate available during the full broadcast. YouTube’s current encoder settings guidance lists supported formats and recommended settings; those are guidance, not a promise that a specific channel or connection will accept every configuration.

If a transition breaks, inspect the files on both sides with FFprobe and compare stream count, codec, time base, frame rate, dimensions and audio properties. Recheck duration metadata as well. A mismatch should be corrected at source or in a deliberate conversion step rather than hidden behind a longer command. For other failure-recovery approaches, see the guide to switching to a backup playlist when a video file fails; a single FFmpeg concat process does not by itself create that separate fallback system.

Configure real-time pacing and repetition

A playlist being read in order does not make its playback live-paced. By default, file processing can run faster than real time if the machine can process it quickly. The -re input option asks FFmpeg to read the file at its native frame rate, so the feed is paced like playback rather than sent as fast as processing allows. The -stream_loop -1 input option requests indefinite repetition of the input. Neither option fixes incompatible files, timestamps or delivery interruptions.

Both are input options, so put them before the playlist’s -i argument. In the illustrative command below, -re -stream_loop -1 apply to the concat playlist that follows. If you move options around while adapting a command, preserve that relationship. FFmpeg option placement matters because many options apply to the next input or output rather than globally.

For re-encoding, you can use a starting template such as this, but only after confirming that your build supports the selected encoders and that the output values suit your files and connection:

ffmpeg -re -stream_loop -1 -f concat -safe 0 -i playlist.txt \\
  -c:v libx264 -preset veryfast -b:v 5M -maxrate 5M -bufsize 10M \\
  -g 60 -keyint_min 60 -sc_threshold 0 \\
  -c:a aac -b:a 128k -ar 44100 -ac 2 \\
  -f flv "$YOUTUBE_RTMPS_URL/$YOUTUBE_STREAM_KEY"

This is an illustration, not a universal or tested command. It assumes a 30-frame-per-second output for a 60-frame GOP, that the build includes libx264 and AAC, and that the chosen video rate is sensible for your source and sustained upstream capacity. The shell variable names are placeholders, not values supplied by YouTube. Depending on the shell and the RTMPS endpoint format, you may need to provide the ingest URL and stream key separately rather than concatenate them exactly as shown.

YouTube’s current guidance recommends a two-second keyframe interval and says not to exceed four seconds. For H.264, it lists a recommended video bitrate of 14 Mbps at 1080p/30 fps and 17 Mbps at 1080p/60 fps; the appropriate rate depends on the selected output and the connection you can sustain. Its stereo audio recommendation is 128 Kbps at 44.1 kHz. These are YouTube recommendations, not required targets for every source. Check the current official settings page before broadcast, since settings and account controls can change.

If you choose stream copy, the relevant shape is different: use -c copy instead of the video and audio encoder options, and confirm that the copied formats and timestamps work in the selected output. Do not combine that choice with re-encoding settings and expect FFmpeg to apply both. If your input characteristics vary, the concat filter and an explicit re-encode are more suitable than assuming stream copy will smooth them out.

Send the feed to YouTube Live

Create or open the live broadcast in YouTube Studio and retrieve the exact ingest details shown for that broadcast in the Live Control Room. Use the provided RTMPS URL and stream key. These are account-specific values; do not copy a key from an old command, another channel or a screenshot. YouTube’s live stream documentation describes stream resources, while the Live Control Room is where you should verify the values for your own current broadcast.

Treat the stream key like a password. Keep it out of public scripts, screenshots, support posts and shared logs. If it has been exposed, use the controls in YouTube Studio to manage the key before sending a new feed. When testing, use a private or otherwise appropriate visibility setting and confirm the channel’s current controls before going live to the public.

Use an RTMPS endpoint for conventional H.264/AAC live delivery unless the requirements of your stream call for a different supported ingest method. YouTube also documents HLS as an alternative for certain formats, including workflows needing HDR or codecs not supported over RTMP. HLS has segment, playlist, HTTPS and latency requirements, so it is not a drop-in replacement for the FLV/RTMPS example. Check YouTube’s current live encoder and ingest guidance before taking that route.

A connection failure can have causes outside the concat script. If YouTube does not receive the feed, re-copy the RTMPS URL and key from the current Live Control Room, check that the output container and codecs fit the chosen ingest path, and read the exact FFmpeg error. YouTube notes that RTMPS SSL errors can require the correct rtmps URL and, in some cases, port 443. Avoid changing several options at once: a small, recorded change makes the cause easier to identify.

Test repetition, transitions and monitoring

-stream_loop -1 requests that the input be repeated indefinitely; it does not prove that the sequence will repeat cleanly or that YouTube will receive an uninterrupted broadcast. Watch a complete test pass, including the transition from the last story back to the first. Listen for a sudden level change, silence, clicks or a cut-off sentence; watch for black frames, frozen pictures and a change in aspect ratio. A short test that does not reach the end of the list cannot tell you whether the loop boundary is clean.

During a test, keep an eye on FFmpeg’s console output and YouTube Studio’s stream health indicators. Check whether the output frame rate, resolution, audio and bitrate behave as expected, and whether the machine has enough capacity to encode without falling behind. Also check the network over the period you intend to operate: an upload rate that works briefly may not be stable throughout the night. Do not treat a green status at startup as proof of a reliable overnight feed.

If FFmpeg stops at a file boundary, verify that the next path is correct and readable, then compare the preceding and following files with FFprobe. A duration mismatch, incompatible streams or a damaged input can surface at the point where one file hands off to another. If audio drifts, inspect sample rates, layouts and timestamps; if video stutters, check frame-rate consistency and whether the encoder is keeping pace. Change one thing, repeat the affected test and keep a note of what fixed it.

If you need a different story order at different times of day, do not confuse indefinite repetition with scheduling. A fixed concat list repeats that same order; changing the sequence requires changing the playlist or choosing a workflow that supports scheduling. The guide on scheduling different videos on a 24/7 YouTube livestream covers that separate need.

A process can fail, the computer can restart, a network can drop or YouTube can reject an ingest connection. You should decide how you will notice a failure and who will respond before treating the setup as always-on. Monitor the first live run closely, keep the source files and playlist backed up, and make sure you know how to stop the process and replace or refresh the stream key if needed. Neither FFmpeg nor any single command guarantees uninterrupted delivery.

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 demuxer automatically loop the playlist?

No. The concat demuxer reads the entries in order once unless you request repetition separately. -stream_loop -1 requests indefinite looping when placed as an input option before the playlist’s -i; test the final-to-first transition rather than assuming it will be clean.

Why does FFmpeg reject a file path in my playlist?

Check that the file exists at the path FFmpeg resolves from its working directory, and check spelling, spaces and quoting. Prefer safe relative paths in a trusted working directory; -safe 0 relaxes path checks, so use it only when you control the playlist and its entries.

Should I use stream copy or re-encode?

Stream copy can reduce processor work when the files already have matching streams and the codecs, timestamps and output container suit the destination. When the files differ, normalise them or use the concat filter and re-encode to a consistent output, then test the transitions.

Does -re keep a YouTube stream online all night?

No. It paces file input at its native rate; it does not ensure the computer, network, FFmpeg process or YouTube ingest stays connected. Monitor the broadcast and plan how you will respond if the feed drops.

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 ↗