You can run a Raspberry Pi headlessly—without a monitor, keyboard, or mouse—and use FFmpeg to loop a local video into YouTube Live. Prepare Raspberry Pi OS Lite and remote access with Raspberry Pi Imager, connect to the Pi over SSH, then send a test stream using the RTMPS address and stream key shown in YouTube Studio. The exact video quality a Pi can encode depends on its model, FFmpeg build, source file, and upload connection, so test the complete setup before leaving it unattended.
What you need before you start
- A Raspberry Pi, a microSD card, a power supply, and another computer to prepare the card and connect over SSH.
- A network connection for the Pi. You can use Ethernet or Wi-Fi; check that your particular Pi model and wireless adapter support the Wi-Fi band you plan to use.
- A local video file the channel is entitled to stream, with enough free storage on the Pi.
- A YouTube channel that is able to go live. Confirm live access in YouTube Studio before building an unattended setup; channel eligibility and restrictions are account-dependent.
For a long-running stream, consider whether your local power and internet service can stay available. Neither the Pi nor FFmpeg can compensate for a power cut or an unavailable upstream connection.
As an Amazon Associate I earn from qualifying purchases.
Prepare Raspberry Pi OS for headless access
Raspberry Pi recommends Raspberry Pi OS Lite for headless use. Raspberry Pi Imager can install the OS and configure a user, Wi-Fi, and remote access before the first boot. See the Raspberry Pi headless setup documentation for its current imaging and connection instructions.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →- On another computer, open Raspberry Pi Imager and choose the Raspberry Pi model and Raspberry Pi OS Lite.
- Open the Imager customization options and set a username and password. If using Wi-Fi, enter the network name and password, and select the appropriate country setting.
- Enable SSH or Raspberry Pi Connect in the customization options. SSH is used in the steps below.
- Write the image to the microSD card, safely eject it, insert it into the Pi, connect Ethernet if preferred, and power on the Pi.
- Find the Pi on your router’s connected-device list or use the hostname configured in Imager. Then connect from a terminal on the other computer with
ssh username@hostname, replacingusernameandhostnamewith your configured details. If name lookup does not work, use the Pi’s local IP address instead:ssh [email protected].
Use the password you configured when prompted. Do not rely on an assumed default username or password. Raspberry Pi OS Lite does not provide a desktop, and VNC is not the remote-access method for this setup; SSH gives you a terminal.
#1 Best Overall
- 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
Install FFmpeg and check the available encoders
After connecting, install FFmpeg from the current package repository for your Raspberry Pi OS release. Package names and versions can change, so check the package manager’s output rather than assuming a particular version.
sudo apt update
sudo apt install ffmpeg
ffmpeg -version
ffmpeg -encoders
Confirm that your installed build has the encoder you intend to use. For the H.264 example below, look for libx264. If it is absent, the command will not work as written: use an encoder listed by your build and adjust its options, or choose a source file that YouTube accepts and test whether stream copy is suitable. A Pi’s ability to transcode a particular resolution in real time is not guaranteed by these instructions.
Rank #2
- 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
Check loop-option availability and placement on the installed version before relying on a loop. Run ffmpeg -h full or consult the matching FFmpeg documentation. FFmpeg’s command structure places input options before the corresponding -i input and output options after it; the FFmpeg documentation describes the command-line structure.
Create a YouTube stream and protect the key
- Open YouTube Studio and go to Live Control Room. Create or schedule a stream using YouTube’s encoder setup instructions.
- Copy the stream URL and stream key provided for that stream. Prefer the RTMPS endpoint when it is offered. YouTube recommends RTMPS, and FFmpeg defines it as RTMP over a secure SSL connection; see YouTube’s encoder settings and FFmpeg’s protocol documentation.
- Keep the actual key private. YouTube describes stream keys as password-like: do not publish one in a script, screenshot, public shell transcript, or source repository. If it may have been exposed, reset it in Live Control Room using YouTube’s stream settings guidance.
The command below uses a placeholder for the complete RTMPS output address. Replace it with the address formed from the server URL and key exactly as YouTube’s encoder setup specifies; do not paste a real key into a public example. If you save the address in a private configuration file, restrict access to that file. Avoid putting a real key in a script that you intend to share.
Rank #3
- CanaKit Raspberry Pi 5 Essentials Starter Kit
Build and test a looping FFmpeg command
First check the input file and its streams:
ffprobe -hide_banner /home/username/video.mp4
For a video with audio, this is an H.264/AAC starting template. It assumes that your FFmpeg build includes libx264, that the installed version supports -stream_loop -1, and that the output address is the RTMPS address for your YouTube stream.
ffmpeg -stream_loop -1 -re -i /home/username/video.mp4
-c:v libx264 -preset veryfast -b:v 3000k -minrate 3000k -maxrate 3000k -bufsize 6000k
-r 30 -g 60 -keyint_min 60 -sc_threshold 0
-c:a aac -b:a 128k -ar 44100
-f flv '<YOUTUBE_RTMPS_URL_WITH_KEY>'
Replace the file path and output placeholder. The quotes keep shell-sensitive characters in the address from being interpreted by the shell. Treat the real address as secret because it contains the key.
Rank #4
- 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
What the important options do
-stream_loop -1requests infinite input looping on FFmpeg versions that support it. It is an input option, so place it before the relevant-i. Verify its availability in the installed version.-rereads a file at its intended pace rather than sending it as fast as the encoder can process it. It is intended for file input, not as a blanket setting for every live input.-c:v libx264selects H.264 encoding. The bitrate options request a constant-rate-style 3 Mbps video rate; they are a starting choice, not a guarantee of delivery or Pi performance.-r 30sets a 30 fps output target. With-g 60and-keyint_min 60, the keyframe interval is two seconds at 30 fps;-sc_threshold 0prevents scene changes from shortening that interval in this x264 example.-c:a aac -b:a 128k -ar 44100encodes audio as AAC at 128 kbps and 44.1 kHz. If your file has no audio, do not assume this audio configuration will work unchanged; inspect the input and adapt the mapping and audio options for the intended silent stream.-f flvselects the usual RTMP-family output container. YouTube’s current guidance lists RTMP/RTMPS, H.264, H.265, or AV1 video, and AAC or MP3 audio, but a combination still needs to be accepted by your chosen endpoint and FFmpeg build.
YouTube’s current H.264 recommendations include 5 Mbps for 1080p at 30 fps, 3 Mbps for 720p at 30 fps, and 0.4 Mbps for 480p at 30 fps. These are YouTube Help recommendations, not minimums or measurements of what a particular Pi can encode. The 3 Mbps template is a 720p-oriented starting point; it does not itself set the video dimensions. Test the source and output together, and use an output size appropriate to your source and Pi rather than assuming the template makes every file 720p. YouTube recommends a two-second keyframe interval and says not to exceed four seconds. Its settings page also recommends testing representative movement and audio and watching stream health: YouTube encoder settings and bitrate guidance.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Repair Windows errors before they cause bigger problemsFix Now →Confirm the stream before leaving it unattended
- Start with a short test using the same video, audio, resolution, bitrate, Pi, and network path planned for the real stream.
- Watch FFmpeg’s terminal output for connection failures, encoder errors, repeated reconnects, or input errors.
- Open the stream preview in YouTube Live Control Room and check its stream-health indicators. A running FFmpeg process alone does not prove that YouTube is receiving a healthy stream.
- View the stream from a separate device and confirm picture, sound, and playback. Test the file at a loop boundary too.
- Only after the test is stable should you plan unattended operation. Keep the Pi powered and connected, retain access over SSH, and arrange a way to inspect logs and restart the process remotely.
A service manager such as systemd can be configured to restart a failed process, but restart behavior does not fix a bad key, unsupported media, weak upload, or an encoder that cannot keep pace. If you add a service, validate its configuration and test restart and log inspection before depending on it. YouTube also notes that streams can be terminated for copyright or Community Guidelines strikes. Stream only material the channel is entitled to use; having a copy of a file does not establish streaming rights. See YouTube’s live-stream copyright guidance.
Best Value
- 【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.
Troubleshooting common failures
| Symptom | Likely cause | What to check or do |
|---|---|---|
| SSH cannot find the Pi | The Pi has not joined the network, the hostname is unresolved, or the address changed. | Check power and Ethernet/Wi-Fi, inspect the router’s connected-device list, and try the current local IP address. Recheck the Wi-Fi details saved in Imager. |
| FFmpeg reports an unknown option | The installed FFmpeg build or version does not support an option used in the command, or an option is placed on the wrong side of -i. |
Inspect ffmpeg -h full and the matching FFmpeg documentation. Verify loop support and keep input options before the input they apply to. |
| “Encoder not found” or an encoder initialization error | The installed build lacks the requested encoder, or the selected encoder cannot initialize on this system. | Check ffmpeg -encoders. Choose an available encoder and its supported options, then repeat the end-to-end test. |
| YouTube does not connect or rejects the stream | The URL/key pair may be wrong, the key may have changed, or the endpoint/protocol may not match the stream setup. | Copy the current server URL and key from Live Control Room, confirm the complete output address, and use the offered RTMPS endpoint where supported. Reset an exposed key. |
| Stream connects but buffers, drops frames, or reports poor health | Upstream capacity may be insufficient, the connection may fluctuate, or the Pi may not encode quickly enough. | Watch FFmpeg output and YouTube stream health. Test at a lower resolution or bitrate and compare wired versus Wi-Fi on your actual network; no one connection type is guaranteed to be better in every home. |
| Picture works but sound is missing or rejected | The source may lack an audio stream, or its audio format and the selected output options may not match. | Inspect the file with ffprobe, then set audio handling deliberately. If the video is meant to be silent, use an output configuration appropriate for video without audio. |
| Stream stops after running for a while | The Pi may have lost power/network, FFmpeg may have exited, or YouTube may have dropped the connection. | Reconnect over SSH, inspect the FFmpeg process and its output or service logs, verify the Pi has network access, and check Live Control Room. Restart only after correcting the cause; reset the key if it may have leaked. |
Or let it run in the cloud
If your goal is simply to keep uploaded videos looping on YouTube, StreamNeo is a cloud alternative to maintaining a Pi and FFmpeg process. Upload a recording or build a playlist, add your YouTube stream key once, and go live. Nothing needs to stay on at home; it streams uploaded videos to YouTube, not from a camera. You get any quality up to 4K 60fps as uploaded at one flat price per slot, with no re-encode or quality tiers, plus automatic recovery if YouTube drops the stream. The first day is free with no card. Monthly pricing is $9.99 per month. In India, UPI and cards are accepted; card checkout is available worldwide. See StreamNeo for details, or 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.

