Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
VGSources
church streaming

How to Run a 24/7 YouTube Stream of Church Sermons with systemd on Ubuntu

A practical Ubuntu walkthrough for looping prerecorded sermons to YouTube with FFmpeg and systemd, including stream-key safety, monitoring, troubleshooting, and archive planning.

By VGSources Team 7 min read
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

You can loop prerecorded sermons to YouTube from an Ubuntu host with FFmpeg, then use a systemd service to start FFmpeg at boot and restart it after a process exit. That keeps the encoder running without manual relaunches; it does not guarantee YouTube is receiving healthy video and audio. Test the broadcast in YouTube Studio and monitor both YouTube stream health and the local service.

What you need before setting up the stream

  • A YouTube channel with live streaming enabled. First-time activation can take up to 24 hours, so enable it well before a planned service or launch. YouTube Help: live streaming.
  • An Ubuntu machine or Linux host that can stay on, with the sermon media available locally, enough CPU for the selected encoding settings, and stable outbound upload capacity. The exact host requirements depend on the media, resolution, encoding choices, and network.
  • FFmpeg and systemd. Check the flags against the FFmpeg version installed on your host; options can differ between builds.
  • Permission to rebroadcast every part of the recording, including sermon audio, music, artwork, and other third-party material. Technical configuration does not establish that you have the necessary rights.

Prepare YouTube Live and protect the stream key

  1. In YouTube Studio, create or select the live stream and locate its stream key and ingest URL. YouTube’s encoder setup uses these details to connect an external encoder. See YouTube’s live encoder guide.
  2. Keep the stream key private, as you would a password. Do not commit a real key to a public script or repository, or expose it in screenshots or shared logs. Anyone with access to it may be able to send a broadcast to your stream.
  3. Choose the video and audio that the stream should carry. This guide covers looping prerecorded media, not broadcasting a live camera feed.

Choose sensible FFmpeg settings

Set resolution, frame rate, and bitrate to match the source and a measured upload connection. YouTube’s encoder guidance recommends a speed test, constant bitrate, a two-second keyframe interval (do not exceed four seconds), and RTMPS for encrypted transport. It supports RTMP/RTMPS ingest and lists H.264, H.265, and AV1, with frame rates up to 60 fps. See YouTube’s encoder settings.

For a sermon recording with a still image or simple slides, a modest output may be sufficient, but no one bitrate or preset is right for every source and connection. Confirm that speech is clear and the image is stable in an actual test broadcast. The following command is an example pattern, not a tested universal command: adapt the paths, codecs, bitrates, frame rate, and output URL to the media and installed FFmpeg build.

ffmpeg -re -stream_loop -1 -i /srv/sermons/sermon.mp4 
  -c:v libx264 -preset veryfast -b:v 2500k -maxrate 2500k -bufsize 5000k 
  -r 30 -g 60 -keyint_min 60 -sc_threshold 0 
  -c:a aac -b:a 128k -ar 44100 
  -f flv "rtmps://YOUR_INGEST_URL/YOUR_STREAM_KEY"

In this example, -stream_loop -1 asks FFmpeg to repeat the input indefinitely; input options such as this belong before the corresponding -i. The output flags select H.264 video, AAC audio, a 30 fps output, and a 60-frame GOP (two seconds at that frame rate). The example bitrate is only a starting point, not a YouTube requirement or a promise of fit. Replace the illustrative ingest URL and key with the values YouTube gives you. FFmpeg’s documentation explains its input/output structure and option scoping: FFmpeg documentation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

Do not copy the sample blindly if the source has a different frame rate, aspect ratio, audio layout, or codec needs. Check the installed FFmpeg’s available encoders and options, and use a test broadcast to identify scaling, audio, or upload problems before relying on the service.

Create a systemd service for FFmpeg

Run the service as a dedicated, unprivileged Linux account rather than root. Store media and configuration in paths that account can access. The unit below is a template: update its user, group, working directory, media path, and FFmpeg arguments before using it.

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
sudo nano /etc/systemd/system/sermon-stream.service
[Unit]
Description=Prerecorded sermon stream to YouTube
Wants=network-online.target
After=network-online.target

[Service]
Type=simple
User=sermonstream
Group=sermonstream
WorkingDirectory=/srv/sermons
ExecStart=/usr/bin/ffmpeg -re -stream_loop -1 -i /srv/sermons/sermon.mp4 -c:v libx264 -preset veryfast -b:v 2500k -maxrate 2500k -bufsize 5000k -r 30 -g 60 -keyint_min 60 -sc_threshold 0 -c:a aac -b:a 128k -ar 44100 -f flv rtmps://YOUR_INGEST_URL/YOUR_STREAM_KEY
Restart=always
RestartSec=10

[Install]
WantedBy=multi-user.target

The Restart=always and RestartSec=10 lines illustrate a typical restart policy and delay; choose a policy appropriate to your operation. A restart can recover from a process exit, but it cannot fix every network outage, rejected stream key, YouTube-side issue, or bad media file. Protect the key in the unit file: restrict file access, avoid publishing the unit, and consider a separately protected configuration mechanism suitable for your deployment.

Enable it at boot and start it now

  1. After saving the unit, have systemd reload unit definitions: sudo systemctl daemon-reload.
  2. Enable startup at boot and start the service for the current session: sudo systemctl enable --now sermon-stream.service. Enabling and starting are distinct operations; systemd’s unit documentation describes how enabling connects a unit to a boot target: systemd.unit.
  3. Check the current state with sudo systemctl status sermon-stream.service.
  4. Review recent service output with sudo journalctl -u sermon-stream.service -n 100 --no-pager. Follow new log entries while diagnosing with sudo journalctl -u sermon-stream.service -f.

Test the broadcast and monitor its health

Before depending on the setup, run a test with representative sermon audio and video. YouTube recommends testing before going live and monitoring stream health in its encoder guidance. Open the stream preview and health indicators in YouTube Studio; confirm that both picture and sound arrive as intended. A service showing as active locally does not prove the platform is receiving a usable broadcast.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
  • Check YouTube Studio for the incoming preview and stream-health warnings.
  • Check the systemd status and journal for FFmpeg exits, input errors, authentication failures, or connection problems.
  • Check the host’s actual outbound upload capacity under realistic network conditions. If the connection cannot sustain the output, reduce the bitrate or resolution and test again.
  • When changing the command in the unit file, reload systemd and restart the service: sudo systemctl daemon-reload, then sudo systemctl restart sermon-stream.service.

Plan for sermon archives separately

YouTube Help says streams under 12 hours are automatically archived. A continuous 24/7 event is longer than that stated threshold, so do not assume it will produce a complete, convenient archive of each sermon. If complete recordings matter, schedule separate broadcasts intentionally or keep a separate local recording and retention process. YouTube’s Live API also documents archive and DVR settings, whose behavior depends on the stream configuration: YouTube LiveBroadcasts API reference.

Troubleshooting common failures

Symptom Likely cause What to check or do
Service fails immediately Wrong FFmpeg path, missing media, invalid option for the installed build, or file permissions. Read journalctl -u sermon-stream.service; verify /usr/bin/ffmpeg, the input path, and access for the configured service user. Check options against the installed FFmpeg build.
YouTube does not receive the stream Incorrect ingest URL or stream key, network failure, or an unavailable live setup. Verify the current URL and key in YouTube Studio, keep the key private, and inspect both the FFmpeg journal and YouTube Studio. If live streaming was just enabled, activation may still be pending.
Video or audio is missing or poor Unsupported or unsuitable encoding settings, media issues, insufficient CPU, or inadequate upload capacity. Test with representative media; verify codecs, frame rate, audio stream, bitrate, and YouTube’s preview and health status. Lower output demands if the host or connection cannot sustain them.
FFmpeg keeps restarting The process is exiting because of an input, configuration, or upstream problem; systemd is retrying it. Read the latest journal entries and fix the underlying cause. A restart policy alone does not restore a healthy YouTube broadcast.
The stream is live, but the archive is incomplete or unavailable A continuous event exceeds YouTube Help’s stated under-12-hour automatic-archive threshold, or archive settings affect availability. Use deliberately bounded broadcasts or maintain a separate local recording process if complete archives are required.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

When to self-host and when to use a cloud service

FFmpeg with systemd suits a church that wants direct control and can maintain an always-on Ubuntu host, its media paths, network, service configuration, and monitoring. A church-owned machine may avoid a new hosting bill but depends on local power and connectivity; a VPS can provide a remotely hosted environment, but media access, storage, upload capacity, cost, and administration still need planning. No particular server size or provider is right without knowing the workload and connection.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

YouTube’s encoder guide also lists Gyre as a cloud-based option for 24/7 prerecorded-video streaming. Check its current pricing, storage and scheduling limits, archive handling, availability, and service terms directly before choosing it; those details are not established here.

Or let it run in the cloud

With StreamNeo, upload a sermon recording or build a playlist, add your YouTube stream key, and go live. StreamNeo loops uploaded videos from the cloud, so nothing has to stay on at the church or at home. Each slot streams the upload as made, up to 4K 60fps, at one flat price per slot; it can automatically recover if YouTube drops the stream. The first day is free with no card. Monthly billing is $9.99 per month. This is for prerecorded uploads to YouTube, not a live camera feed. Start a free day with StreamNeo.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

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 Patch Notes

Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

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.