Install FFmpeg from Raspberry Pi OS’s APT repositories with sudo apt update followed by sudo apt install ffmpeg. That installs the encoder; it does not start a YouTube broadcast. To stream a looping file, you also need a compatible video, YouTube’s stream URL and private stream key, suitable encoding settings, and enough Pi and internet capacity to sustain them.
Install FFmpeg on Raspberry Pi OS
-
Open a terminal on the Raspberry Pi, or connect to it remotely over SSH.
-
Refresh the package lists:
sudo apt update. Raspberry Pi OS uses APT to manage software, and its documentation recommends updating package lists before installing packages. See the Raspberry Pi OS documentation. -
Install FFmpeg:
sudo apt install ffmpeg. Raspberry Pi’s camera documentation also uses this command to install FFmpeg: Raspberry Pi camera software documentation.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
-
Check that the executable is available:
ffmpeg -version. The command should print version and build information. This confirms that FFmpeg is installed, but not that the Pi can encode your chosen stream in real time.
The package version and available encoders depend on the OS image, architecture, repositories, and installed build; there is no single version guaranteed for every Pi installation. If APT says it cannot locate the package, first check that the Pi has internet access and that its configured Raspberry Pi OS repositories are enabled. Avoid downloading an arbitrary FFmpeg binary as the default fix.
What you need before sending a loop to YouTube
-
A local video file that FFmpeg can read, with a known resolution, frame rate, and audio track (if any).
-
A YouTube channel eligible to create a live stream, and access to YouTube Studio’s Live Control Room.
Recommended Free Tools
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy. -
The stream URL and stream key provided by YouTube. The encoder needs both to send video to YouTube; the key identifies the broadcast destination. Follow YouTube’s Live Control Room streaming instructions.
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
-
A network connection whose upload capacity can sustain the total stream bitrate, with additional headroom.
Treat the stream key like a password. Do not publish it in an article, screenshot, shell history, source-control repository, or a command you share. If it is exposed, replace or reset it in YouTube Studio.
Choose settings the Pi and connection can sustain
YouTube’s current encoder guidance supports RTMP or RTMPS ingest, H.264, H.265/HEVC, or AV1 video, AAC or MP3 audio, and frame rates up to 60 fps. It calls for constant bitrate (CBR), recommends a two-second keyframe interval, and says not to exceed four seconds. YouTube recommends RTMPS for encrypted transport. Check the YouTube encoder settings and verify that your installed FFmpeg build supports the encoder and protocol you intend to use.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
| Example target | YouTube H.264 bitrate guidance | What the figure means |
|---|---|---|
| 720p at 30 fps | 3 Mbps minimum; 8 Mbps recommended | YouTube ingest guidance, not a Raspberry Pi performance guarantee. |
| 1080p at 30 fps | 5 Mbps minimum; 14 Mbps recommended | YouTube ingest guidance, not a Raspberry Pi performance guarantee. |
These bitrate recommendations are from YouTube’s encoder settings guidance, accessed in 2026, and may change. They do not establish whether a particular Pi can encode the source at that rate. Start with a modest target, then test the actual model, file, and FFmpeg build. YouTube also recommends leaving 20% upload headroom, using a reliable connection, and monitoring stream health; see its live streaming tips. Account for audio bitrate as part of the total upload load.
Build and test a looping FFmpeg stream
The example below assumes a local file named documentary.mp4 that contains video and audio, a Pi capable of encoding H.264 in real time at the selected settings, and an FFmpeg build with the required encoder and RTMPS support. It uses libx264 and AAC as an example; available encoders vary by build. This is a template, not a command tested on every Raspberry Pi model.
Rank #3
- CanaKit Raspberry Pi 5 Essentials Starter Kit
-
Find YouTube’s stream URL and key in the Live Control Room. Put the key in a protected environment variable rather than typing it into a command that may remain in shell history. For example, in a Bash session:
read -s YT_KEY, enter the key when prompted, then press Enter. The variable lasts only for that shell session. -
Run a private or unlisted test broadcast and replace the URL placeholder with YouTube’s actual RTMPS ingest URL:
Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallSpecial offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.ffmpeg -re -stream_loop -1 -i documentary.mp4 -c:v libx264 -preset veryfast -b:v 3000k -maxrate 3000k -bufsize 6000k -pix_fmt yuv420p -r 30 -g 60 -keyint_min 60 -sc_threshold 0 -c:a aac -b:a 128k -ar 44100 -f flv "RTMPS_URL/${YT_KEY}"Here
-stream_loop -1repeats the input indefinitely,-rereads it at approximately real-time speed, and-g 60with a 30 fps output sets a two-second GOP/keyframe interval. The 3,000 kbps video target corresponds to YouTube’s stated 720p/30 H.264 minimum, not its recommended bitrate; use a suitable resolution and bitrate for your source, Pi, and connection. The example does not scale the video, so output dimensions follow the input. Confirm the exact RTMPS URL format and any stream-key placement with the URL YouTube provides for your encoder. -
Watch FFmpeg’s output and YouTube Studio’s stream health while the test runs. Check for encoder overload, dropped frames, connection instability, working audio, and a clean transition when the file loops. If the Pi cannot sustain real-time encoding, reduce resolution, frame rate, or encoding workload, or use a more capable device.
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
-
Only after the test is stable should you make the stream public. Confirm that you have the rights to broadcast the video and audio. YouTube’s copyright and live-stream policies apply; looping a file does not grant permission to use it.
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 problemsSpecial offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
If the input has no audio track, this example’s audio settings may fail. Inspect the file first (for example, with ffprobe, if installed) and adapt the command to omit audio encoding or map an appropriate audio source. Do not assume that every file contains audio or that every FFmpeg build offers libx264. Use ffmpeg -encoders and ffmpeg -protocols to inspect the installed build.
Troubleshoot common failures
-
APT cannot locate FFmpeg: verify connectivity, run
sudo apt updateagain, and check the enabled Raspberry Pi OS repositories and release configuration. -
“Unknown encoder” or “Protocol not found”: the installed build may lack
libx264, AAC support, or RTMPS support. Inspect the available encoders and protocols; use a supported option or an appropriate Raspberry Pi OS package build. -
YouTube shows no incoming video: verify the exact ingest URL and key, that the stream is started in the Live Control Room, and that the network permits the outgoing connection. Keep the key private and replace it if it was exposed.
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →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.
-
Dropped frames or unstable stream health: the upload connection may be unreliable or lack headroom, or the Pi may be overloaded. Lower the target bitrate or encoding workload, use wired networking if available, and monitor both FFmpeg output and YouTube’s stream-health indicator.
-
Audio is missing or FFmpeg exits at startup: check whether the source actually has an audio stream and adjust audio mapping and encoding accordingly.
-
The stream stops when the Pi loses power or the process exits: FFmpeg runs on the Pi, so it depends on that device, its power, network, and process remaining available. A service manager can restart a process after some failures, but cannot keep an unpowered or disconnected Pi online.
Or let it run in the cloud
If you want a YouTube channel to keep looping without leaving a Pi or computer running at home, StreamNeo is a cloud service for uploaded videos and playlists. Upload your recording, add your YouTube stream key, and go live. The cloud keeps the loop running; nothing has to stay on at home. Every slot supports the uploaded quality up to 4K 60fps at one flat price per slot, with no re-encode or quality tiers, and automatic recovery if YouTube drops the stream. The first day is free with no card.
Monthly: $9.99 per month. The first day is free with no card; see StreamNeo pricing for plan lengths and details. Start your free StreamNeo 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.




