Skip to content
streamneo.
Setup Guides13 min read

How to Stream a Playlist to YouTube Live with FFmpeg

Build an FFmpeg playlist for YouTube Live, choose between stream copying and re-encoding, and test the feed safely before going live.

sn.
StreamNeoPublished 4 October 2026
Worth sharing?

FFmpeg can read a local playlist and send its output to YouTube Live, but the playlist files must be suitable for the method you choose. YouTube provides the stream URL and stream key; FFmpeg prepares the video and audio, then sends them to that endpoint.

For a dependable setup, do not begin with a command copied from an unrelated example. Check the files, choose stream copying or re-encoding, apply YouTube’s current ingest guidance, and test representative content in Live Control Room before relying on the stream.

Prepare the files, channel, and FFmpeg

You need a YouTube channel that is able to use live streaming, a set of local media files, FFmpeg installed on the computer that will run the encoder, and enough sustained upload capacity for the selected output. A playlist of existing videos does not remove the need to encode or package the output correctly for YouTube.

Start by putting the source files in a folder that the FFmpeg process can read. Avoid moving files after creating the playlist unless you also update its paths. For a devotional loop, for example, you might keep the bhajans in one folder and use a separate text file to define their order. For a local news loop, retain the clips in the order in which they should appear and check whether each file has the intended audio.

FFmpeg is a command-line programme, so confirm that the command is available before building the live workflow. Running ffmpeg -version should display the installed build and its enabled components. The exact codecs and transport options available depend on that build. A command that uses libx264, AAC, or RTMPS support cannot work if the installed build does not provide the requested capability.

It is also worth checking the files before connecting YouTube. The guide to preparing video files for a 24/7 YouTube loop stream covers practical checks such as orientation, audio presence, and consistent presentation. Those checks are useful here even if the stream is only intended to run for a few hours.

Do not put the stream key into a public shell-history example, a shared document, or a code repository. Treat it like a password. If it is exposed, reset it from YouTube’s Live Control Room before using the channel again.

Create the playlist input for FFmpeg

FFmpeg’s concat demuxer reads a text file and presents the listed media files sequentially. A basic playlist named playlist.txt looks like this:

ffconcat version 1.0
file 'video-one.mp4'
file 'video-two.mp4'
file 'closing-loop.mp4'

The ffconcat version 1.0 line must be exact and must appear on the first line if you want FFmpeg to recognise the file automatically. Each file line points to one input. Relative paths are usually easier to maintain because the playlist and media can stay together in one folder.

For a playlist containing files in the same directory, the command input normally includes the concat demuxer and its safe-path setting:

ffmpeg -re -f concat -safe 1 -i playlist.txt ...

The -re option reads a file at approximately its normal playback rate instead of sending the entire file as quickly as the computer can process it. That pacing is important when a local file is being used as a live source. It does not repair incompatible media or guarantee that the encoder will keep up.

The FFmpeg concat demuxer documentation explains the playlist format, safe paths, stream requirements, and timestamp handling. Read it when a path contains unusual characters, when you need absolute paths, or when a file reports an incorrect duration.

Use relative paths where practical. The demuxer’s safe mode is enabled by default, and paths outside the expected location can be rejected. Rather than disabling safety immediately, first move the playlist and media into a controlled folder or correct the path format. If a path contains a single quote, spaces, or other shell-sensitive characters, test that entry separately before attempting a live broadcast.

The order in the text file is the order FFmpeg will present. Repeating a filename repeats that item, so a simple loop can be made by listing the same file more than once. This is a playlist mechanism, not a scheduling system. It does not add transitions, normalise loudness, replace missing files, or make different video formats compatible.

The demuxer uses the duration information in the source files when moving from one item to the next. Missing or inaccurate duration metadata can produce timing errors, gaps, or other visible artefacts. Correct a duration directive only when you have checked the actual media and know the stored duration is wrong. Do not add guessed durations merely because a command example contains them.

Decide between stream copying and re-encoding

The most important choice is whether FFmpeg can copy the source streams or must decode and encode them into a common output. Stream copying is lighter on the computer because the video and audio are not re-encoded. It is appropriate only when the files meet the concat demuxer’s compatibility requirements.

For stream-copy concatenation, the files need matching streams, codecs, and time bases. In practice, that means a playlist made from files with the same video format, audio format, dimensions, frame-rate behaviour, and stream layout is a much better candidate than a folder assembled from unrelated downloads. Even apparently similar files can differ in ways that become visible at a join.

Re-encoding is the safer route when the sources are mixed. A 720p MP4 with AAC audio, a 1080p file with a different frame rate, and a clip with no audio should not be assumed to concatenate cleanly with -c copy. FFmpeg’s general documentation and its concat-filter guidance provide the basis for building a filter-based workflow when the media needs to be normalised.

The concat demuxer and concat filter solve different problems:

Situation More suitable approach Main trade-off
Files have matching streams, codecs, and time bases Concat demuxer with stream copying Low processing load, but strict source requirements
Files have different codecs, sizes, frame rates, or audio layouts Concat filter with re-encoding More processing and a new encode, but greater control
You need to change resolution, frame rate, or audio format Filter and encoder workflow Output can be made consistent, but requires testing
You do not know whether the files match Inspect and test before choosing Takes time, but avoids relying on an unverified command

A stream-copy command can appear to work for the first file and still fail at the first transition. Watch the joins, not only the opening minute. Look for frozen pictures, a missing audio channel, a sudden aspect-ratio change, a timestamp warning, or a return to the beginning that does not happen as expected.

If the computer struggles during re-encoding, reduce the output complexity or use a machine with more capacity. Do not solve an overloaded encoder by blindly lowering unrelated settings. The encoder-overloaded troubleshooting guide is written for OBS, but its basic diagnostic order also helps with FFmpeg: check processing load, output settings, source complexity, and upload capacity separately.

Get the YouTube stream URL and key

Open YouTube Studio and enter Live Control Room. Create a stream or select a scheduled stream, then locate the encoder details. YouTube supplies a stream URL and a stream key for the connection. Copy both into a private place while preparing the command.

The key authorises the encoder to send a feed to the selected channel. It is not the same thing as the public watch URL. Do not replace the server-provided endpoint with a guessed address, and do not assume that an RTMP example found elsewhere uses the same path as your stream.

YouTube’s official live encoder setup guidance explains where to find the connection details and how to use the preview. The page can change, so check the current instructions in Live Control Room rather than treating an old screenshot as authoritative.

Prefer RTMPS when the selected FFmpeg build supports the connection required by YouTube. RTMPS is RTMP carried over TLS/SSL, and YouTube recommends it where supported. The YouTube RTMPS guidance explains the protocol and connection considerations.

Keep the endpoint and key as separate variables while testing locally if that makes the command easier to inspect, but avoid writing the secret to a script that will be uploaded or shared. If you need to show a command to another person, replace the real key with a placeholder such as STREAM_KEY.

Configure the output using current YouTube guidance

Your output must be suitable for the actual source material and the ingest settings YouTube currently documents. YouTube’s encoder guidance includes H.264, H.265, or AV1 video; AAC or MP3 audio; constant bitrate; up to 60 frames per second; and a keyframe interval of about two seconds that should not exceed four seconds. The appropriate bitrate depends on the chosen resolution, frame rate, and codec.

A command shape based on the research example is:

ffmpeg -re -f concat -safe 1 -i playlist.txt \
  -c:v libx264 -preset veryfast -b:v 4500k -maxrate 4500k -bufsize 9000k \
  -g 60 -keyint_min 60 -sc_threshold 0 \
  -c:a aac -b:a 128k -ar 44100 \
  -f flv 'rtmps://STREAM_URL/STREAM_KEY'

This is a template, not a universal working command. The 4500k video rate, 60-frame group of pictures, AAC settings, encoder preset, and RTMPS form all need to be checked against the target output, source files, installed FFmpeg build, and current YouTube guidance. At 30 frames per second, 60 frames represents two seconds. At another frame rate, it represents a different interval.

Replace STREAM_URL and STREAM_KEY with the exact values supplied for the selected stream. Do not paste a real key into a published article, a public issue, or a tutorial screenshot. Confirm the full endpoint in Live Control Room rather than assuming that every account or ingest choice uses one fixed URL.

The command uses constant-rate-control options as an illustration of the output structure. You still need to select a bitrate that matches the target resolution, frame rate, codec, and available upload. Your upload connection must sustain the outgoing stream, with room for normal variation. If the connection is shared with other traffic, the available capacity may be lower than the headline speed shown by an internet provider.

Audio needs its own check. A playlist can contain mixed sample rates, channel layouts, or a file with no audio stream. Re-encoding to a common AAC output can make the final feed more predictable, but it will not create meaningful sound where the source has none. Listen for silence and clipping during the preview, particularly at transitions.

If you are unsure which bitrate family applies to the intended output, use YouTube’s current encoder settings rather than copying values from a 720p, 1080p, or gaming guide aimed at another format. The bitrate comparison for long-run streams can help you think through resolution and operating cost, but the final setting should follow YouTube’s current table and the capability of your connection.

Preview and test in Live Control Room

Start with a short test using the same kind of files that will be used in the real broadcast. If the final loop contains quiet devotional audio, test quiet audio. If it contains fast local news graphics, test those graphics. A static test card may prove that the connection opens, but it will not expose every motion, audio, or transition problem.

Start FFmpeg and return to Live Control Room. Wait for YouTube to detect the incoming feed, then inspect the preview and stream-health messages. Check the first file, at least one middle transition, and the point at which the playlist returns to its first item. If the playlist is long, make a shorter test copy with representative files rather than assuming the untested full run will behave identically.

Look for these signs during the test:

  • The preview shows the intended picture rather than a black frame or the wrong crop.
  • Audio is present, at a reasonable level, and remains present after a file transition.
  • The picture does not freeze when one file ends.
  • The next item begins in the expected order.
  • FFmpeg is not reporting repeated timestamp, encoder, or connection errors.
  • The computer keeps pace with the output without becoming overloaded.
  • Stream health remains acceptable while the upload connection is carrying the feed.

Do not press the final publish or go-live control until you have checked the preview and the event settings. The preview is useful because it shows what YouTube is receiving, not merely what FFmpeg says it has opened locally. If YouTube reports an ingest problem, fix the endpoint, output format, bitrate, or connection before treating the issue as a playlist problem.

For a long-running channel, test the transitions that matter most instead of relying on the first successful connection. A loop can connect correctly and still fail when the first file ends. YouTube says encoder streams under 12 hours are automatically archived after they end, but that does not establish a general rule for an unattended 24/7 broadcast. Avoid promising continuous output until your own workflow has been observed for the period that matters to you.

Plan for interruptions and unattended running

A local FFmpeg process depends on the computer, power, network, storage, and the playlist files remaining available. If the computer sleeps, reboots for an update, loses access to the media folder, or drops its connection, the YouTube feed can stop. A command that works at a desk is not automatically a reliable overnight arrangement.

Before leaving it unattended, disable sleep only where appropriate, prevent the source drive from disconnecting, and decide how you will notice a stopped process. Keep the playlist and source files in a stable location. Record the exact command and the output settings privately so that you can restart the workflow without reconstructing it from memory.

If you need to change one item in an active loop, do not edit the playlist while assuming the running process will safely adopt every change. Prepare the replacement list, test it separately, and plan a controlled restart. The guide on changing video on an active 24/7 YouTube stream explains why a content change can require more planning than replacing a local file.

If the main difficulty is keeping your personal computer on and monitoring a local command, StreamNeo removes that particular burden by letting you upload a video, provide the YouTube stream key, and have the channel run from the cloud with automatic monitoring and restarts. It is YouTube-only, so it does not replace an FFmpeg workflow when you need command-line control or a different destination.

A cloud-based arrangement still needs testing, correct media, a valid channel, and a private key. No service or command should be treated as proof that a stream will remain live indefinitely. Check the current YouTube requirements and observe the actual output before making it part of a daily schedule.

A practical fault-finding order

When the feed does not work, change one thing at a time. First confirm that YouTube has supplied the correct stream URL and that the key belongs to the selected event. Then check whether FFmpeg can open the playlist locally without the live output. This separates a file or concat problem from a connection problem.

Next inspect the first transition. If the first item plays but the next one fails, suspect source compatibility, duration metadata, or differing stream layouts before changing the bitrate. If FFmpeg exits immediately, read the final error rather than repeatedly launching the same command.

If the preview is black, check whether the input contains a video stream and whether the selected output codec is available. If there is picture but no sound, inspect the audio streams and channel layout in the source files. If the feed stutters, compare processing load and upload stability rather than assuming that YouTube is rejecting the playlist.

If stream copying produces errors at joins, build a small re-encoding test with the same troublesome files. If that resolves the joins, the original files were not a good match for direct concatenation. Do not describe the stream-copy command as fixed until the representative files have passed the test.

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 I use any MP4 files in one FFmpeg playlist?

No. The concat demuxer expects compatible files with matching streams, codecs, and time bases. Mixed sources may need the concat filter and re-encoding, so inspect and test the actual files rather than relying on the .mp4 extension.

Do I need to re-encode every playlist?

No. If the files are suitably matched, stream copying can avoid unnecessary processing. Re-encoding is more appropriate when you need to make resolution, frame rate, codecs, or audio layouts consistent.

Where do I find the YouTube stream URL and key?

YouTube provides both in Live Control Room after you create or select a stream. Keep the key private, use the exact endpoint shown there, and reset the key if it has been exposed.

Will this guarantee a 24/7 stream?

No. A successful test proves that the chosen files, FFmpeg build, connection, and YouTube settings worked during that test. Long unattended operation also depends on the computer, power, network, storage, and a recovery plan.

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 ↗