You can use FFmpeg on a Raspberry Pi 5 to repeat a sermon recording as the input to a YouTube Live stream: create a live event in YouTube Studio, give FFmpeg the recording and the event’s stream destination and key, then use FFmpeg’s input-loop option. Before relying on it for a service, rehearse with the actual media, output settings, Pi, and church network. Raspberry Pi’s published encoding paper does not establish that a particular Pi 5 setup will sustain your resolution, frame rate, cooling arrangement, or an all-day broadcast.
What this setup does—and what it does not do
FFmpeg reads a media file, encodes or passes through its audio and video as configured, and sends the result to YouTube Live. For continuous replay of one file, the basic pattern is a file input, an infinite input loop, and a YouTube ingest output. This is a live encoder feed, not a replay of a past YouTube broadcast: viewers watch a new live event, and the video is sent from the start of the file again each time it loops.
YouTube documents supported ingestion protocols and recommends RTMPS for secure delivery. Use the RTMPS server address and stream key shown for your event in YouTube Studio; do not copy an endpoint or stream key from an old command or another channel. See YouTube’s ingestion protocol comparison and RTMPS delivery guidance.
Prepare the sermon and the live event
Check the media file first
Use a recording you have permission to stream. Confirm that its sound and picture play correctly from beginning to end, that the ending does not contain an unwanted long silence or slate, and that the file is accessible to the account running FFmpeg. A loop restarts at the file boundary; it does not automatically create a polished transition between the end and beginning.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →#1 Best Overall
- 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.
Plan the output resolution and frame rate around the source recording and the upload available at the church. Upscaling a low-resolution sermon does not add detail, while choosing settings the Pi or internet connection cannot sustain can cause an unstable broadcast. If you need a playlist or a transition between several recordings, test that workflow separately rather than assuming a single-file loop handles it.
Create the YouTube Live event
- In YouTube Studio, create or schedule the live stream using the channel and visibility settings appropriate for the service.
- Open the event’s stream settings and select the encoder connection details. Copy the RTMPS ingest address and the stream key for this event.
- Keep the stream key private. Anyone who obtains it may be able to send a feed to the event. If it is exposed, replace or reset it in YouTube Studio before using it again.
- Leave the event available to monitor in YouTube Studio so you can check incoming video, audio, stream health, and any warnings during rehearsal and the service.
Choose YouTube-compatible output settings
YouTube’s current encoder settings guidance calls for constant bitrate, supports H.264, H.265/HEVC, and AV1 video, and lists AAC or MP3 audio. It recommends a two-second keyframe interval and says the interval should not exceed four seconds. For H.264, its recommended bitrate includes 5 Mbps for 1080p30 and 3 Mbps for 720p30; these are recommended settings, not guarantees of successful delivery on a particular connection.
| Example output | YouTube H.264 video bitrate recommendation | Keyframe interval at 30 fps | What to verify |
|---|---|---|---|
| 1080p30 | 5 Mbps | 2 seconds, or 60 frames | That the Pi sustains the encode and the church upload has dependable headroom. |
| 720p30 | 3 Mbps | 2 seconds, or 60 frames | That the source and chosen output remain stable through a representative rehearsal. |
The appropriate choice depends on the actual output and reliable upload capacity, not just the nominal internet plan. YouTube recommends constant bitrate. For an H.264 example, the command below sets a target bitrate and matching maximum rate; it also sets a two-second GOP at 30 fps. If you choose a different frame rate, recalculate the frame-based GOP value so it still represents two seconds, and test the resulting feed.
Rank #2
- 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.
Run a looping FFmpeg stream from the Pi
Install and verify FFmpeg
Install FFmpeg using the package method supported by your Raspberry Pi OS release, then check the installed version and available encoders:
ffmpeg -version
ffmpeg -encoders
Confirm that the build includes libx264 before using the example below. FFmpeg options and build capabilities can vary by installed version. Consult the FFmpeg documentation for the version on the Pi.
Start with a 1080p30 H.264 example
Replace /path/to/sermon.mp4 with the real file path. Replace RTMPS_INGEST_URL/STREAM_KEY with the RTMPS destination and key supplied for the YouTube event. Treat the combined destination as a secret and avoid saving it in a shared script or shell history.
Rank #3
- 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.
ffmpeg -stream_loop -1 -re -i /path/to/sermon.mp4 -c:v libx264 -preset veryfast -b:v 5M -maxrate 5M -bufsize 10M -g 60 -keyint_min 60 -sc_threshold 0 -pix_fmt yuv420p -c:a aac -b:a 128k -ar 44100 -f flv 'RTMPS_INGEST_URL/STREAM_KEY'
-stream_loop -1 tells FFmpeg to repeat the input indefinitely; -re reads the file at its playback rate rather than sending it as fast as the Pi can process it. The example encodes H.264 video with libx264, sets a 5 Mbps target and maximum rate, and uses a 60-frame keyframe interval for 30 fps. It encodes audio as AAC. The command does not force a resolution or frame rate: FFmpeg derives those from the input unless you add output filters or options. Confirm the actual stream format in the output log and YouTube Studio.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Scan for outdated or missing drivers - takes under a minute3Clear out junk files and repair common Windows errorsThe loop option is also illustrated in a community FFmpeg discussion, but the installed FFmpeg documentation and a test with your own file should govern your setup: community loop example.
Rank #4
- 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
720p30 alternative
If 720p30 is the more appropriate tested output, use YouTube’s 3 Mbps H.264 recommendation in place of the 5 Mbps values. For example, change -b:v 5M -maxrate 5M -bufsize 10M to -b:v 3M -maxrate 3M -bufsize 6M. Keep the two-second keyframe interval at 60 frames if the output is 30 fps. Confirm your actual output frame rate and resolution rather than assuming they match the label on the source file.
Keep the stream key out of shared logs and scripts
Putting the key directly in a command can expose it in shell history or process listings. For a real service, use a method appropriate to your environment to protect credentials, restrict access to the account and logs, and rotate the key if it is exposed. Do not paste the key into public support posts. If the command reports an authentication or connection error, first verify that the event is live and that the RTMPS address and key belong together.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Rehearse the complete setup before a service
A Pi 5 is not validated for a particular church’s livestream merely because Raspberry Pi has published an H.264 software-encoding performance paper. That paper describes a software encoding path on Raspberry Pi 5-series computers; it does not establish sustained performance for your media, chosen encode, resolution, frame rate, cooling, or full event duration. See Raspberry Pi’s H.264 encoding performance paper.
Recommended Free Tools
Best Value
- 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.
- Run a representative rehearsal from the actual Pi at the church’s actual network location. Use sermon audio and movement similar to the planned stream, as YouTube recommends.
- Let it run long enough to expose problems that may not appear in a brief connection check. For a service that will loop for hours, test a comparable duration before depending on the setup; a short successful test cannot prove uninterrupted all-day operation.
- Watch YouTube Studio’s stream health and messages while FFmpeg runs. Check that audio is continuous, video is stable, and the output settings are what you intended.
- Check for upload headroom and local encoding strain during the run. If health degrades, lower the output demand or resolve the network or encode bottleneck, then repeat the rehearsal.
- Plan who will monitor the live event and what they will do if the Pi, network, or YouTube connection fails. A loop setting repeats a file; it does not itself ensure recovery from every failure.
Troubleshooting common failures
| Symptom | Likely checks | What to try |
|---|---|---|
| YouTube does not receive a stream | Check the event status, RTMPS URL, stream key, network access, and FFmpeg’s connection error. | Copy the current event’s RTMPS details again, protect the key, and retry while the event is open. |
| Video arrives but the picture stutters or stream health degrades | Check whether encoding load or upload capacity is insufficient for the chosen output. | Test a lower-demand output such as 720p30 at YouTube’s recommended 3 Mbps H.264 bitrate, then verify stability in Studio. |
| Audio is missing, distorted, or stops at the boundary | Check that the source has an audio stream and listen through the full file, including its ending and restart. | Correct or replace the source if needed and repeat a full loop rehearsal. Confirm YouTube receives audio during the test. |
| The file plays once and exits | Check option placement and whether -stream_loop -1 appears before the input it should repeat. |
Use the documented input-loop option with the tested FFmpeg build, then test the actual file at its end boundary. |
FFmpeg cannot use libx264 |
The installed FFmpeg build may not include that encoder. | Check ffmpeg -encoders and install or select a build with the required encoder; do not assume another codec has the same Pi performance. |
Or let it run in the cloud
If you do not want a Pi and church internet connection to be responsible for keeping the encoder feed running, StreamNeo is a cloud service for looping uploaded videos to YouTube Live. Upload the sermon recording or build a playlist, add the YouTube stream key once, and go live. Nothing has to stay on at home; it plays uploaded video rather than broadcasting a camera feed.
- One flat price per slot for any uploaded quality up to 4K 60fps, with no re-encode or quality tiers.
- Automatic recovery if YouTube drops the stream.
- The first day is free with no card, one free day per account.
- Monthly: $9.99 per month.
For India, UPI and cards are available; card checkout is available worldwide. See StreamNeo or the pricing page. To try it, start the free first day.
Quick Recap
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.




