Skip to content
streamneo.
Setup Guides14 min read

How to Stream a Folder of Videos to YouTube Live Continuously from Linux

A practical Linux guide to sequencing a video folder for YouTube Live with FFmpeg or OBS, testing transitions and planning recovery.

sn.
StreamNeoPublished 4 October 2026
Worth sharing?

A Linux computer can read local video files in sequence, encode them as a live stream, and send the result to YouTube through the ingest address and stream key configured in YouTube Studio. For a headless setup, FFmpeg is usually the more suitable starting point; OBS is easier when you want a visual interface.

A folder by itself does not create a livestream. You must decide the playback order, check that the files can be decoded consistently, configure YouTube's ingest settings, test the transitions, and arrange a way to detect and recover from failures.

Choose FFmpeg or OBS for the Linux host

The first decision is whether your Linux machine should be operated from a terminal or from a graphical desktop. Both FFmpeg and OBS can send an encoded stream to YouTube, but they suit different working habits.

FFmpeg is the practical choice for a headless machine. You can keep the media on a local disk, run a scripted playback process, and supervise it without leaving a desktop session open. This suits a small business channel in a back room, a devotional playlist on an always-on computer, or a remote Linux host that you access over SSH.

OBS Studio is more comfortable if you need to see the programme, change scenes, inspect sources, or intervene manually. Its interface makes it easier to confirm what is currently playing, but a folder of files is not automatically a reliable playlist merely because OBS can load media sources. You still need to decide how items are ordered, what happens after the last item, and what happens when one file cannot be opened.

Choice Useful when Main responsibility
FFmpeg You want a scripted, headless workflow Validate the command against your FFmpeg build and media collection
OBS Studio You want a graphical interface and manual control Keep the desktop session, scenes and playlist workflow available
Local Linux computer The files are already stored on a machine you can leave running Maintain power, storage, cooling and network access
VPS or remote Linux host You need the stream to continue away from your premises Transfer or mount the media and maintain the remote machine

Neither choice removes the need for testing. FFmpeg can stop on an unexpected codec or malformed file. OBS can remain open while a source has ended, frozen or lost its audio. If you are unsure whether your library is suitable for a long loop, begin with a short representative selection rather than the entire folder.

YouTube's official encoder guidance is the reference for supported settings and protocols. It is more useful than copying a command written for a different Linux distribution, FFmpeg version or collection of files.

Prepare and order the video folder

Start by treating the folder as a small broadcast library, not as an arbitrary collection of files. Decide what viewers should see first, what should play during the quietest hours, and whether the sequence should repeat in the same order each time.

File names are often the simplest ordering mechanism. A naming scheme such as 001-opening.mp4, 002-morning-prayer.mp4 and 003-announcement.mp4 makes the intended sequence visible to you and to any script that sorts names alphabetically. Do not rely on the order in which a file manager happens to display files.

Keep a written manifest of the intended order. It can include the file name, duration, resolution, frame rate and an audio note. This gives you something to check when a viewer reports that a segment is missing, and it makes replacing one file less likely to alter the rest of the sequence.

Check the actual properties of every file you plan to use. Differences that matter include:

  • video dimensions, such as 1920×1080 and 1280×720;
  • frame rate, including constant versus variable frame rate;
  • video codec and pixel format;
  • audio codec, sample rate, channel layout and whether audio exists at all;
  • container format and damaged or incomplete files;
  • unusually long opening black frames or silent sections.

A folder containing files with different properties may still be usable, but the workflow has to handle those differences. Some files may need to be re-encoded into a common format before sequencing. Others may decode correctly but produce a visible pause, audio change or aspect-ratio jump at the join. Do not assume that a command which works for one MP4 will behave the same way for a mixed folder.

Keep the source files separate from any normalised copies. A useful arrangement is an input folder for originals, an output or prepared folder for files that have been checked, and a log location for the encoder. This avoids accidentally feeding temporary files, partial downloads or old test renders into the live sequence.

Before using any music, recorded speech, news footage, devotional material or other media, confirm that you have the necessary rights and that the channel's content complies with YouTube's current rules. Streaming eligibility, reused-content treatment and account status are separate questions from whether FFmpeg can read a file.

Configure YouTube Live ingest

Create or schedule the live broadcast in YouTube Studio, then obtain the current stream URL and stream key from the live control room. The encoder uses these details to send your Linux output to the correct YouTube destination. Treat the stream key as a credential: do not place a real key in a public script, screenshot, article, support ticket or shared log.

For an ordinary encoder workflow, use RTMPS where YouTube provides it. YouTube describes RTMPS as a secure extension of RTMP and publishes encoder requirements for H.264, H.265/HEVC and AV1. It also publishes requirements for audio and keyframes. Follow the current official page rather than treating the figures below as permanent platform rules.

For a straightforward H.264 starting point, YouTube currently lists these recommended video bitrates:

Output YouTube's listed H.264 recommendation Practical implication
720p at 30 fps 4 Mbps Lower data rate, but less image detail
1080p at 30 fps 10 Mbps A sensible starting point for a standard full-HD channel
1080p at 60 fps 12 Mbps More motion detail and a higher sustained upload demand

These are YouTube recommendations, not a guarantee that your connection can sustain them. Choose a setting your upload connection can maintain continuously, with room for ordinary network variation. A test made while the network is quiet does not prove that an overnight stream will remain healthy.

YouTube recommends constant bitrate encoding and a keyframe frequency of two seconds, with the interval not exceeding four seconds. Audio can use AAC or MP3; 5.1 surround over RTMP or RTMPS requires AAC. If your source files have inconsistent audio, decide whether to normalise them before the live process or let the chosen encoder produce a consistent output.

HLS ingestion is not simply another URL to try when RTMPS is inconvenient. YouTube documents it for particular needs, including some HDR or codec situations, and its requirements include short TS segments, a rolling playlist, HTTPS requests and other behaviour that differs from an ordinary RTMP-style encoder. Unless you have a specific reason to use HLS, follow the standard RTMPS encoder path.

The live stream resource and the broadcast are related but distinct parts of YouTube's system. In practical terms, you still need a configured live event and an encoder connection. For account-specific requirements, consult YouTube's live streaming help before relying on an unattended schedule.

Sequence and encode the videos

There are three separate jobs in a folder workflow. Something must choose the next file, something must decode each file, and an encoder must produce a live-paced output that YouTube accepts. Combining those jobs in one shell line can be convenient, but it does not make the underlying decisions disappear.

First choose the sequencing method. A playlist or concat-style input can read a defined list in order. A shell script can generate that list from a directory, but directory enumeration must be deterministic and must exclude hidden files, temporary downloads and unsupported extensions. If the list should repeat, the loop needs to return to the first item deliberately. If one item fails, the process needs a defined response rather than silently advancing or waiting forever.

Next decide whether to copy or re-encode. Copying the original video and audio streams can reduce processing demand, but only when the combined output is compatible with the selected workflow and the joins behave correctly. Re-encoding gives you a common output profile and makes it easier to set a single resolution, frame rate, bitrate, audio format and keyframe interval, but it uses more CPU or hardware-encoding capacity.

There is no universal FFmpeg command for every folder. A collection of H.264 files with matching dimensions and audio may work with a relatively simple sequence. A library containing mixed frame rates, missing audio, unusual pixel formats or damaged containers may require preparation first. Validate the exact syntax against the FFmpeg version installed on your Linux distribution and against copies of the actual media.

A good preparation workflow is:

  1. Select a small sample containing the shortest, longest, quietest and most visually demanding files.
  2. Inspect their streams and durations with a media-information tool available on your system.
  3. Try the intended sequence locally, without YouTube, and watch both the image and the audio.
  4. If joins are unstable, create normalised copies with matching output properties.
  5. Only then build the full ordered list and connect the encoder to YouTube.

Keep the YouTube destination separate from local testing. A local dry run can reveal decoder and transition problems without exposing a test broadcast to viewers. When you do connect to YouTube, use a private or otherwise controlled test arrangement where appropriate, and confirm the correct broadcast before starting.

If your real objective is a scheduled playlist rather than a simple repeating folder, an OBS workflow may be easier to operate. For example, you can compare the timed-source approach in this guide to playing different videos at set times in an OBS YouTube stream. That does not make OBS unattended by itself, but it may fit a channel where a person checks the schedule each day.

Test playback and transitions

YouTube explicitly advises, “Make sure to test before you start your live stream.” For a folder workflow, testing means more than confirming that the first file appears in the preview.

Run the sequence long enough to pass through several joins. Include a transition from a file with movement to one with a static image, a change in loudness, a file with a different aspect ratio, and an item with the least common codec in the folder. Watch for a frozen final frame, a black interval, a burst of noise, an audio channel disappearing or the next file starting late.

Compare what the local process reports with what YouTube Studio reports. The Linux terminal may show that FFmpeg is still running while YouTube's stream health indicates missing data, unstable bitrate or another ingest problem. Conversely, a temporary warning may clear while the process continues normally. Use both views rather than treating a running process as proof of a healthy broadcast.

Test the end of the sequence as carefully as the beginning. Does the first file start again, does the process exit, or does it remain open without producing useful frames. If the service restarts, does it resume at the first item, repeat the last item, or create an unintended gap. Each behaviour may be acceptable in a different channel, but it must be known before you leave the machine unattended.

Also test a deliberately bad case on a copy of the folder. Remove a file from the playlist, make a file unreadable, or interrupt the network during a non-public test. The purpose is not to prove that every failure can be hidden. It is to learn whether the process exits, retries, skips, logs an error or waits for manual action.

For a longer-lived file, the encode checklist for a month-long loop is useful because it focuses attention on consistent media properties rather than only on the streaming command. A stable input reduces the number of problems that have to be diagnosed at the YouTube boundary.

Run continuously with a service manager

Once the local sequence works, put the Linux-side process under a service manager such as systemd. The service should start only after the media path and network are available, run under a suitable user account, write logs somewhere you can inspect, and have a deliberate restart policy.

A service manager can start a process after a reboot and restart it after an ordinary process exit. It cannot determine whether the output is visually frozen, whether the wrong file is playing, whether the stream key points to the intended broadcast, or whether YouTube is receiving a healthy bitrate. Those checks need separate observation.

Keep configuration out of the unit file where possible. A protected environment file or other secret-handling method can reduce the chance of exposing the stream key through process listings, backups or copied screenshots. Restrict permissions on the media and log directories, and avoid logging the complete ingest URL if it includes sensitive information.

Set the service to use an explicit working directory and absolute paths. A command that succeeds in an interactive terminal may fail under systemd because its PATH, home directory, permissions or mounted storage are different. Test the service as the same user and from the same directories it will use in production.

Choose a restart policy that matches the failure you are trying to recover from. Restarting immediately may create a rapid loop if a file is invalid or the stream configuration is wrong. A short delay gives the network and encoder time to recover, but it does not solve a permanent input error. Record the exit status and inspect the logs after every unexpected restart.

If your computer is in a home or office, account for power interruptions, automatic updates, disk-full conditions and the possibility that the graphical session is not running. A local machine is reasonable when you already have suitable hardware and can maintain it. A remote Linux host can be useful when the channel must run away from the premises, but it introduces storage, access and maintenance decisions of its own.

For readers who want the file-and-key workflow without keeping a Linux encoder running, StreamNeo removes the need to leave the local computer responsible for the broadcast: you upload the video, provide the YouTube stream key, and the cloud-run channel can be monitored and restarted if it drops. It is YouTube-only, so it is not a substitute for a distribution setup or for a Linux process you need to control directly.

Monitor failures and recovery

Unattended operation is a plan for detecting and responding to failure, not merely a process that starts at boot. Write down what you will check and how you will know that the stream is no longer useful to viewers.

At the Linux level, monitor the process, recent log entries, disk space, CPU load and network reachability. A full disk may prevent logs or temporary files from being written. High CPU usage may cause encoding delays. A network interface can remain connected while the upload is too unstable for a healthy live stream.

At the YouTube level, inspect the live control room's stream health and preview. Look for a stalled preview, warnings, unexpected latency or a bitrate that does not match the intended output. YouTube's official guidance should remain the source for current health indicators and encoder settings.

Use a simple escalation order:

  1. Check whether the Linux process is running and whether its logs show a decoder or connection error.
  2. Check whether the media file currently being read exists and can be decoded locally.
  3. Check the host's CPU, memory, storage and upload connection.
  4. Check YouTube Studio and confirm that the broadcast and ingest details are the intended ones.
  5. Restart the encoder only after recording enough information to identify the failure.
  6. If the same file causes repeated failures, remove it from the live list and test it separately rather than allowing the whole channel to loop on it.

A restart can reconnect the encoder, but it may also create a visible interruption or begin the sequence again. That is why recovery behaviour should be tested in advance. The FFmpeg YouTube troubleshooting guide can help you organise the investigation when a process repeatedly exits, but apply its advice to your own FFmpeg build and media rather than copying settings blindly.

If Wi-Fi is part of the setup, test the actual connection at the time and location where the host will operate. A wired connection may be preferable where practical, but no connection type removes the need to watch stream health. The guide to YouTube stream drops when using Wi-Fi covers the network side of this decision.

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 point FFmpeg at a folder and start streaming immediately?

Not reliably. You need a defined file order, a sequencing method, compatible decoding and an output profile that YouTube accepts. Mixed codecs, dimensions, frame rates or audio layouts may require normalisation and testing before the folder is suitable for a continuous stream.

Is OBS better than FFmpeg for a 24/7 Linux channel?

OBS is often easier when you need a visual interface, scenes and manual control. FFmpeg is usually more appropriate for a headless, scripted workflow, but it requires you to design the playlist, logging and recovery behaviour yourself. The better choice depends on whether unattended terminal operation or graphical supervision fits your channel.

Does systemd guarantee that YouTube will keep playing?

No. systemd can restart a Linux process after some failures, but it cannot guarantee that the encoder is producing valid frames, that the network is sufficient or that YouTube is receiving a healthy stream. Monitor both the service and YouTube Studio, and test the recovery path before leaving the channel unattended.

Should I use RTMPS or HLS?

For a normal encoder-to-YouTube workflow, start with YouTube's RTMPS guidance. HLS has different segment, playlist and request requirements and is intended for particular use cases, so it is not an interchangeable shortcut for a folder loop.

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 ↗