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
VGSources
FFmpeg

How to Run an FFmpeg YouTube Stream on Raspberry Pi OS Bookworm

A practical Bookworm guide to choosing an input, checking FFmpeg and Pi encoder support, configuring YouTube’s live requirements, and testing the stream safely.

By VGSources Team 8 min read
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

You can send a Raspberry Pi camera, USB camera, video file, or network stream to YouTube Live with FFmpeg on Raspberry Pi OS Bookworm, but the right command depends on the input and the encoders installed on your Pi. For a Pi camera, Bookworm uses rpicam-vid; FFmpeg can then select or encode audio and video, mux them for RTMP/RTMPS, and send the stream to the ingest details shown in YouTube Live Control Room. Test the exact setup on your Pi before relying on it for a public broadcast.

What you need to decide first

Before building a command, identify the input and the Pi model. These choices determine how video enters FFmpeg and whether the Pi can encode it in real time.

  • Pi camera: use Bookworm’s rpicam-vid capture tools. The camera tool captures video; FFmpeg handles further processing or delivery.
  • USB camera: it commonly appears as a Video4Linux2 device, but confirm the actual device path and supported formats on your installation.
  • Existing file: FFmpeg reads the file directly. A file is not inherently a live camera feed; choose whether to stream it once or arrange repeat playback deliberately.
  • Network source: FFmpeg must be able to open that source’s protocol and URL. Availability and required options depend on the source and the installed FFmpeg build.

Also note whether your Pi has a supported hardware H.264 encoder. Raspberry Pi documentation says rpicam-vid uses hardware H.264 when available, and its libav backend also uses hardware H.264 when present. Raspberry Pi 5 uses software video encoders, so do not assume its encoding path or CPU headroom matches an earlier model. Raspberry Pi’s camera documentation describes the camera tools and model-specific behavior.

Install and inspect the tools on Bookworm

Raspberry Pi OS uses APT to manage software. Install FFmpeg if it is not already present, then inspect the installed build instead of assuming a flag or encoder from an older tutorial is available.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • 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.
  1. Update package information and install FFmpeg:

    sudo apt update
    sudo apt install ffmpeg

  2. Check the installed version and general options:

    ffmpeg -version
    ffmpeg -h

  3. Review available encoders and protocols:

    ffmpeg -encoders
    ffmpeg -protocols

    Look for the encoder and input/output support your intended path requires. Raspberry Pi OS image contents and FFmpeg build options can differ; the machine’s own output is authoritative. The Debian Bookworm FFmpeg manual explains command-line behavior, but does not guarantee that every option or codec is enabled in your particular build.

  4. For a Pi camera, check the current camera application is available:

    rpicam-vid --help

    From Bookworm onwards, Raspberry Pi’s camera applications use the rpicam-* names. Do not copy a legacy raspivid recipe without verifying that it applies to your OS and camera.

    Rank #2
    Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
    • 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.

Choose the capture and encoding path

Pi camera

rpicam-vid is Raspberry Pi’s video capture application. It can produce encoded video, and Raspberry Pi documents both direct H.264 workflows and a libav codec backend. The appropriate route depends on the output you need and what your device supports. Use rpicam-vid --help and the current Raspberry Pi camera documentation to confirm options for the installed version.

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

Keep capture separate from delivery in your mental model: the camera tool obtains video; FFmpeg can read, process, select streams, encode when needed, mux, and send the result. A direct camera bitstream may not contain the audio track you want, so plan and map audio separately if the broadcast needs it. The camera and audio configuration are machine-specific; there is no single capture command that applies to every camera, microphone, FFmpeg build, and Pi generation.

USB camera

Find the device and its supported capture formats before composing FFmpeg input options. On Linux, a USB camera often uses the V4L2 input, but do not assume a device name, pixel format, resolution, or frame rate. Input options belong before the relevant -i argument. Confirm that the camera actually produces the selected mode, and test its audio device independently if audio is required.

Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • 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.

File or network input

For a file, FFmpeg reads it with an input such as -i input-file; for a network feed, use the URL and protocol supported by that source and your build. Inspect the file’s streams before choosing audio/video mappings. If you intend continuous playback, arrange and test the repeat behavior rather than assuming a file will loop automatically. Do not add real-time pacing or reconnect options without checking their effect for that input type.

Pass through or encode?

If the incoming audio and video already meet the intended YouTube output profile and can be placed in the required delivery container, avoiding a full re-encode may reduce CPU load. If they do not, select an encoder the installed build supports and test whether the Pi can keep up. Encoding, filters, scaling, frame rate, audio conversion, and source characteristics all affect load. Never infer real-time performance from a codec name alone.

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

On Pi 5, Raspberry Pi documents software video encoding and a --low-latency option that changes encoder behavior to emit frames sooner. The documented tradeoffs include slightly reduced coding efficiency, potentially lower maximum frame rate, and less efficient multicore use. Raspberry Pi says this still easily achieves 1080p30, but that is a vendor statement—not a test of your complete YouTube workflow. Use low-latency behavior only when the latency goal justifies its tradeoffs.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • 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

Set a YouTube-compatible output

YouTube’s encoder guidance lists H.264, H.265/HEVC, and AV1 video; AAC or MP3 audio; constant bitrate (CBR); and frame rates up to 60 fps. These are YouTube’s accepted formats and recommendations, not a promise that every Pi or FFmpeg build can encode every option in real time. Choose a codec supported by your input path and installed encoders.

  • Keyframes: YouTube recommends a two-second interval and says not to exceed four seconds.
  • Audio: YouTube recommends stereo at 44.1 kHz and 128 Kbps. AAC or MP3 is listed as accepted audio.
  • Rate control: use CBR for the output profile.
  • Image characteristics: YouTube’s advanced recommendations include square pixels and progressive scan.
  • Bitrate: select a bitrate for the resolution and frame rate using YouTube’s current encoder-settings table, then ensure your measured upload capacity has room above the stream’s sustained bitrate. Do not rely on a remembered bitrate table; YouTube can update its guidance.

See YouTube’s current encoder settings, bitrates, and resolutions for the live recommendations. YouTube recommends RTMPS, a secure extension of RTMP. Obtain the active ingest configuration from YouTube Live Control Room instead of assuming one fixed server address or key.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Build and run the FFmpeg delivery command

There is no universal copy-and-paste command for this setup: capture options vary by source, and encoder availability varies by Pi and FFmpeg build. Construct the command in layers and confirm each layer works before streaming publicly.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 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.
  1. Make the input work locally. Verify camera capture, file playback, or network-source decoding first. Confirm that the expected video and audio streams are present.
  2. Choose stream mapping. Select the intended video and, if needed, audio streams explicitly. A camera-only source may not provide audio. An incorrect or absent mapping can leave YouTube without one of the tracks.
  3. Choose copy or encoding. Use stream copy only when the input codecs and output requirements are compatible. Otherwise select supported video/audio encoders, an appropriate CBR profile, frame rate, and two-second keyframe interval. Check the installed encoder’s help for exact option names.
  4. Set output options after the inputs. In FFmpeg, input-specific options go before their corresponding -i; output settings go after the inputs. This distinction matters when a command has multiple sources.
  5. Send to the current YouTube ingest. Use the RTMPS/RTMP ingest URL and stream key currently shown by YouTube Live Control Room, with the output muxing and protocol options supported by your FFmpeg build. FFmpeg documents RTMP protocol options at its protocol reference.
  6. Protect the key. Treat the stream key as a password. Do not paste it into a public post, screenshot, shared script, or repository. If it is exposed, replace or reset it in YouTube’s live-stream settings.

A stream key in a command line can be visible in shell history or process listings, depending on how it is launched and the system configuration. Restrict access to scripts and logs containing credentials, and avoid sharing diagnostic output that includes the full ingest URL. Use YouTube’s interface to verify the active key and server details rather than copying a key from an old example.

Test before the broadcast

  1. Start with a private or unlisted test stream, or another visibility setting appropriate to your channel and purpose.
  2. Use representative movement and the actual audio source. A static image can hide dropped-frame or encoding-load problems; silence can conceal an audio mapping mistake.
  3. Check the YouTube preview, audio, and stream-health messages. YouTube advises testing before an event and monitoring health while live.
  4. Compare the configured bitrate with a speed test of the Pi’s actual upload connection. Leave headroom for network variation and other household or office traffic.
  5. Monitor FFmpeg’s output and YouTube’s health feedback during a sustained test. A successful connection message alone does not show that audio, motion, and delivery remain stable.

Wired Ethernet is often preferable when available because it avoids some wireless variability, but the decisive check is the actual connection’s upload behavior under the conditions in which you will stream. No single Pi model, bitrate, or command guarantees stability across different inputs and networks.

Troubleshooting by layer

YouTube preview is blank

  • Confirm the source itself produces video before investigating delivery.
  • Check that FFmpeg selected and mapped the intended video stream.
  • Review codec, muxing, and protocol options against YouTube’s current guidance and the installed build’s supported features.
  • Verify the current server endpoint and stream key in Live Control Room; do not assume an old endpoint is still active.

Video appears but audio is missing or wrong

  • Check whether the input provides audio at all; a camera video stream may be silent.
  • Confirm the correct audio input and stream mapping, then verify its codec and sample settings.
  • Listen to a representative test in YouTube’s preview before the actual event.

Encoding falls behind or frames drop

  • Reduce resolution or frame rate, or remove expensive filters, then repeat a representative test.
  • Check whether a supported hardware H.264 path is available on that exact Pi and software build.
  • On Pi 5, account for software encoding; consider the documented low-latency option only if reduced latency is important and its tradeoffs are acceptable.

Stream starts but buffers or disconnects

  • Compare sustained upload capacity with configured bitrate and leave headroom.
  • Inspect YouTube’s stream-health feedback and FFmpeg’s messages rather than guessing from the symptom alone.
  • Test on the same network connection and with representative content before going live.

FFmpeg rejects an option or encoder

  • Check ffmpeg -h, ffmpeg -encoders, and the relevant input or encoder help on the Pi itself.
  • Recheck option order: input options precede the corresponding input; output options follow inputs.
  • Do not transplant old forum flags uncritically. A 2022 Raspberry Pi forum report predates Bookworm and is anecdotal, not proof that a command or architecture recommendation applies today.

Run it from the cloud instead

If your goal is a YouTube channel that keeps uploaded videos live around the clock, you can avoid keeping a Pi or home connection running. StreamNeo is a cloud service for looping uploaded videos on YouTube: upload a recording or build a playlist, add your YouTube stream key once, and go live. It does not stream camera footage.

  • Nothing has to stay on at home; the stream runs in the cloud.
  • Videos stream as uploaded, at any quality up to 4K 60fps, for one flat price per slot.
  • StreamNeo automatically recovers if YouTube drops the stream.
  • The first day is free with no card; one free day is available per account.
  • Monthly: $9.99 per month.

Start your free StreamNeo day.

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.

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

Leave a Reply

Your email address will not be published. Required fields are marked *

Free tools Windows power users keep installed

One-click scans. No signup required.

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

More from Patch Notes

Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

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.