You can broadcast a video file from a Raspberry Pi as a YouTube Live stream with FFmpeg: pace the file in real time, send it to YouTube’s current RTMPS ingest address with your private stream key, then start the scheduled broadcast in Live Control Room when its preview appears. The Pi must stay powered on, connected to the internet, and able to encode and upload continuously for as long as you stream.
What you need before you start
- A Raspberry Pi running Raspberry Pi OS, with FFmpeg installed from a package source appropriate for that OS release.
- A local video file. If you do not know its streams or codecs, inspect it with
ffprobebefore choosing stream-copy or transcoding. - A YouTube channel enabled for live streaming. YouTube says first-time enablement can take up to 24 hours.
- A reliable upload connection that can sustain the stream’s bitrate, plus access to YouTube Live Control Room.
The Pi reads the file, sends frames at real-time speed, and pushes the resulting live feed to YouTube. For a file input, FFmpeg’s -re option paces the output; -stream_loop -1 repeats the input indefinitely. Keep the stream URL and key private: do not publish them in an article, screenshot, shell history, or public repository.
Set up the YouTube stream
- Enable live streaming for the channel if it has not been enabled already. Allow up to 24 hours for first-time access.
- Open Live Control Room and create or select a scheduled stream.
- Copy the current ingest URL and stream key shown for that stream. YouTube recommends RTMPS, its secure extension to RTMP. Use the URL Live Control Room currently displays rather than relying on an old example endpoint.
- Keep the stream key confidential. Treat it like a password: anyone who obtains it may be able to send content to your stream.
YouTube’s current encoder guidance recommends RTMPS and supports H.264, H.265, or AV1 video options; it lists AAC or MP3 audio, recommends constant bitrate (CBR), and recommends a two-second keyframe interval, not exceeding four seconds. Choose settings that both the Pi and your sustained upload connection can handle.
Prepare and send the video with FFmpeg
Inspect the file and choose a method
If you are unsure what the file contains, run ffprobe on it first. The command below transcodes to H.264 video and AAC audio, which gives you explicit output settings to adjust. Transcoding takes CPU; reduce resolution, frame rate, or bitrate if the Pi cannot encode in real time or the network cannot sustain the upload.
#1 Best Overall
- Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
- Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
- Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
- Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
- 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
Stream copy can reduce CPU use when the file’s codecs, pixel format, frame rate, keyframe spacing, audio, and container are compatible with YouTube’s current ingest requirements. Check those properties first. If you cannot establish compatibility, transcode and test instead. This is a technical trade-off, not a claim about the performance of a particular Raspberry Pi model.
Run a real-time looping transcode
Replace the file path, ingest host and path, and stream-key placeholder with your own values from Live Control Room. The bitrate, frame rate, and other encoder settings below are illustrative starting values, not a guarantee that every Pi, file, network, or stream configuration will support them.
Rank #2
- 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
- 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
- Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
- 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
- What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
ffmpeg -re -stream_loop -1 -i "/path/to/video.mp4"
-map 0:v:0 -map 0:a:0?
-c:v libx264 -preset veryfast -pix_fmt yuv420p
-c:a aac -b:a 128k -ar 44100
-b:v 2500k -maxrate 2500k -bufsize 5000k
-r 30 -g 60 -f flv
"rtmps://<current-ingest-host>/<stream-path>/<STREAM_KEY>"
-repaces the file input at its native frame rate, so FFmpeg simulates a live source rather than sending the file as fast as it can read it. Keep it before-i.-stream_loop -1requests infinite repetition of the input file. Keep it before-i.-map 0:v:0selects the first video stream.-map 0:a:0?selects the first audio stream if present; the question mark only makes FFmpeg’s audio selection optional. It does not establish that YouTube will accept a stream with no audio in every configuration. Test a silent source in Live Control Room before a scheduled broadcast, or include audio you have the right to use.-c:v libx264and-c:a aactranscode video and audio.-b:v 2500ksets the target video bitrate, while-maxrateand-bufsizeconstrain rate-control behavior. Confirm that the upload connection can sustain the chosen output rate.-r 30 -g 60requests 30 frames per second and a 60-frame GOP, giving a two-second keyframe interval at that frame rate. YouTube recommends a two-second interval and says not to exceed four seconds.-f flvselects the output container used by this RTMP-family ingest example. FFmpeg options apply to the next input or output, so keep input options before-iand output and encoder options after it.
If the Pi’s CPU is saturated or FFmpeg cannot maintain real-time output, lower the encoding workload—such as resolution, frame rate, or bitrate—or verify whether compatible stream copy is possible. If the upload connection is unstable, lower the bitrate to a level it can sustain. Do not infer model-specific capability from this example; verify your actual device and connection.
Start, verify, and end the broadcast
- Run the FFmpeg command and watch for incoming video in the stream’s Live Control Room preview.
- For a scheduled stream, click Go live in Live Control Room after the preview appears. Sending data from FFmpeg alone may not make the scheduled broadcast public.
- Check the audience-facing playback as well as the encoder process. Monitor stream health, messages, audio, and motion; test with content similar to what you intend to broadcast.
- To finish, stop sending content and use the relevant end-stream control in Live Control Room. YouTube says streams under 12 hours are automatically archived; that guidance does not establish automatic archiving for longer broadcasts.
Copyright, reused content, and live-stream responsibility
Only stream video and audio you have the rights or permission to use. A file being prerecorded, looped, or accompanied by a still image does not remove copyright obligations. A technical connection working correctly is not approval of the content or a guarantee about YouTube’s monetization decisions. Review YouTube’s applicable policies and check the stream before leaving it running unattended; do not assume that repeating the same material makes it eligible for monetization.
Rank #3
- Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
- Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
- Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
- Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
- What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
Troubleshooting
No preview appears in Live Control Room
- Check that the ingest URL and stream key were copied from the correct stream and are current; replace them if the stream configuration has changed.
- Confirm that the Pi can reach the ingest service over the network and that the command is still running without an FFmpeg error.
- Check that the scheduled stream is selected in Live Control Room. After a preview appears, use its Go live control if required.
FFmpeg exits or reports a mapping or input error
- Verify the file path and permissions, and inspect the file’s streams with
ffprobe. - If the file has no audio, the optional audio map prevents FFmpeg from failing solely because the audio stream is absent. Test the resulting silent stream in Live Control Room, since acceptance without audio is not guaranteed in every configuration.
- Check that the installed FFmpeg build supports the selected encoder and that the command’s options are in the correct order: input options before
-i, output options afterward.
Video stutters, drops frames, or the Pi falls behind
- Check CPU load and whether FFmpeg can maintain real-time encoding. Reduce resolution, frame rate, or bitrate, or investigate compatible stream copy if the source already meets the ingest requirements.
- Check sustained upload capacity and stability. A connection that cannot maintain the selected bitrate can disrupt delivery even if encoding is keeping up.
- Use Live Control Room’s stream-health information and check the viewer-facing playback rather than relying only on the command still running.
The stream ends when the file finishes
Confirm that -stream_loop -1 appears before -i in the command. Without that input option, FFmpeg reaches the end of the file instead of repeating it.
Or let it run in the cloud
If the goal is a YouTube channel that stays live without leaving the Pi or another computer running, StreamNeo is a cloud alternative for uploaded videos and playlists. Upload your recording, add the YouTube stream key once, and go live. Nothing has to stay on at home; StreamNeo loops uploaded video, supports any uploaded quality up to 4K 60fps at one flat price per slot, and automatically recovers if YouTube drops the stream. The first day is free with no card. The monthly option is $9.99 per month. StreamNeo streams to YouTube only and plays uploaded videos; it does not broadcast from a camera. Learn more at StreamNeo, or start the free first day.
Quick Recap
Best Value
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
Rank #4
- Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
- Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
- Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
- Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
- Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
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.




