DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
DocumentaryTube
Admit one · Blog

How to Use systemd to Keep an FFmpeg YouTube Playlist Stream Running on Ubuntu

Run an FFmpeg YouTube playlist stream as a supervised Ubuntu systemd service, with practical checks for playlists, restart behavior, YouTube ingest, and troubleshooting.
Opened Runtime7 min Written byDocumentaryTube Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use a system-level systemd service to start FFmpeg at boot and restart its process after a failure. That keeps the encoder process supervised, but it does not fix a broken playlist, restore network access or credentials, or prove that YouTube is still receiving a live broadcast. Verify the service locally and the stream separately in YouTube Live Control Room.

What this setup does—and what it does not

A system service gives FFmpeg a managed lifecycle: it can run without an interactive shell, start when Ubuntu boots, restart according to a policy, and send diagnostic output to the system journal. Restarting FFmpeg is process supervision, not a complete broadcast health check. A service can be active while the stream is not reaching YouTube or the YouTube event is no longer live.

This guide uses a local playlist and a systemd service. It does not assume that every Ubuntu FFmpeg package supports the same input protocols or that every YouTube event uses the same ingest protocol. Check the installed FFmpeg build and the ingest details shown for your event before relying on an example.

Prepare a dedicated account and media directory

  1. Create or select a dedicated, non-login account for the stream rather than running FFmpeg as root. For example, an administrator can create one with sudo adduser --system --group --home /var/lib/ytstream ytstream. Adapt this to your host’s account policy.

    Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  2. Put the playlist and media files in a directory the service account can read. Set ownership and permissions so the account can access the files without making private media or credentials broadly readable. For example, an administrator may use a group shared with the media owner instead of transferring ownership.

  3. Use stable absolute paths. Relative paths depend on the service’s working directory, which may differ from your shell. Confirm the account can traverse every parent directory and read every listed file.

Check FFmpeg and playlist support

  1. Install FFmpeg using your chosen Ubuntu package source, then inspect the actual executable with ffmpeg -version. FFmpeg features vary by build; its protocol manual explains that sequence-reading protocols such as concat and concatf read multiple resources in order. See the FFmpeg protocol documentation.

  2. Check which protocols your executable provides with ffmpeg -protocols. Do not assume that a protocol documented upstream is enabled in your particular Ubuntu package.

    Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  3. Choose an input method suited to your files and validate it before making a service. For a plain text concat-demuxer list, a typical list contains lines such as file '/srv/yt-media/part-01.mp4' and file '/srv/yt-media/part-02.mp4'. This is a demuxer input format, distinct from the concat and concatf protocols; consult the installed FFmpeg documentation and verify support and syntax locally. Keep the list ordered and use paths readable by the service account.

  4. Check that the files’ stream parameters are suitable for concatenation and continuous output. If files differ in codecs, dimensions, frame rate, audio layout, timestamps, or container details, a simple stream-copy command may fail or produce a discontinuity. Test the exact command and playlist with your actual assets rather than assuming a generic list will work.

Choose the YouTube output protocol

Use the protocol and ingest URL/key assigned in YouTube Live Control Room. Do not substitute an HLS command for an RTMP setup or apply HLS-specific settings to an RTMP output.

If your event uses HLS

YouTube Help’s HLS setup specifies an HLS stream key and HTTPS URL, MPEG-TS segments, segment durations from 1 to 4 seconds, a rolling playlist with no more than five outstanding segments, and HTTPS POST/PUT. YouTube describes HLS as higher latency than continuous RTMP ingestion because it sends segments. These requirements are specific to HLS; use the current YouTube HLS ingestion instructions and verify that your FFmpeg build and command can produce the required output.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

If your event uses RTMP or another ingest option

Follow the protocol and encoder settings displayed for that event in Live Control Room and the corresponding current YouTube guidance. The HLS segment rules above do not apply to RTMP. This guide does not provide a universal RTMP command because the right options depend on your input codecs, whether FFmpeg must transcode, and the event’s ingest configuration.

Run the exact command in the foreground first

  1. As the service account, run the command from the directory and with the environment you intend the service to use. Use your own current YouTube ingest address and stream key; never publish a real key in a unit file readable by other users or in example logs.

  2. Confirm FFmpeg opens every playlist entry, advances through the sequence, and continues looping if looping is part of your command. Watch for missing-file errors, unsupported protocols, codec or timestamp problems, and connection or authentication failures.

  3. Confirm the event receives the stream in YouTube Live Control Room. A successful FFmpeg process alone does not establish that viewers can see a live broadcast.

    What’s actually slowing this PC down?

    Pick the symptom - the matching free tool is one click away.

    Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  4. Only after this exact foreground command and playlist work should you move it into systemd. Preserve the tested arguments rather than changing input, codecs, or output protocol during the move.

Create a systemd service

The example below is illustrative, not a tested universal unit. Replace the command and paths with the foreground command that you verified, and validate directive behavior against the systemd.service manual installed on your target Ubuntu release. Keep the real stream key out of a publicly readable unit. The cited sources do not establish a single secure secret-storage mechanism for all Ubuntu hosts; use a permissions-controlled mechanism appropriate to your system and avoid exposing credentials in logs.

[Unit]
Description=FFmpeg YouTube playlist stream
After=network-online.target
Wants=network-online.target

[Service]
Type=simple
User=ytstream
Group=ytstream
WorkingDirectory=/srv/yt-media
ExecStart=/usr/bin/ffmpeg [your verified FFmpeg arguments]
Restart=on-failure
RestartSec=10

[Install]
WantedBy=multi-user.target

Enable, start, and inspect the service

  1. Save the unit as /etc/systemd/system/ytstream.service using administrator permissions.

  2. Tell systemd to reload unit files: sudo systemctl daemon-reload.

    Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  3. Enable startup at boot and start it now: sudo systemctl enable --now ytstream.service.

  4. Check the current state with systemctl status ytstream.service. Read recent service output with journalctl -u ytstream.service -n 100 --no-pager; follow new output with journalctl -u ytstream.service -f.

  5. Check YouTube Live Control Room independently. The service can be running even when YouTube is not ingesting a valid stream.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Test recovery and plan for maintenance

After the stream is working, test the process-restart behavior deliberately during a maintenance window. Stop the FFmpeg process in a controlled way and check whether systemd reports a failure, waits for the configured delay, and starts it again. Then confirm that the playlist resumes and YouTube receives the event. A clean stop may not trigger an on-failure restart, which is why the outcome depends on how the process exits and the policy you chose.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Ubuntu’s server documentation says that beginning with Ubuntu 24.04 LTS, needrestart automatically restarts affected services by default after unattended upgrades. Administrators can configure automatic restarts versus listing services for manual action and can exclude named critical services. Behavior is release- and configuration-sensitive; review the Ubuntu automatic updates documentation for your release and decide how maintenance restarts should affect a live broadcast.

Troubleshoot common failures

Symptom Likely cause What to check
Service fails immediately Invalid command syntax, inaccessible path, missing file, or unsupported FFmpeg option/protocol. Run the same command as the service user in the foreground; inspect systemctl status and the unit journal; check ffmpeg -protocols for build support.
FFmpeg runs but playlist does not advance List syntax, ordering, file permissions, incompatible streams, or an input that is not the intended sequence method. Inspect the exact list and paths, test as the service account, and review FFmpeg output for decode, timestamp, or stream-parameter errors.
systemd restarts repeatedly The underlying command still fails, the restart policy is broader than intended, or the delay is too short for the failure mode. Read journal entries across multiple attempts; fix the first FFmpeg or access error rather than treating restarts as a repair; adjust policy and delay deliberately.
FFmpeg is active but YouTube shows no live input Wrong ingest protocol or URL/key, connection/authentication failure, or output settings incompatible with the selected ingest. Compare the command with the current event details in Live Control Room and inspect FFmpeg connection messages. Keep HLS-specific settings separate from RTMP.
The stream stops around an Ubuntu update A maintenance operation restarted an affected service, depending on Ubuntu release and needrestart configuration. Check update and journal timestamps, confirm the service came back, and verify the broadcast again in Live Control Room.

Or let it run in the cloud

If the goal is simply to keep uploaded recordings playing on a YouTube channel around the clock, StreamNeo is an alternative to maintaining an Ubuntu host and FFmpeg service. Upload a recording or build a playlist, add your YouTube stream key, and go live; it loops the uploaded videos from the cloud, so nothing has to stay on at home. StreamNeo plays uploaded videos and streams to YouTube, not from a camera or to other platforms.

See StreamNeo or current plans. Start the free day with StreamNeo.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Screening Room

  1. How to Migrate a 24/7 YouTube Stream to a New VPSAdmit one · BlogHow to Migrate a 24/7 YouTube Stream to a New VPSOpened04 OCT 2026Runtime6 min
  2. How to Run a YouTube Playlist on a Headless Linux Server—and Broadcast It LiveAdmit one · BlogHow to Run a YouTube Playlist on a Headless Linux Server-and Broadcast It LiveOpened04 OCT 2026Runtime6 min
  3. How to Make a 24/7 Indian Music YouTube Stream Restart After a Server RebootAdmit one · BlogHow to Make a 24/7 Indian Music YouTube Stream Restart After a Server RebootOpened04 OCT 2026Runtime6 min
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.