October 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 PCOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
Mountain View desk6 min

How to Run a Prerecorded YouTube Stream from a Raspberry Pi

Use YouTube Live and FFmpeg to loop a prerecorded video from a Raspberry Pi, with a command template, encoder settings, testing steps and troubleshooting advice.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

You can use a Raspberry Pi to send a prerecorded video to a YouTube Live event by running FFmpeg with the event’s server URL and stream key. To loop the file until you stop the encoder, use FFmpeg’s -stream_loop -1 input option. This is a do-it-yourself setup: the Pi, its power and network connection, and the encoding workload must remain available for the broadcast to continue.

What you need before you start

  • A YouTube channel with live streaming enabled. YouTube says first-time activation may take up to 24 hours.
  • A Raspberry Pi with a working network connection and an installed FFmpeg build that can read your video and publish using RTMPS.
  • A prerecorded video file accessible to the Pi, plus enough upload capacity for the stream you intend to send.
  • The server URL and stream key for the YouTube Live event. Treat the key like a password: anyone who has it may be able to stream to your event.

FFmpeg options, available encoders and performance depend on the Pi model, operating system, FFmpeg build, source file and network. The command below is an illustrative starting point, not a tested or universal Raspberry Pi configuration.

As an Amazon Associate I earn from qualifying purchases.

Create the YouTube Live event

  1. Open YouTube Studio’s encoder live-stream workflow and go to Live Control Room.
  2. Create a stream or schedule one. If live streaming is not enabled on the channel, enable it and allow time for activation; YouTube says first-time activation can take up to 24 hours.
  3. In the event’s stream settings, copy the server URL and stream key exactly as shown. Keep the key private, and avoid saving it in a script or command history that other users can read.

Prepare FFmpeg and the video

Check that FFmpeg is installed and inspect the media before streaming. For example, ffmpeg -version shows build details, and ffprobe -hide_banner "/path/to/video.mp4" can show the file’s streams and formats if ffprobe is included. Confirm the file path is correct and that the build can decode its video and audio. If it cannot, you may need to convert the file or use another compatible input.

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

When FFmpeg has to decode and re-encode a high-resolution or high-frame-rate source, that can be demanding for a Pi. The sources do not establish a safe performance threshold across Pi models. Test at the intended settings and watch CPU load, temperature and dropped frames before depending on the setup.

Start a looping stream with FFmpeg

Use this command as a template, replacing the input path, server URL and key with your own values:

#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
ffmpeg -re -stream_loop -1 -i "/path/to/video.mp4" 
  -c:v libx264 -preset veryfast -b:v 2500k -maxrate 2500k -bufsize 5000k 
  -pix_fmt yuv420p -g 60 -c:a aac -b:a 128k -ar 44100 
  -f flv "rtmps://YOUR_SERVER_URL/YOUR_STREAM_KEY"

-re asks FFmpeg to read the input at its native rate rather than as fast as it can; -stream_loop -1 loops the input indefinitely. FFmpeg documents both options. Put them before the input’s -i. To stream only once, remove -stream_loop -1.

The bitrate values in this example are illustrative, not a YouTube recommendation for every resolution or a guarantee that a Pi can encode at that rate. The command re-encodes to H.264 video and AAC audio; the source must be decodable and the installed FFmpeg build must include the selected encoder and output protocol. Check the event’s current guidance and the build’s capabilities before adopting different codecs or settings.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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

Choose settings that suit the file and connection

YouTube’s current live encoder settings guidance recommends RTMPS and constant bitrate (CBR), and recommends a two-second keyframe frequency, saying not to exceed four seconds. It lists H.264, H.265/HEVC and AV1 as supported video choices, and AAC or MP3 audio. Support in YouTube does not mean a particular Pi or FFmpeg build can encode every option efficiently; verify the encoder and test it on the actual system.

  • Resolution and frame rate: Choose a target the Pi can sustain and the upload connection can carry. If the source is already compatible, avoiding unnecessary re-encoding may reduce workload, but output compatibility still depends on the file and FFmpeg build.
  • Video bitrate: Set it for the chosen output and leave headroom in the upload connection for variation and other network use. No universal upload-speed or Pi-performance threshold is established for this setup.
  • Keyframes: With the example’s 30 fps output, -g 60 corresponds to a two-second interval. If you change the frame rate, adjust the GOP length to preserve the intended interval; do not exceed YouTube’s four-second guidance.
  • Audio: Check that the file has the expected audio stream and that playback is audible. The sample encodes AAC at 128 kb/s and 44.1 kHz; these are example command values, not a requirement for every source.

A community Raspberry Pi project, YouTube-Pi4-StreamMachine, reports using 854×480 at 30 fps for its own setup, citing a jittery uplink. That is one project’s configuration, not a recommended minimum or a guarantee for other Pi models or networks.

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

Test, monitor and stop the broadcast

  1. Start with a short test using video motion and audio similar to the intended broadcast. Check that FFmpeg connects and that the event appears in YouTube Live Control Room.
  2. Watch YouTube’s stream health and FFmpeg’s output for connection errors, dropped frames or encoding problems. YouTube recommends preflight testing and monitoring; a stream that starts is not proof it will remain stable.
  3. Once the test is stable, run the planned event and keep the Pi powered, cool and connected. A network interruption, power loss, thermal issue or encoding overload can stop the stream.
  4. To end the broadcast, stop FFmpeg. YouTube says the encoder starts sending the broadcast when it begins sending content, and stopping the encoder ends the sending process. Streams shorter than 12 hours are automatically archived after the encoder stops; do not rely on one continuous event as an indefinite archive beyond that documented limit.

Troubleshooting common failures

Symptom Likely cause What to check or do
YouTube does not receive a signal Incorrect event server URL or stream key, an inactive event, or an FFmpeg build without the needed RTMPS output support. Copy the URL and key again from the correct Live Control Room event, confirm the event is ready, and check FFmpeg’s build and error output.
FFmpeg cannot open the input Wrong path, inaccessible storage or an unsupported file format. Check the path and permissions; inspect the file with ffprobe if available. Convert it to a format the installed build can decode if necessary.
Video stutters or frames drop The Pi may be struggling to encode, or the connection may have insufficient or inconsistent upload capacity. Check CPU load, temperature, FFmpeg messages and YouTube stream health. Test a lower output resolution, frame rate or bitrate, and use a more stable network connection if available.
Stream stops unexpectedly Power or network interruption, thermal behavior, encoding overload, or an ingest connection failure. Review FFmpeg and YouTube status messages, check power, cooling and network stability, and repeat a representative preflight test. A local Pi setup does not itself provide automatic recovery from every interruption.
Picture works but audio is missing or wrong The file may have no audio stream, the wrong stream may be selected, or the audio codec could not be decoded. Inspect the input’s streams with ffprobe and test playback before the live event. Confirm FFmpeg’s audio output in the command and monitor the event’s audio.

What a Raspberry Pi setup can and cannot promise

Local FFmpeg gives you direct control over the file, encoding choices and stream key without requiring a dedicated hardware encoder. It also leaves reliability dependent on the Pi’s capability and its local power and network. YouTube describes software and standalone hardware encoder options, including hardware that can schedule prerecorded media, but that equipment is not necessary for this project. The available evidence does not establish a best Pi model, a universal resolution or a guaranteed configuration.

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 want the prerecorded video to keep running without leaving a Pi or home computer on, StreamNeo is a YouTube-only cloud service: upload your 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. The stream can run with your computer off, and StreamNeo automatically recovers if YouTube drops the stream. Every slot streams the uploaded quality up to 4K 60fps at one flat price per slot, with no re-encoding or quality tiers. The first day is free with no card; the monthly plan is $9.99 per month. In India, UPI and cards are accepted; card checkout is available worldwide. See StreamNeo for details. Start your free first day with StreamNeo.

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

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 the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
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.