To stream continuously from Linux with FFmpeg, you need a GPU and driver that expose a supported hardware encoder, an FFmpeg build that includes it, and a supervised process that reconnects and reports failures. First verify the encoder on your own system; then configure its output to match YouTube’s ingest requirements. The command below is an illustrative starting point for looping a local video, not a universal, verified recipe.
What you need before configuring FFmpeg
- A Linux system with a GPU, driver, and hardware encoder compatible with the codec and profile you plan to use.
- An FFmpeg binary built with support for that encoder. Hardware support varies by distribution package and FFmpeg build.
- A stable upload connection with spare capacity beyond the video bitrate; audio uses additional bandwidth.
- A YouTube channel, a configured live stream, and its server URL and private stream key.
- A way to supervise the process, collect logs, monitor progress, and recover from a host, network, or GPU failure.
Hardware encoding is not automatically faster, better-looking, or lower-power for every workload. Those outcomes depend on the GPU, driver, FFmpeg version, settings, filters, source, and desired output. Test the actual setup you intend to run unattended.
Check which hardware encoders your FFmpeg build supports
Start by recording the installed version and listing available encoders:
ffmpeg -version
ffmpeg -encoders | grep -E 'h264_nvenc|hevc_nvenc|h264_vaapi|hevc_vaapi|h264_qsv|hevc_qsv'
The list is only a first check: an encoder name may be present while the driver or device cannot use it. Ask the installed binary for the options it supports, substituting the encoder you intend to use:
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
- 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.
ffmpeg -h encoder=h264_nvenc
For NVENC, check NVIDIA’s FFmpeg hardware-acceleration guide and verify that your installed FFmpeg options match it. FFmpeg’s documentation and encoder documentation cover its acceleration and codec interfaces; support still depends on the local device and driver.
NVENC
NVENC is NVIDIA’s hardware encoding path. NVIDIA documents using FFmpeg with it, including rate-control and buffer settings. Check the local encoder help rather than copying options from a different FFmpeg release or API generation.
VAAPI
VAAPI is a Linux hardware-acceleration interface. The selected GPU and driver must support the required encoding entry point and profile. Device access and driver configuration are local system details, not settings that can be inferred from the encoder name alone.
Intel QSV
FFmpeg documents QSV acceleration. Its accelerated transcoding path has constraints: the relevant decoder and encoder must both support the path, and filters can prevent use of that particular accelerated path. This does not mean QSV can never be used with filters; inspect the pipeline you need and verify its behavior.
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.
Choose by compatibility, then test the workload
Compare the available paths against your GPU and driver, codec and resolution needs, filters and frame transfers, rate-control and keyframe controls, and monitoring requirements. If filtering requires frames to move between GPU and system memory, include that in your evaluation. There is no evidence here to recommend a particular GPU model or to claim one encoder path wins on quality, throughput, or power for all systems.
Match the output to YouTube’s live ingest settings
YouTube Help’s encoder guide (year not stated) lists RTMP and RTMPS ingestion; H.264, H.265/HEVC, and AV1 video options; frame rates up to 60 fps; CBR; AAC or MP3 audio; and a recommended two-second keyframe interval that should not exceed four seconds. It recommends RTMPS because it encrypts data to Google’s servers. For SDR, its advanced guidance specifies Rec. 709 and 8-bit video. Use YouTube’s current guide to check the applicable settings for your stream: Choose live encoder settings, bitrates, and resolutions.
YouTube Help’s bitrate table (year not stated) gives these H.264 video recommendations:
| Output | Recommended video bitrate | Minimum video bitrate |
|---|---|---|
| 720p30 | 6 Mbps | 3 Mbps |
| 720p60 | 6 Mbps | 3 Mbps |
| 1080p30 | 10 Mbps | 5 Mbps |
| 1080p60 | 12 Mbps | 6 Mbps |
These are platform-recommended video bitrates, not total bandwidth targets or guarantees of a stable stream. Leave stable upload headroom and account for audio separately; do not size the connection exactly to the video bitrate. YouTube advises choosing a quality compatible with the connection and recommends a speed test. A connection that fluctuates, is shared, or loses packets may need more margin or a lower output setting.
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.
For CBR with NVENC, NVIDIA’s guide explains how bitrate, maximum rate, and VBV buffer interact; it describes equal -b:v and -maxrate values for CBR behavior and gives a medium-buffer example for standard live streaming. Check the guide and local encoder help for the rate-control options available in your build.
Create and configure the YouTube live stream
- Set up the event. In YouTube Studio, create or configure the live stream and locate the encoder’s server URL and stream key. YouTube’s encoder setup instructions are at Create a YouTube live stream with an encoder. The interface and available controls can change, so use the labels shown in your account.
- Decide how the broadcast should start. A stream is the encoder connection; a broadcast is the event viewers see. Google’s broadcast and stream model includes a 24/7 feed as a scenario. Check the broadcast’s start settings: an encoder connection alone does not determine every broadcast lifecycle setting.
- Keep the key private. Treat it like a password. Do not publish it, put it in a publicly readable script, or paste it into commands that you save in shell history or logs. Store it in a restricted secret file or another protected mechanism and ensure the FFmpeg process can read it.
- Choose ingest transport and output. Use the server URL and key from YouTube, prefer RTMPS where supported, and set codec, rate control, keyframe interval, resolution, frame rate, and audio to match YouTube’s current requirements.
Illustrative FFmpeg command for a looped file
This example is for a local file intended to be output as H.264 at 1080p30, using NVENC. It loops the input and uses real-time pacing. Replace the placeholders and confirm every option against ffmpeg -h encoder=h264_nvenc, your FFmpeg version, GPU and driver, and YouTube’s stream configuration. It is a command outline, not a guaranteed end-to-end command.
ffmpeg -stream_loop -1 -re -i /path/to/input.mp4
-map 0:v:0 -map 0:a:0?
-c:v h264_nvenc -rc cbr
-b:v 10M -maxrate 10M -bufsize 20M
-g 60 -pix_fmt yuv420p
-c:a aac -b:a AUDIO_BITRATE
-f flv "$YOUTUBE_RTMPS_URL/$YOUTUBE_STREAM_KEY"
In this example, 10 Mbps is YouTube Help’s recommended H.264 video bitrate for 1080p30 (year not stated), not the total stream rate. The example assumes a 30 fps output, so a GOP of 60 frames makes keyframes recur about every two seconds. If your source or intended output has a different frame rate, calculate the GOP from that rate instead. The audio bitrate is deliberately a placeholder: choose an audio setting appropriate to your material and verify it in YouTube’s current guidance and your local FFmpeg build.
-map 0:a:0? makes the first audio stream optional; if your source has no audio, FFmpeg can proceed without it. If your file has multiple audio or video streams, map the streams you intend to send instead. The command does not scale or convert a differently sized source to 1080p30. Make sure the input and output are compatible with the chosen resolution and frame rate, or deliberately add and test the required filtering and frame-rate conversion. If you add filters, verify that the selected hardware path still works as intended.
Free tools Windows power users keep installed
One-click scans. No signup required.
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
Set YOUTUBE_RTMPS_URL and YOUTUBE_STREAM_KEY through a protected environment or secret-management method before running the command. The values are private; do not replace the placeholders with a real key in a public example, shared terminal recording, or log. Confirm that FFmpeg is actually using the intended hardware encoder and that frames and audio are progressing before relying on the feed.
Adapting the command to a live source
For a live source, remove -stream_loop -1 and use the appropriate input options and input device for that source. FFmpeg inputs differ by device and capture method; configure the source first, confirm that it produces stable frames and audio, then apply the same YouTube output requirements. Do not add -re blindly: it paces file input in real time, while live inputs typically arrive in real time already. Test the exact input, filters, encoder, and output path together.
Make the stream recoverable and observable
A successful FFmpeg command does not make a service reliable by itself. Run it under a service manager such as systemd with a dedicated unprivileged account, restricted access to the stream key, a restart policy, predictable protected logs, and any required startup ordering for the network or device. Keep the command in a script or service configuration that does not expose secrets, and rotate or limit logs so a long-running process cannot fill the disk.
For an example service unit, replace the account, script path, and dependencies with values that suit the host. Make sure the script reads credentials securely and exits with a failure status when FFmpeg fails.
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minutePC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Best 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.
[Unit]
Description=YouTube live stream via FFmpeg
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
User=streamer
ExecStart=/usr/local/bin/youtube-stream.sh
Restart=always
RestartSec=5
# Configure logging and secret access for your distribution and deployment.
[Install]
WantedBy=multi-user.target
Install and start the service using the systemd workflow appropriate for your distribution, then inspect its status and logs. The example does not provide a secret-storage configuration or guarantee that the network is ready merely because the target was reached.
Monitor more than whether the process exists
- Process exits, repeated restarts, and FFmpeg error messages.
- Frame progress and encoder output, so a process that is alive but stalled is detected.
- Dropped frames and ingest status visible in FFmpeg output and YouTube’s live controls.
- Host, network, disk, and GPU availability, including whether the device remains accessible after a driver or system event.
- Log growth and access controls for files that may contain sensitive connection details.
Before calling the setup unattended, deliberately test process restart, network interruption and reconnection, host restart, and recovery from an unavailable GPU or failed encoder. Decide how you will be alerted and how to recover if an automatic restart does not restore the feed. These are operational practices, not a YouTube availability guarantee.
Plan separately for full-length archives
YouTube’s encoder setup page says streams under 12 hours are automatically archived. That statement does not establish that a single stream running for 24 hours or longer will be archived in full or persist indefinitely. If you need a complete recording, plan and verify a separate recording or archive workflow instead of relying on an uninterrupted 24/7 broadcast alone.
Or let it run in the cloud
If your goal is a continuous YouTube channel built from uploaded videos, StreamNeo is an alternative to maintaining an FFmpeg host yourself. Upload a recording or build a playlist, add your YouTube stream key once, and go live; StreamNeo loops the uploaded video in the cloud. It does not go live from a camera and streams to YouTube only.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
- Your computer and home connection do not have to stay on for the stream to continue.
- Every slot streams the upload as made, up to 4K 60fps, at one flat price per slot, with no re-encode or quality tiers.
- It automatically recovers if YouTube drops the stream.
- The first day is free with no card, once per account.
Monthly: $9.99 per month. Learn about 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.




