Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
DocumentaryTube
FFmpeg

How to Set FFmpeg Bitrate and Keyframe Interval for an Always-On YouTube Stream

Use YouTube’s H.264 bitrate recommendation for your ingest resolution and frame rate, then set a two-second FFmpeg GOP: 60 frames at 30 fps or 120 at 60 fps. See a 1080p30 RTMPS example and the checks needed for a continuous stream.

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

For an H.264 YouTube Live stream, choose a video bitrate from YouTube’s recommendation for your exact resolution and frame rate, then set a two-second keyframe interval. In FFmpeg, a two-second GOP is 60 frames at 30 fps (-g 60) or 120 frames at 60 fps (-g 120). YouTube recommends constant bitrate (CBR) and says not to exceed a four-second keyframe interval. These settings are a starting point—not a guarantee that an FFmpeg process or an always-on stream will stay connected indefinitely.

Choose the bitrate for your resolution and frame rate

The figures below are YouTube Help’s current recommended H.264 ingest video bitrates, accessed in 2026. They are recommendations for the signal sent to YouTube, not measurements of viewer playback quality. YouTube transcodes live streams into multiple output formats, so the outgoing bitrate is not the bitrate every viewer receives. Use the row matching both your resolution and frame rate.

Ingest resolution and frame rate Recommended H.264 video bitrate
360p30 4 Mbps
480p30 4 Mbps
720p30 8 Mbps
720p60 8 Mbps
1080p30 14 Mbps
1080p60 17 Mbps
1440p30 21 Mbps
1440p60 34 Mbps
2160p30 42 Mbps
2160p60 50 Mbps

Do not reuse a 1080p30 setting for 1080p60: the recommended H.264 rates differ. This table is specifically for H.264; YouTube lists different recommendations for AV1 and H.265, so do not apply those figures to a libx264 command.

Make sure your connection can sustain it

The encoder needs a reliable upload connection capable of sustaining the chosen stream, including audio and network overhead. If it cannot reliably support the recommended bitrate, select a lower resolution or frame rate that it can sustain rather than labeling a reduced bitrate as the same-quality configuration. Test the actual source, motion, and audio before relying on the stream.

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.

Set a two-second keyframe interval in FFmpeg

A keyframe interval is a duration; FFmpeg’s -g option is expressed as a number of frames. Multiply the frame rate by two to get a two-second GOP size. At 30 fps, use 60 frames; at 60 fps, use 120. YouTube recommends keyframes every two seconds and says not to exceed four seconds. FFmpeg documents that a minimum keyframe interval is ignored unless it equals the GOP size; setting -keyint_min to the same value as -g requests fixed-interval placement.

Frame rate Two-second GOP FFmpeg values
30 fps 60 frames -g 60 -keyint_min 60
60 fps 120 frames -g 120 -keyint_min 120

For a regular cadence, -sc_threshold 0 disables x264 scene-change keyframe decisions that can add keyframes between scheduled intervals. Treat this as a cadence choice, not a YouTube-mandated option.

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.

Configure bitrate control rather than relying on -b:v alone

-b:v sets a target bitrate; it does not by itself guarantee CBR. FFmpeg documents default target-bitrate behavior as variable bitrate. Its generic rate-control options -minrate, -maxrate, and -bufsize affect behavior; equal minimum, maximum, and target bitrates select CBR behavior in the generic documentation. Encoder behavior can vary, so check the settings supported by your installed build. A buffer value such as twice the target bitrate is an example, not a YouTube requirement.

For audio, AAC stereo at 128 kbps is a reasonable starting point from YouTube’s advanced recommendations. YouTube lists AAC and MP3 as supported ingest audio codecs. Match the video options to the actual input frame rate and source; add any needed scaling, frame-rate conversion, or audio mapping deliberately.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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.

Example: H.264 at 1080p30 over RTMPS

This illustrative command uses YouTube’s current 1080p30 H.264 recommendation, a two-second GOP, AAC audio, and RTMPS output. The 28M buffer is an example, not an official YouTube requirement. Replace the input and output placeholders with values for your source and Live Control Room settings. Do not publish or log a real stream key.

ffmpeg -re -i INPUT 
  -c:v libx264 -preset veryfast -tune zerolatency 
  -r 30 -g 60 -keyint_min 60 -sc_threshold 0 
  -b:v 14M -minrate 14M -maxrate 14M -bufsize 28M 
  -c:a aac -b:a 128k -ar 44100 
  -f flv 'rtmps://YOUTUBE_INGEST_URL/STREAM_KEY'

-re paces file input in real time; live capture inputs generally have their own timing and usually do not need it. The libx264 wrapper is available only in FFmpeg builds configured with libx264. Check with ffmpeg -encoders if the encoder is unavailable. The command is a starting point, not a drop-in configuration for every input or build.

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

For 1080p60

Use the H.264 recommendation for 1080p60 and a 120-frame GOP: set -r 60 -g 120 -keyint_min 120 and use -b:v 17M -minrate 17M -maxrate 17M. Reconsider the buffer for the encoder and stream rather than assuming the 1080p30 example’s buffer is required.

Connect FFmpeg to YouTube safely

  1. Get the ingest details. In YouTube Live Control Room, obtain the stream URL and stream key from the stream’s settings. YouTube recommends RTMPS for secure ingest.
  2. Keep the key private. Treat it like a password. Do not put the actual key in public articles, screenshots, repositories, or command logs. Use a protected configuration or environment-specific secret-handling method on your host.
  3. Substitute the output URL. Replace the example endpoint and key with the values from Live Control Room. Keep the rtmps:// scheme when using the recommended secure ingest option.
  4. Start a representative test. Use content with typical motion and audio, then check stream health and messages in Live Control Room. Fix warnings before depending on the stream.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

What makes an FFmpeg stream actually always-on?

Bitrate and GOP settings configure the encoded stream; they do not supervise the process. YouTube’s encoder guidance does not prescribe a universal FFmpeg restart policy or guarantee indefinite operation. For a continuous stream, the host and your operating setup also need to address process restarts, input loss, network interruption, logs, and alerts. Those choices depend on the operating system, init or process supervisor, and source; no single supervisor configuration is a YouTube requirement.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

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.

Test failure and recovery behavior rather than assuming a reconnect setting will cover every problem. A network interruption, unavailable input file, expired or replaced key, or host restart can stop delivery even when the bitrate and keyframe cadence are correct. Monitor Live Control Room stream health and its messages while the stream runs.

Troubleshooting common configuration problems

Symptom Likely cause What to check or change
Stream health reports bitrate instability or dropped frames The upload connection cannot sustain the selected rate, or the source/host is overloaded. Test sustained upload capacity and host load. Choose a lower supported resolution or frame rate if necessary; do not assume lowering bitrate alone preserves the same quality.
Keyframe or stream compatibility warning The GOP interval is too long, frame rate changed without adjusting GOP size, or the encoder is making extra scene-change keyframes. Use a two-second GOP: frame rate × 2 (60 frames at 30 fps; 120 at 60 fps). For fixed cadence with libx264, match -keyint_min to -g and consider -sc_threshold 0.
Configured bitrate does not behave like a steady rate -b:v alone sets a target and does not ensure CBR. Review the encoder’s rate-control behavior and configure the supported minimum, maximum, and buffer options; confirm the actual stream health in Live Control Room.
FFmpeg reports that libx264 is unavailable The installed FFmpeg build may not include libx264. Check ffmpeg -encoders or the build configuration, and use a build with libx264 enabled if you need this example’s encoder.
Stream will not connect or stops after a key change The endpoint or key may be wrong, or the key may have been replaced. Recheck the current stream URL and key in Live Control Room. Update the protected configuration without exposing the key in logs or public files.
Stream stops after an input or host failure Encoder options do not restart FFmpeg or restore an unavailable input. Check the process supervisor, input availability, network recovery behavior, logs, and alerting on the host that runs FFmpeg.

Copyright and channel-policy checks for continuous video

Before looping a recording, confirm you have the rights and permissions needed for the video, music, and other material in it. A technically valid stream configuration does not establish that content is cleared for broadcast or that a channel meets YouTube’s monetization policies. Review YouTube’s applicable copyright and reused-content requirements for your channel and material; a stream key is not permission to rebroadcast someone else’s work. For a practical preflight, use the copyright safety checklist.

Or let it run in the cloud

If the goal is a continuous YouTube stream of uploaded videos rather than a camera feed, StreamNeo is a cloud alternative: upload a recording or build a playlist, add your YouTube stream key once, and go live. It loops uploaded videos from the cloud, so your computer and home connection do not have to stay on. StreamNeo is for YouTube only.

  • One flat price per slot for any uploaded quality up to 4K 60fps, with no re-encode or quality tiers.
  • Automatic recovery if YouTube drops the stream.
  • The first day is free, with no card required; one free day per account.
  • One always-on stream per slot, 10 GB storage per slot pooled across active slots, 24/7 looping and playlists, and StreamNeo team support.

Every plan has the same product; only the billing length changes. Monthly billing is $9.99 per month. A day, week, six-month, and yearly option are also available. Billing can be cancelled any time. UPI and cards are available in India; card checkout is available worldwide. For five or more slots, contact support. See StreamNeo and its pricing.

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

Try the first free day with no card: start with StreamNeo.

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.

Leave a Reply

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

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

More from the Screening Room

Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

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.