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.

Use a system-level systemd service to start FFmpeg at boot, restart it after a process failure, and review its logs. First make the playlist and FFmpeg command work in the foreground; then put that command in a service and confirm the broadcast separately in YouTube Live Control Room. systemd can restart a process, but it cannot fix a broken playlist, restore credentials or network access, or guarantee that YouTube still considers the event live.

What this setup does—and what it cannot do

A systemd service gives FFmpeg a managed lifecycle: it can launch automatically at boot, run under a dedicated Linux account, and restart according to a policy you choose. You can inspect its state and output through the system journal.

This is process supervision, not end-to-end stream monitoring. A service may be active while FFmpeg repeatedly fails to read a file, cannot reach YouTube, or sends a stream YouTube rejects. Check both the service logs and the event’s status in YouTube Live Control Room.

Prepare the Ubuntu host and playlist

Create a service account and readable media directory

Use a dedicated, non-login account where practical, and make sure that account can read the media and playlist files. For example, an administrator can create an account and directory like this:

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.
sudo adduser --system --group --no-create-home ffmpegstream
sudo install -d -o ffmpegstream -g ffmpegstream /srv/youtube-playlist

Copy your video files and playlist into /srv/youtube-playlist, then set ownership or permissions so ffmpegstream can read them. Do not make media or credential files world-readable just to avoid a permissions error.

Check FFmpeg and its available protocols

Install FFmpeg using the package source appropriate for your Ubuntu release, then inspect the binary and its compiled-in protocols:

ffmpeg -version
ffmpeg -protocols

FFmpeg protocol availability varies by build. The official FFmpeg protocol documentation describes sequence-reading protocols such as concat and concatf, but do not assume your installed executable supports a protocol just because another build does. Confirm locally with ffmpeg -protocols.

Choose and validate the playlist input

For a simple ordered set of local files, FFmpeg’s concat demuxer is often a suitable input approach when the files have compatible stream parameters. A playlist file can look like this:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
file '/srv/youtube-playlist/part-01.mp4'
file '/srv/youtube-playlist/part-02.mp4'

Save it as /srv/youtube-playlist/list.txt. Verify the paths, quoting, account permissions, codecs, and whether the files can be concatenated without problematic changes in stream parameters. If you choose a sequence protocol instead, verify that it is enabled in your build and that its expected input syntax fits your playlist. The official FFmpeg protocol manual explains sequence-reading protocols; protocol support is not universal across distro releases and builds.

Run the FFmpeg command in the foreground first

Before systemd is involved, run the exact command as the service account. This separates FFmpeg, file, and YouTube-ingestion problems from service configuration problems. The following is a starting pattern for a concat-demuxer playlist sent to an RTMP ingest URL; replace the output URL with the current server URL and stream key shown for your event in YouTube Live Control Room:

sudo -u ffmpegstream ffmpeg 
  -re -f concat -safe 0 -i /srv/youtube-playlist/list.txt 
  -c:v libx264 -preset veryfast -b:v 4500k -maxrate 4500k -bufsize 9000k 
  -pix_fmt yuv420p -g 120 -c:a aac -b:a 128k -ar 44100 
  -f flv 'rtmp://YOUR_CURRENT_INGEST_URL/YOUR_STREAM_KEY'

This illustrative command assumes an FFmpeg build with the named codecs and an RTMP ingest destination. Its encoding values are example settings, not universal YouTube requirements: choose resolution, frame rate, bitrate, and keyframe interval to suit your source, available upload capacity, and the current YouTube guidance for your selected ingestion setup. Do not publish or paste a real stream key into a public unit file, shared terminal transcript, or log. Protect it according to the host’s permissions model.

Run the command, watch for input or encoding errors, and confirm that the playlist advances as expected. Then verify that YouTube receives the stream and that the event is live in Live Control Room. If this test fails, fix the command before creating a service.

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

Choose the output protocol deliberately

The example above uses RTMP and FLV output; do not apply HLS-specific output rules to it. If you select YouTube HLS ingestion instead, follow YouTube Help’s Set up an encoder for live streaming instructions for the HLS endpoint and stream key. YouTube specifies HTTPS, TS segments, segment durations from 1 to 4 seconds, a rolling playlist with no more than five outstanding segments, and HTTPS POST/PUT for HLS. YouTube also describes HLS as higher latency than continuous RTMP ingestion. These are HLS requirements, not settings for an RTMP command.

Create a systemd service

Write an illustrative unit file

Once the foreground command works, create /etc/systemd/system/ffmpeg-youtube.service with an administrator’s editor. This example shows the service structure; validate directive behavior against the systemd.service manual installed for your Ubuntu release, and adapt the command and secret handling to your host:

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

[Service]
Type=simple
User=ffmpegstream
Group=ffmpegstream
WorkingDirectory=/srv/youtube-playlist
ExecStart=/usr/bin/ffmpeg -re -f concat -safe 0 -i /srv/youtube-playlist/list.txt -c:v libx264 -preset veryfast -b:v 4500k -maxrate 4500k -bufsize 9000k -pix_fmt yuv420p -g 120 -c:a aac -b:a 128k -ar 44100 -f flv YOUR_CURRENT_INGEST_URL_AND_KEY
Restart=on-failure
RestartSec=10

[Install]
WantedBy=multi-user.target

The command shown in ExecStart is illustrative and omits a real stream key. Do not put a live credential in a unit file readable by unintended users. Use a protected, host-appropriate secret mechanism, restrict access to any file that contains the key, and avoid logging it. Confirm the exact invocation works with that mechanism before enabling the service.

Choose restart behavior intentionally

Restart=on-failure requests a restart when FFmpeg exits unsuccessfully; the ten-second RestartSec delay avoids an immediate restart loop. This does not restart FFmpeg after every clean exit. If your command is expected to exit cleanly and should then be launched again, choose and validate a different policy rather than assuming failure-only behavior is sufficient. Consult the systemd.service manual for the installed version when changing restart directives.

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

Enable, start, and inspect the service

  1. Reload unit definitions: run sudo systemctl daemon-reload after creating or changing the unit.
  2. Enable at boot and start now: run sudo systemctl enable --now ffmpeg-youtube.service.
  3. Check service state: run sudo systemctl status ffmpeg-youtube.service. A running state means systemd sees the process as running; it does not prove YouTube is receiving a valid broadcast.
  4. Read recent logs: run sudo journalctl -u ffmpeg-youtube.service -n 100 --no-pager. Follow new output with sudo journalctl -u ffmpeg-youtube.service -f.
  5. Verify the viewer-facing event: open YouTube Live Control Room and check the event’s ingest and live status independently.
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 confirming a healthy stream, test process recovery during a controlled maintenance window. Stop the FFmpeg process in a way that produces a failure, then check whether systemd starts it again after the configured delay. Review the journal and YouTube Live Control Room; a restarted process may still fail to ingest or resume the event.

Also account for operating-system maintenance. Ubuntu Server documentation says that beginning with Ubuntu 24.04 LTS, needrestart automatically restarts affected services by default after unattended upgrades. Administrators can change the behavior or exclude a critical service. The default and available configuration are version-sensitive; consult the documentation for your release: Ubuntu Server: Automatic updates. A service restart during maintenance is distinct from recovery after an FFmpeg crash.

Troubleshoot common failures

  • Service fails immediately: inspect systemctl status and the journal. Check unit syntax, executable path, playlist path, file permissions, and whether the command that worked in the foreground was copied correctly.
  • FFmpeg reports an unknown protocol: run ffmpeg -protocols on the installed executable. Use an input method supported by that build or install a build that provides the needed protocol.
  • Playlist cannot be read or stops advancing: verify every listed path and the service account’s read access. Check that the files and playlist syntax are valid and that the chosen sequence method suits the files.
  • FFmpeg runs but YouTube does not show a healthy ingest: confirm the event is configured for the same output protocol, the current server URL and key are correct, and the codecs and output format are accepted. Check Live Control Room as well as the local journal.
  • The service restarts repeatedly: read the FFmpeg error preceding each exit. A restart policy can repeat attempts, but it cannot repair a wrong key, missing file, unsupported codec, or network failure. Fix the underlying cause and restart the service.
  • The process is active but viewers do not see the expected live event: systemd only reports the process lifecycle. Check YouTube Live Control Room and the event configuration; restarting FFmpeg alone may not restore an event that YouTube has ended or rejected.
  • The stream is interrupted after Ubuntu updates: check whether maintenance restarted the service, then review its journal and YouTube status. On Ubuntu 24.04 LTS and later configurations using the documented default, needrestart may restart affected services after unattended upgrades.

Or let it run in the cloud

If you want a YouTube playlist to keep running without maintaining an Ubuntu host and service, StreamNeo runs uploaded videos from the cloud. Upload your recording or build a playlist, add your YouTube stream key once, and go live. Nothing has to stay on at home; every slot streams the uploaded quality up to 4K 60fps at one flat price per slot, and StreamNeo automatically recovers if YouTube drops the stream. The first day is free with no card. Monthly pricing is $9.99 per month.

Start your free StreamNeo day.

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.

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