Recommended Free Tools
On Raspberry Pi OS Lite, install FFmpeg with APT, verify the build, configure an input that matches your source, and run the stream as a systemd service with restart-on-failure. That gives you a practical headless setup—but it does not guarantee uninterrupted streaming: the Pi, source, network, power, and YouTube event must all remain healthy.
The commands below are starting points, not a tested configuration for every Pi. Your model, OS release, FFmpeg build, source type, target quality, and available upload bandwidth determine what will work.
What you need to decide first
Raspberry Pi OS Lite is the command-line-only edition of Raspberry Pi OS, intended for setups such as headless servers. Before choosing FFmpeg settings, establish what you are sending and what the Pi can sustain.
- Source: a prerecorded file, camera or capture device, or network feed. Each requires different input options.
- Encoding mode: re-encode the source, or copy its existing audio/video streams if they are compatible with YouTube and the output container. Copying can reduce CPU work, but it is not suitable for every source.
- Output target: resolution and frame rate affect both encoder load and the required bitrate.
- System details: note the Pi model, OS release, architecture, and FFmpeg build. Package versions and enabled codecs or protocols can vary.
Raspberry Pi says its latest OS release is based on Debian Trixie, with Bookworm the previous release. Check which release and architecture your device actually runs rather than assuming instructions for an older image apply. See Raspberry Pi OS.
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →#1 Best Overall
- Includes Raspberry Pi 4 4GB Model B with 1.5GHz 64-bit quad-core CPU (4GB RAM)
- Includes Pre-Loaded 32GB EVO+ Micro SD Card (Class 10), USB MicroSD Card Reader
- CanaKit Premium High-Gloss Raspberry Pi 4 Case with Integrated Fan Mount, CanaKit Low Noise Bearing System Fan
- CanaKit 3.5A USB-C Raspberry Pi 4 Power Supply (US Plug) with Noise Filter, Set of Heat Sinks, Display Cable - 6 foot (Supports up to 4K60p)
- CanaKit USB-C PiSwitch (On/Off Power Switch for Raspberry Pi 4)
Install FFmpeg and verify the build
On an already-imaged Raspberry Pi OS Lite system, update APT’s package information, install the distribution package, and inspect the resulting executable:
sudo apt update
sudo apt install -y ffmpeg
ffmpeg -version
ffmpeg -protocols | grep -E '(^| )rtmps?$'
Raspberry Pi recommends APT for routine package management and updates. The version output identifies the installed build; the protocol check helps show whether RTMP or RTMPS is listed. These checks do not prove that a given stream command, codec, input device, or hardware-acceleration path will work. Verify the options and capabilities on the target image. For a new image, Raspberry Pi Imager can install Raspberry Pi OS, including Lite; see Raspberry Pi OS installation and edition information.
Get the YouTube ingest URL and protect the stream key
In YouTube Live Control Room, create or open the live stream and use the stream settings to obtain the ingest URL and stream key. YouTube Help says the RTMPS URL is revealed using the lock icon; the default displayed URL may be the ordinary RTMP URL. Prefer RTMPS when available. YouTube describes it as RTMP over TLS/SSL, and its API documentation specifies port 443.
Rank #2
- Broadcom BCM2711, quad-core Cortex-A72 (ARM v8) 64-bit SoC @ 1. 5GHz
- 2. 4 GHz and 5. 0 GHz IEEE 802. 11b/g/n/ac wireless LAN, Bluetooth 5. 0, BLE
- 2 × USB 3. 0 ports, 2 x USB 2. 0 Ports
- 2 × micro HDMI ports supproting up to 4Kp60 video resolution
- Micro SD card slot for loading operating system and data storage
Keep the key private. Do not commit it to a public script repository, paste it into a public forum, or expose it in a screenshot or log you share. If it is disclosed, replace or reset it in YouTube’s controls before relying on the stream again. See YouTube’s encoder settings and stream URL guidance and the YouTube RTMPS ingestion documentation.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Fix the driver behind crashes, sound loss and screen glitches3Repair Windows errors before they cause bigger problemsConfigure FFmpeg for the actual source
Prerecorded video file
For a file, FFmpeg documents -re as a way to read input at its native rate for real-time streaming. A schematic command that re-encodes video and audio is:
ffmpeg -re -i /path/to/input.mp4
-c:v libx264 -preset veryfast -b:v 2500k -maxrate 2500k -bufsize 5000k
-r 30 -g 60 -c:a aac -b:a 128k -ar 44100
-f flv 'rtmps://YOUR_YOUTUBE_INGESTION_URL/YOUR_STREAM_KEY'
Replace the path, ingest URL, and key. The numeric encoder values are illustrative, not a universal recommendation or a verified Raspberry Pi performance result. The command assumes this FFmpeg build has the required encoder and that the Pi can sustain the selected input and output. For continuous playback of a file, a simple restart-on-failure service will not automatically advance or loop the file; configure the playback workflow deliberately and test its behavior at the end of the input.
Rank #3
- Broadcom BCM2711, Quad core Cortex-A72 (ARM v8) 64-bit SoC @ 1.5GHz
- 1GB, 2GB, 4GB or 8GB LPDDR4-3200 SDRAM (depending on model)
- 2.4 GHz and 5.0 GHz IEEE 802.11ac wireless, Bluetooth 5.0, BLE Gigabit Ethernet
- 2 USB 3.0 ports; 2 USB 2.0 ports.
- Raspberry Pi standard 40 pin GPIO header (fully backwards compatible with previous boards)
Camera, capture device, or network feed
Do not reuse the file input options blindly. A camera needs the correct Linux input device and capture format; a network source needs its real URL, transport, authentication, and any required demuxer options. Those details depend on the particular device or feed. Check the input with FFmpeg locally before adding YouTube output, and determine whether the existing streams can be copied or need encoding.
Match YouTube settings to the Pi and connection
YouTube’s current guidance recommends constant bitrate (CBR), a two-second keyframe interval (not more than four seconds), and H.264, H.265, or AV1 video with AAC or MP3 audio for RTMP/RTMPS. Use settings supported by the installed FFmpeg build and sustainable on both the Pi and uplink. YouTube recommends testing before the event and monitoring stream health.
For one specific reference point, YouTube’s encoder table lists H.264 720p30 at 3 Mbps minimum and 8 Mbps recommended. That row is not a bitrate recommendation for other resolutions, frame rates, or codecs. Select the applicable row in YouTube’s encoder settings, bitrates, and resolutions, then test with representative content. A bitrate that briefly works may still fail when the home connection fluctuates; leave headroom rather than planning to use every bit of measured upload capacity.
Rank #4
- Vilros Complete Starter Kit for Pi 4 Includes Raspberry Pi 4 Model B Board and all the accessories you need to get started.
- 9-PART KIT WILL HAVE YOU READY TO GET UP AND RUNNING: Kit Includes 1. Raspberry Pi 4 Model B Board 2. Case With Easy to connect Built-in fan 3. 64GB Micro SD card Preloaded with RP OS 4. Vilros Pi 4 Compatible Power Supply with Inline on/off switch (power supply color may vary white/black) 5. Micro HDMI to Standard HDMI cable (5ft) 6. Micro SD to USB adapter to reflash card if desired 7. Neoprene Storage Bag to store all parts when not in use 8. Set of 4 Heatsinks 9. Vilros QuickStart Guide instruction booklet for Pi 4
- PASSIVE & ACTIVE COOLING: The included case is well-vented and the kit also includes a set of heatsinks with thermal stickers for easy application and a pre-installed fan to keep the board cool in any use.
- CONVENIENT ACCESSORIES: The power supply features an inline on/off switch neoprene bag that holds and protects all the parts when not in use and the QuickStart guide is updated and written for Raspberry Pi 4.
- IMPORTANT: Kit does NOT include Keyboard, Mouse or Monitor
Run FFmpeg at boot with systemd
A systemd unit can launch a long-running FFmpeg process when the Pi boots and restart it after a process failure. Create a service using the correct command and a dedicated, non-root account. The following template deliberately omits the actual command and key-handling design; complete those for your source and protect credentials before enabling it.
sudo nano /etc/systemd/system/youtube-stream.service
[Unit]
Description=FFmpeg YouTube live stream
Wants=network-online.target
After=network-online.target
[Service]
Type=simple
User=streamer
Group=streamer
ExecStart=/usr/bin/ffmpeg REPLACE_WITH_SOURCE_AND_OUTPUT_OPTIONS
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
Replace streamer with an existing restricted service account and replace the placeholder with the tested FFmpeg arguments. Do not put a real key in a script that others can read. A root-owned configuration file with restrictive permissions or another suitable secret-injection method is safer than a world-readable unit; confirm how your chosen method handles process arguments and logs.
- Reload systemd’s unit definitions:
sudo systemctl daemon-reload. - Start the service:
sudo systemctl start youtube-stream.service. - Check its state:
sudo systemctl status youtube-stream.service. - Inspect recent output:
sudo journalctl -u youtube-stream.service -n 100 --no-pager. - Enable launch at boot:
sudo systemctl enable youtube-stream.service. - Reboot during a planned test and verify the service and YouTube stream again:
sudo reboot.
Use Restart=on-failure for a process that exits unsuccessfully. A clean exit at the end of a file is not a failure, so systemd will not interpret it as a request to loop that file. A process restart also cannot repair a disconnected camera, inaccessible network source, invalid event setup, weak upload connection, overheating, or loss of power.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Repair Windows errors before they cause bigger problemsFix Now →Best Value
- Includes Raspberry Pi 4 4GB Model B with 1.5GHz 64-bit quad-core CPU (4GB RAM)
- CanaKit 3.5A USB-C Power Supply with Noise Filter (UL Listed) specially designed for the Raspberry Pi 4 (5-foot cable)
- CanaKit USB-C PiSwitch (On/Off Power Switch)
- Set of 3 Aluminum Heat Sinks for the Raspberry Pi 4
Test and troubleshoot the whole path
Test with the real source and intended settings before relying on the broadcast. Confirm FFmpeg remains running, YouTube receives the signal, and stream health is acceptable in Live Control Room. Check the result after reboot as well as during a normal run.
| Symptom | Likely causes to check | Next action |
|---|---|---|
| FFmpeg reports an unknown protocol or cannot open the output | The installed build may lack the protocol, the URL may be malformed, or the wrong ingest URL was used. | Inspect ffmpeg -protocols, verify the URL in Live Control Room, and try the RTMPS URL provided there. |
| YouTube does not receive the stream | Incorrect or expired stream key, wrong endpoint, network or DNS problem, or the process stopped. | Check the unit status and journal, verify the current URL and key privately in Live Control Room, and confirm network connectivity. |
| FFmpeg cannot open the input | Wrong file path, permissions, missing device, incorrect capture format, or unavailable network source. | Test the input independently, check permissions and device enumeration, and use input-specific options for that source. |
| Stream buffers, drops frames, or reports poor health | Bitrate exceeds stable upload capacity, encoder cannot keep up, or source/network instability. | Check YouTube stream health and system load; reduce output demands or bitrate in accordance with the matching YouTube settings row, then retest. |
| Service starts and immediately stops | Invalid command, clean EOF, missing permissions, or unavailable source at boot. | Read journalctl, run the command interactively as the service user, and decide explicitly how file completion or delayed source availability should be handled. |
| It works until reboot or a power/network interruption | Service not enabled, source recovery not configured, power loss, or upstream failure. | Verify systemctl is-enabled youtube-stream.service, test a controlled reboot, and address the underlying source, power, and network failure separately. |
Understand what 24/7 means here
Systemd improves process recovery, but it is only one part of availability. A continuous broadcast also depends on power, cooling, storage, a working source, stable network access, valid YouTube stream settings, and account or event eligibility. The exact rules for leaving a particular broadcast live for 24 hours are not established by the cited setup guidance; confirm current eligibility and event status in Live Control Room. There is no universal Pi model or performance guarantee for this title: test the precise hardware, OS image, FFmpeg build, input, and encoding settings you intend to run.
Or let it run in the cloud
If your plan is to keep uploaded prerecorded video live on YouTube rather than stream a camera or live network feed, StreamNeo is a cloud alternative: upload a recording or build a playlist, add your YouTube stream key once, and go live. The computer at home does not need to stay on. Each slot streams the uploaded quality as-is up to 4K 60fps for one flat price per slot, includes automatic recovery if YouTube drops the stream, and the first day is free with no card. The monthly price is $9.99 per month. It plays uploaded videos and streams to YouTube only; it is not a camera-ingest replacement. See StreamNeo, 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.

