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

To prepare prerecorded video for an always-on YouTube stream from a Raspberry Pi, check that the file plays correctly and that you have permission to stream it, choose a YouTube-compatible output profile, then use FFmpeg to pace and loop the file into YouTube Live. In FFmpeg, put -re and -stream_loop -1 before the input filename. Test the exact file, command, Pi, and network before leaving the setup unattended: continuous encoder output does not guarantee that YouTube will keep one broadcast open indefinitely.

How do I prepare and loop videos for an always-on YouTube stream on a Raspberry Pi? The practical answer is to prepare a reliable source file, match its output to YouTube’s ingest guidance and your upload capacity, and monitor the encoder and Live Control Room.

1. Check the video before you stream it

Choose the video and audio you want viewers to hear and see, and make sure you have permission to stream both. This is a practical rights check, not legal advice. A file that plays locally is not automatically cleared for a public live broadcast.

Play the entire file before using it as a loop. Check that the picture and sound are present, that the end is not cut off, and that the beginning and ending will make an acceptable transition when repeated. Note the file’s resolution, frame rate, audio, and codecs. Choose media the target Pi can handle at the intended stream settings.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
CanaKit Raspberry Pi 5 Starter Kit PRO - Turbine Black (128GB Edition) (8GB RAM)
  • Includes Raspberry Pi 5 with 2.4Ghz 64-bit quad-core CPU (8GB RAM)
  • Includes 128GB Micro SD Card pre-loaded with 64-bit Raspberry Pi OS, USB MicroSD Card Reader
  • CanaKit Turbine Black Case for the Raspberry Pi 5
  • CanaKit Low Noise Bearing System Fan
  • Mega Heat Sink - Black Anodized

If the prepared file already matches the output you intend to send, avoid adding a real-time conversion step without a reason. Re-encoding adds work for the Pi; whether a particular board can sustain that workload depends on the file and settings, so test any conversion workflow on the intended device.

2. Choose YouTube output settings

YouTube’s current encoder guidance supports RTMP or RTMPS ingest, H.264, H.265, or AV1 video, constant bitrate encoding, and AAC or MP3 audio. For a straightforward SDR H.264 stream, its recommended video bitrates are 8 Mbps at 720p30 and 14 Mbps at 1080p30. These are YouTube recommendations, not a guarantee that your Pi or internet connection can sustain those rates.

Output choice YouTube H.264 recommendation What to consider
720p30 8 Mbps video Requires less upload headroom than the 1080p30 recommendation; use it if it provides enough detail for the content.
1080p30 14 Mbps video Provides more resolution, but requires more sustained upload capacity and may add encoding load if the Pi must convert the source.

YouTube recommends a two-second keyframe interval and says not to exceed four seconds. Its advanced audio recommendations include 128 Kbps stereo audio at a 44.1 kHz sample rate. Treat these as target settings and verify the actual stream in Live Control Room. A speed test is useful, but a representative live test is more informative because it exercises the file, encoder, audio, and network together. YouTube’s live encoder settings guidance says to test before starting a live stream.

Rank #2
CanaKit Raspberry Pi 5 16GB Starter Kit PRO - Turbine Black (128GB Edition) (16GB RAM)
  • Includes Raspberry Pi 5 16GB with 2.4Ghz 64-bit quad-core CPU (16GB RAM)
  • Includes 128GB Micro SD Card pre-loaded with 64-bit Raspberry Pi OS, USB MicroSD Card Reader
  • CanaKit Turbine Black Case for the Raspberry Pi 5
  • CanaKit Low Noise Bearing System Fan
  • Mega Heat Sink - Black Anodized

3. Loop and pace the file with FFmpeg

FFmpeg documents -stream_loop -1 as an infinite input loop, and -re reads a file at its native frame rate, which is useful when sending file input as live output. These are input options, so put them before the relevant input file argument.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
ffmpeg -re -stream_loop -1 -i "VIDEO_FILE" [VIDEO_AND_AUDIO_OPTIONS] -f flv "RTMP_SERVER_URL/STREAM_KEY"

Replace VIDEO_FILE with the local media path and replace the destination placeholders with the server URL and private stream key from YouTube Live Control Room. The bracketed options are deliberately not a universal command: the correct codec, bitrate, keyframe, audio, and muxing options depend on the input, the installed FFmpeg build, and whether you are copying or re-encoding streams. Do not run the example unchanged, and do not publish a real stream key in a tutorial, screenshot, or public repository. See the FFmpeg documentation for option behavior.

If you re-encode, configure constant bitrate output and the selected resolution, frame rate, bitrate, and keyframe interval. If the source is already suitable, determine whether stream copy is appropriate for the chosen output and test it rather than assuming either approach will work. Confirm that the Pi does not fall behind while processing the actual media.

Rank #3
CanaKit Raspberry Pi 5 Essentials Starter Kit (4GB RAM)
  • CanaKit Raspberry Pi 5 Essentials Starter Kit

4. Connect the encoder to YouTube Live

  1. In YouTube Studio, create or select a stream in Live Control Room.
  2. Copy the server URL and stream key shown for that stream into your encoder’s destination settings. Keep the key private.
  3. Start FFmpeg on the Pi and wait for the stream preview to appear in Live Control Room.
  4. For a scheduled broadcast, use Live Control Room’s Go Live control after the preview appears.

YouTube says streams under 12 hours are automatically archived. Its cited guidance does not establish what happens to broadcasts longer than 12 hours, so do not assume that an encoder sending continuously means one YouTube broadcast or archive will continue indefinitely. Plan and test the broadcast lifecycle separately from the FFmpeg input loop. Follow YouTube’s encoder setup instructions for the current Live Control Room workflow.

5. Test the complete setup before leaving it unattended

Run a representative test that includes motion and audio, and observe both the Pi and the Live Control Room. Verify these points:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • The stream preview appears and remains healthy.
  • Picture and audio are present, and the audio does not stop when the video reaches its end and loops.
  • The loop transition is acceptable and the encoder keeps pace with real time.
  • Your upload connection remains stable at the chosen output rate.
  • YouTube’s stream-health messages do not show an issue requiring a change to the settings or connection.

A test on one file and network does not establish reliability under different conditions. Repeat the test after changing the media, output profile, FFmpeg command, Pi, or internet connection.

Rank #4
SANOOV Raspberry Pi 5 4GB Kit, 4GB RAM Single Board Computer with Active Cooler and ABS Case, Complete Raspberry Pi 5 Starter Kit for IoT Robotics Retro Gaming
  • All-in-One Complete Kit: This SANOOV RPi 5 bundle comes with Raspberry Pi 5 4GB RAM single board, active cooler, durable ABS case and screwdriver. No extra parts needed, ready to use right out of the box for beginners and hobbyists
  • Powerful Single Board Computer: Equipped with 4GB RAM and high-performance processor, delivers fast running speed for 4K playback, AI projects, programming and daily computing tasks. SANOOV for raspberry pi 5 4GB is equipped with broadcom 64 quad-core Arm Cortex A76 processor with gigabit ethernet and upgraded with IEEE 802.11ac Wi-Fi, Bluetooth 5.0 dual-band 2.4Ghz and 5Ghz and Power Over Ethernet (POE). Upgrading delivers 2-3 x speed vs Pi 4, redefining the experience
  • Efficient Active Cooler: Effectively lowers operating temperature and prevents performance throttling. Runs quietly even under long-time heavy load, ensures stable operation all day long. SANOOV RPi 5 4GB kit offer an active cooler, which combines an aluminium heatsink with a high-performance PWM fan. Active cooler is fully compatible with the Pi OS, which can effectively reduce the temperature of RPi5 and ensure its good performance during long-term high load operation
  • Sturdy ABS Protective Case: Well-fitted for Raspberry Pi 5 board, can be secured with 4 screws to effectively protect the Pi 5 motherboard from damage, reserves full access to all ports and buttons. SANOOV uses ABS material to produce the case, which has a softer texture and feel. Meanwhile, SANOOV case adopts a layered design for easy disassembly and installation. (Tip: The Case cannot install M.2 HAT Add on Board and Solid State Drive!)
  • Wide Application & Full Compatibility: Seamlessly compatible with official OS and mainstream peripheral accessories for Raspberry Pi 5. Whether you are a beginner, student, electronics hobbyist or professional developer, this all-in-one kit meets your diverse needs. It excels in IoT projects, robotics design, retro gaming devices, home media servers and other DIY creations. Backed by a large global community, you can easily find guides, technical support and shared projects online

Raspberry Pi model and encoding considerations

Raspberry Pi 5 uses software video encoders. Raspberry Pi documents a --low-latency option for rpicam-vid that outputs frames more quickly, with a small coding-efficiency cost and a possible slight reduction in maximum frame rate; its documentation says Pi 5 can still easily achieve 1080p30. This describes Raspberry Pi’s camera utility, not a benchmark of FFmpeg looping prerecorded files. It does not establish a minimum Pi model or guarantee performance for your file and command. Test the exact workload on the target board. See the Raspberry Pi camera software documentation.

Troubleshooting common failures

No preview appears in Live Control Room

  • Check that FFmpeg is running and that its output destination uses the server URL and stream key for the selected YouTube stream.
  • Check the Pi’s network connection and FFmpeg output for connection or muxing errors. Keep the stream key private while troubleshooting.

The stream stutters, falls behind, or loses health

  • Check sustained upload capacity with the chosen bitrate in mind; a brief speed-test result does not guarantee a stable stream.
  • Try a lower-demand profile, such as 720p30 at YouTube’s 8 Mbps H.264 recommendation rather than 1080p30 at 14 Mbps, if the connection or encoding workload cannot sustain the higher target.
  • If the Pi is re-encoding, test whether it can process the specific file at the selected resolution and frame rate. The Pi 5 camera-encoder documentation is not proof of FFmpeg file-transcoding performance.

The video repeats but audio does not, or the loop is jarring

  • Play the source from beginning to end and verify that the audio track is present and runs for the intended duration.
  • Check the transition at the file boundary. A loop repeats the source; it does not automatically make the ending blend into the beginning.
  • Retest after changing the source or audio settings, including the recommended 128 Kbps stereo and 44.1 kHz sample rate if those suit the material.

The broadcast stops even though FFmpeg is still looping

FFmpeg’s input loop controls playback of the file, not YouTube’s broadcast lifecycle. Check Live Control Room and the encoder connection. Since YouTube documents automatic archiving for streams under 12 hours but the cited guidance does not establish behavior beyond that duration, do not treat an infinite file loop as proof of an indefinitely open broadcast.

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

Or let it run in the cloud

If you would rather not keep a Raspberry Pi and home connection running, StreamNeo is a cloud service for keeping a YouTube channel live from uploaded videos. Upload a recording or build a playlist, add your YouTube stream key once, and go live. It loops uploaded video from the cloud; it does not stream from a camera. Your computer can be off, it supports video as uploaded up to 4K 60fps at one flat price per slot, and it can recover automatically if YouTube drops the stream. The first day is free with no card (one free day per account).

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
RasTech Raspberry Pi 5 8GB Kit with Active Cooler and Pi5 Case
  • 【What you Get】You will get 1*Pi 5 8GB Single Board,1*RasTech Case,1*Active Cooler,1*Screwdriver,1*Installation instructions,12-month free warranty, lifetime service, 24-hour prompt and friendly response.
  • 【More Connectors】There are two USB 3.0 ports(5Gbps simultaneously) and two USB 2.0 ports, which triple total bandwidth ,support any combination of up to two cameras or displays. Peak SD card performance is doubled through support for the SDR104 high-speed mode. It provides a smooth desktop experience for you. Offer Gigabit Ethernet and a PCIe interface, along with dual-band Wi-Fi and Bluetooth 5.0/BLE wireless capability. The RasTech Pi 5 Kit use the new 27W 5.1V 5A USB-C power connector.
  • 【 Support Dual 4Kp60 Display 】Each of the two microHDMI sockets can control a 4K display at 60 Hertz, now support HDR, offering super HD video for media streaming projects. RPi 5 is the first RPi model that comes with a PCI Express port (PCIe 2.0 x1 with 500 MB/s) to attach SSDs (requires separate M.2 HAT).
  • 【 Excellent Chips And Applications】Pi 5 is a full-size Pi computer using silicon built in-house at Pi. The RP1 “southbridge” provides the bulk of the I/O capabilities for Pi 5. Pi 5 is more friendly and convenient in the development of Internet of Things, Web development, machine identification, automatic control and other electronic equipment applications and network.
  • 【 Faster CPU, Better GPU 】 Pi 5 features a Broadcom BCM2712 64-bit quad-core Arm Cortex-A76 processor running at 2.4GHz, it delivers a 2–3× increase in CPU performance relative to RaspberryPi 4. The 800MHz VideoCore VII GPU is compatible to OpenGL ES 3.1 and Vulkan 1.2, substantial uplift in graphics performance. Pi 5 Offers lightning-fast CPU speed, a PCI Express interface, a Real Time Clock (RTC) and a power button and runs significantly cooler than Pi 4.

Every slot includes one always-on stream, 10 GB storage per slot pooled across active slots, 24/7 looping and playlists, automatic recovery if YouTube drops, and support from the StreamNeo team. The same product is included on each plan; only the billing length changes. Monthly: $9.99 per month.

Learn about StreamNeo, or start the free first day.

Frequently Asked Questions

Can I use a Raspberry Pi camera instead of a prerecorded file with this FFmpeg loop?

The workflow here is for prerecorded files. Raspberry Pi’s camera utility and its encoding notes are separate from this file-loop setup.

Does YouTube automatically archive an always-on stream forever?

YouTube’s stated automatic-archive guidance covers streams under 12 hours; it does not establish archive behavior for longer broadcasts.

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

Quick Recap

Bestseller No. 1
CanaKit Raspberry Pi 5 Starter Kit PRO - Turbine Black (128GB Edition) (8GB RAM)
CanaKit Raspberry Pi 5 Starter Kit PRO - Turbine Black (128GB Edition) (8GB RAM)
Includes Raspberry Pi 5 with 2.4Ghz 64-bit quad-core CPU (8GB RAM); CanaKit Turbine Black Case for the Raspberry Pi 5
$259.95
Bestseller No. 2
CanaKit Raspberry Pi 5 16GB Starter Kit PRO - Turbine Black (128GB Edition) (16GB RAM)
CanaKit Raspberry Pi 5 16GB Starter Kit PRO - Turbine Black (128GB Edition) (16GB RAM)
Includes Raspberry Pi 5 16GB with 2.4Ghz 64-bit quad-core CPU (16GB RAM); CanaKit Turbine Black Case for the Raspberry Pi 5
$419.99
Bestseller No. 3
CanaKit Raspberry Pi 5 Essentials Starter Kit (4GB RAM)
CanaKit Raspberry Pi 5 Essentials Starter Kit (4GB RAM)
CanaKit Raspberry Pi 5 Essentials Starter Kit
$189.99

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.