Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober 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
Church streaming

How to Shuffle a Church Sermon Folder in FFmpeg and Stream It on YouTube Live

A practical FFmpeg workflow for shuffling a church sermon folder into one YouTube Live program, with encoder settings, key protection, and fixes for common problems.

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

To play church sermons from a folder in random order on YouTube Live, shuffle the filenames into an FFmpeg concat list, then send that list to YouTube’s ingest server. The method below works best when the videos share compatible streams, codecs, and time bases. It runs one shuffled pass and stops when the list ends; continuous rotation needs a separate restart loop.

Before you start

  • Confirm live streaming is enabled for the church’s YouTube channel, then create or schedule a live event in YouTube Live Control Room.
  • Install an FFmpeg build with the required input support and the libx264 encoder. The exact version and available encoders depend on how FFmpeg was installed.
  • Put only the sermon files you want to stream in a dedicated directory. Keep the generated playlist elsewhere so it cannot be included as an input by mistake.
  • Check that the church has the rights needed to stream every part of each recording, including music, slides, and other included material.
  • Have a stable upload connection with enough sustained capacity for the chosen video bitrate plus headroom.

YouTube’s live encoder guidance and interface can change. Check the current settings in Live Control Room before a broadcast.

Check whether the sermon files are compatible

The simplest concat-demuxer workflow does not re-encode the input files, so it is suitable only when the files have matching streams, codecs, and time bases. Different containers or encoding settings can cause errors, playback interruptions, or poor transitions. FFmpeg’s concat documentation describes the matching-input requirement: FFmpeg concat demuxer documentation.

If the archive is mixed, normalize the files to a consistent format before creating the playlist, or use an approach that decodes and re-encodes them into a single output format. Test the transitions between representative files; do not assume a mixed folder will concatenate cleanly.

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.

Create a shuffled playlist and send it to YouTube

This Bash example is for Linux or macOS. It uses find with null-delimited filenames and GNU shuf, which is commonly available on Linux. On macOS, install GNU coreutils or substitute a platform-appropriate shuffle command such as sort -R. This is an illustrative implementation, not a tested command; replace the directory and encoding settings to fit your files and connection.

The example assumes filenames do not contain line breaks or single quotes. If filenames include those characters, use a playlist generator that correctly escapes concat-demuxer paths or rename files to a controlled naming scheme.

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.
#!/usr/bin/env bash
set -euo pipefail

SERMON_DIR="/path/to/sermons"
PLAYLIST="/tmp/sermons-shuffled.ffconcat"

find "$SERMON_DIR" -maxdepth 1 -type f 
  ( -iname '*.mp4' -o -iname '*.mov' -o -iname '*.mkv' ) -print0 
  | shuf -z 
  | while IFS= read -r -d '' file; do
      # Basic quoting only; see filename caveat above.
      printf "file '%s'n" "$file"
    done > "$PLAYLIST"

# Get the RTMPS server URL and stream key from YouTube Live Control Room.
# Keep the key out of shared scripts, repositories, chats, and screenshots.
read -r -p 'YouTube RTMPS destination (URL plus stream key): ' DESTINATION

ffmpeg -re -f concat -safe 0 -i "$PLAYLIST" 
  -c:v libx264 -preset veryfast -pix_fmt yuv420p 
  -r 30 -g 60 -keyint_min 60 -sc_threshold 0 
  -b:v 6M -maxrate 6M -bufsize 12M 
  -c:a aac -b:a 128k -ar 44100 
  -f flv "$DESTINATION"
  1. Set the input directory and playlist path. Change SERMON_DIR to the folder containing the recordings. The playlist is written under /tmp, outside the sermon folder.
  2. Generate the shuffled list. The pipeline finds MP4, MOV, and MKV files directly inside the directory, shuffles them, and writes their paths as concat-demuxer entries. It does not search subdirectories.
  3. Get the ingest destination from YouTube. In Live Control Room, select or create the stream and copy its server URL and stream key. Treat the key like a password; do not put a real key into a public script. The example prompts for a destination at runtime, but anyone who can see the terminal input or process environment may still expose it, so use a secure workflow appropriate to your setup.
  4. Run FFmpeg and inspect the preview. The command paces file reading in real time, encodes H.264 video and AAC audio, packages the output as FLV, and sends it to the destination. Confirm the preview and stream health in Live Control Room before making the event public.

-safe 0 allows absolute paths in this generated playlist. Only use a playlist created from a trusted directory; do not feed untrusted concat lists to FFmpeg. FFmpeg’s concat demuxer documentation explains the list format and safe-path option: https://ffmpeg.org/ffmpeg-formats.html#concat.

Choose encoder settings for the connection

The command uses illustrative settings, not a universal preset. YouTube’s current encoder guidance lists H.264 at 5–14 Mbps for 1080p30 and 6–17 Mbps for 1080p60. It recommends CBR, a two-second keyframe interval (no more than four seconds), AAC or MP3 audio, and 128 Kbps stereo audio at 44.1 kHz. The sample’s 6 Mbps video bitrate is within the listed 1080p30 range, but choose a rate appropriate to the content and the upload connection. These are YouTube configuration recommendations, not independent performance measurements. See YouTube’s encoder settings, bitrates, and resolutions.

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.
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.

The sample fixes output to 30 fps and sets a 60-frame GOP, corresponding to a two-second keyframe interval at that frame rate. If you change the frame rate, review the keyframe settings as well. Select a resolution and bitrate your connection can sustain, and follow YouTube’s recommendation to leave 20% upload-bandwidth headroom. YouTube advises testing with representative audio and motion, then monitoring stream health and warnings during the event: encoder guidance and live streaming tips.

YouTube supports RTMP and RTMPS ingest and recommends RTMPS when supported. Use the exact server URL shown for the event rather than guessing or reusing a destination from an old setup. The current protocol and encoder options are listed in YouTube’s encoder guidance.

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

Configure the YouTube event and protect its key

  1. Open YouTube Live Control Room and create or select the live stream or scheduled event.
  2. Copy the server URL and stream key provided for that stream into your FFmpeg destination configuration.
  3. Start FFmpeg, then check the event preview for image, sound, transitions, and stream-health messages.
  4. Start or publish the event only after the preview is correct and the connection is stable.

YouTube describes stream keys as password-like credentials and provides a way to reset an exposed key. Never publish the key in a repository, screenshot, chat, or article. If it is compromised, reset it in Live Control Room and update the encoder configuration. See YouTube’s live stream settings help.

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

Understand what happens when the playlist ends

This command plays the shuffled list once. When the final file ends, FFmpeg exits; -re paces input in real time but does not make the playlist repeat. To keep a rotation going, a supervisor can regenerate a shuffled list and restart FFmpeg after the pass finishes. That adds restart handling and creates a new order each time, so test transitions and failure behavior before relying on an unattended service.

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.

The output is one continuous live program, not separate YouTube video pages for each sermon. It does not automatically create chapter navigation for the individual files.

Troubleshooting

  • FFmpeg rejects the concat input or errors between files: Check that the files have matching streams, codecs, and time bases. Normalize or re-encode incompatible files, then test transitions again.
  • The playlist is empty or omits files: Confirm the path in SERMON_DIR, check that files are directly inside that directory, and verify extensions match the filters. Add other extensions deliberately if needed.
  • The playlist fails on a filename: The sample does not robustly escape single quotes or line breaks. Rename files or replace the simple generator with one that safely quotes concat-demuxer paths.
  • YouTube reports incorrect stream settings or shows no preview: Verify the server URL and stream key in Live Control Room, confirm the output format and encoder settings, and check FFmpeg’s error output. Compare resolution, frame rate, bitrate, keyframe interval, and audio settings with YouTube’s current encoder guidance.
  • The stream drops or becomes unstable: Check the sustained upload rate and connection reliability. Reduce bitrate or resolution if necessary, preserve YouTube’s recommended 20% headroom, and watch Live Control Room stream-health messages.
  • The event is restricted or a rights notice appears: Stop or replace the affected content and resolve the issue through YouTube’s applicable process. A church-owned recording can still contain music, slides, or other material for which the church lacks streaming rights.
  • The stream stops after the last sermon: That is expected for a single finite concat list. Use a tested supervisor to regenerate and restart, or choose a service designed to keep an uploaded playlist running.

Rights and YouTube policy

Before scheduling, confirm permission for every audio and video element in the recordings, including embedded music and slides. YouTube requires live content to follow its Community Guidelines and Terms of Service; active copyright strikes and matches with other copyrighted live broadcasts can lead to live-stream restrictions. Review YouTube’s live-streaming restrictions help, and be prepared to stop or replace content if YouTube reports a claim or policy issue.

Or let it run in the cloud

If you would rather not keep a computer and connection running at the church, StreamNeo is a cloud service for keeping a YouTube channel live from uploaded videos. Upload the recordings or build a playlist, add the YouTube stream key once, and go live. It does not stream from a camera.

  • Nothing has to stay on at home or at the church; the stream runs from the cloud.
  • Any uploaded quality up to 4K 60fps streams as made, at one flat price per slot, with no re-encode or quality tiers.
  • Automatic recovery is included if YouTube drops the stream.
  • The first day is free with no card required, one free day per account.

Monthly: $9.99 per month. Start your free day with StreamNeo.

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

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 *

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.

More from the Screening Room

Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

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.