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 DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
FFmpeg

How to Set FFmpeg Bitrate and Keyframes for YouTube Live

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

For YouTube Live, start with constant bitrate (CBR), choose the bitrate YouTube recommends for your codec, resolution, and frame rate, and set a keyframe interval of two seconds. In FFmpeg, that usually means setting -g to twice the frame rate: 60 at 30 fps or 120 at 60 fps. YouTube says not to exceed four seconds. Test with representative video and audio, then monitor YouTube’s stream-health messages.

What bitrate should you use for YouTube Live?

Use YouTube’s recommended incoming bitrate for your chosen codec, resolution, and frame rate. The figures below are YouTube-published recommendations, not minimum requirements or a guarantee that your internet connection can sustain the stream. YouTube advises choosing a stream quality reliable for your available connection and checking upload speed.

Recommended H.264 video bitrates

Resolution and frame rate Recommended bitrate
2160p (4K), 60 fps 50 Mbps
2160p (4K), 30 fps 42 Mbps
1440p, 60 fps 34 Mbps
1440p, 30 fps 21 Mbps
1080p, 60 fps 17 Mbps
1080p, 30 fps 14 Mbps
720p, 60 fps 8 Mbps
720p, 30 fps 8 Mbps
480p, 30 fps 4 Mbps
360p, 30 fps 4 Mbps

These are the H.264 recommendations on YouTube’s encoder settings page, checked October 3, 2026. YouTube lists separate minimums; for example, 1080p60 H.264 has a 6 Mbps minimum and a 17 Mbps recommendation. Do not treat a recommended rate as a universal minimum.

Codec affects the target

For 1080p60, YouTube recommends 17 Mbps for H.264 and 12 Mbps for AV1 or H.265; for 1080p30, it recommends 14 Mbps for H.264 and 10 Mbps for AV1 or H.265. Its current guidance also lists H.265 and AV1 ingestion, recommends H.265 for HDR, and says AV1 is not supported for HDR. Check YouTube’s current table for your exact mode rather than carrying an H.264 bitrate over to another codec.

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.

How do you set a two-second keyframe interval in FFmpeg?

FFmpeg’s -g option sets GOP size in frames for encoders that honor the standard option. Calculate it as frame rate × interval in seconds: at 30 fps, a two-second GOP is 60 frames; at 60 fps, it is 120 frames. Confirm the selected encoder’s behavior and options in your installed FFmpeg build.

Frame rate -g for 2 seconds -g for YouTube’s 4-second upper recommendation
30 fps 60 120
60 fps 120 240

YouTube Help’s encoder settings specify: “Keyframe frequency: Recommended 2 seconds Do not exceed 4 seconds.” A two-second interval is the recommended target; four seconds is the limit, not the preferred setting.

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.

Example: FFmpeg command for H.264 1080p30

This illustrative starting point uses YouTube’s recommended 14 Mbps H.264 video bitrate for 1080p30, a two-second GOP, and stereo AAC audio. It has not been run or tested; adapt it to your input, encoder, FFmpeg build, hardware, and the ingest endpoint YouTube provides.

ffmpeg -re -i INPUT 
  -c:v libx264 -preset veryfast -tune zerolatency 
  -b:v 14M -minrate 14M -maxrate 14M -bufsize 28M 
  -g 60 -keyint_min 60 -sc_threshold 0 
  -pix_fmt yuv420p 
  -c:a aac -b:a 128k -ar 44100 
  -f flv "rtmps://INGEST_URL/STREAM_KEY"
  1. Replace INPUT with your source file or input URL.
  2. Replace INGEST_URL and STREAM_KEY with the server address and stream key shown in YouTube Live Control Room. Treat the key as a credential; do not publish or share it.
  3. Check the installed encoder’s supported options with ffmpeg -h encoder=libx264. Encoder controls and GOP behavior can vary by build and implementation.
  4. For a different resolution, frame rate, or codec, change the GOP frame count and bitrate to match that mode’s YouTube recommendations. For example, 60 fps requires -g 120 for a two-second interval; do not reuse the 1080p30 bitrate without checking the applicable table.

The command uses RTMPS, which YouTube recommends in its encoder guidance, and an FLV output container. The actual address and key must come from YouTube. Its Live Streaming API also documents RTMP/RTMPS, HLS, and DASH ingest types; use the address and stream name/key YouTube supplies for the ingest method you choose.

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.

Which audio, color, and rate-control settings matter?

  • Rate control: YouTube lists CBR. In the example, -b:v, -minrate, and -maxrate are set to the same target for the x264 encoder. Encoder-specific behavior can differ.
  • Audio: YouTube’s recommended advanced settings for typical stereo audio are AAC, 44.1 kHz, 128 kbps. Its guidance also lists MP3; 5.1 audio over RTMP/RTMPS is supported only with AAC.
  • SDR color: YouTube recommends Rec. 709, 8-bit. The example sets yuv420p pixel format but does not explicitly set color metadata; verify that your source and encoder produce the intended color signaling.
  • Protocol: Use RTMPS for a straightforward ingest where supported, with YouTube’s supplied stream address and key.

How should you test and monitor the stream?

  1. Run a test before the event using video motion and audio representative of the real stream. YouTube Help specifically advises testing with similar movement and audio.
  2. Check YouTube Live Control Room’s stream-health status while the test is running. Correct warnings before relying on the setup for a live event.
  3. Check that the uplink can sustain the chosen bitrate; run a speed test and leave room for connection variation. If it cannot hold the target, lower the resolution, frame rate, or bitrate rather than assuming a higher target will improve delivered quality.
  4. Keep the stream key private. If it is exposed, replace it through YouTube’s controls before the next broadcast.

FFmpeg and YouTube Live troubleshooting

Symptom or health issue Likely cause What to check or change
Keyframe interval too long GOP frame count is too high for the frame rate, or the encoder does not honor the expected option. Set a two-second GOP in frames (for example, -g 60 at 30 fps) and confirm the selected encoder’s behavior.
Open GOP warning The encoder is producing an open GOP, which YouTube’s health diagnostics flag as unsupported. Check the encoder’s GOP options and configure a closed GOP if the encoder exposes that control; verify in a test stream.
Bitrate too low or unstable The configured rate is below the recommendation, the source or encoder is not maintaining the target, or the uplink cannot sustain it. Check encoder settings and actual upload capacity. If needed, reduce resolution, frame rate, or bitrate to a sustainable mode.
Bitrate too high The encoder is sending beyond the target mode or the connection’s stable capacity. Use the recommended rate for the selected codec and video mode, then retest.
Missing audio or video The input, mapping, encoder, or stream configuration may omit or fail to deliver a track. Inspect FFmpeg’s input and output logs, confirm audio/video tracks are present, and test again in Live Control Room.
Unsupported video codec The chosen encoder output does not match a codec supported for the selected ingest. Use a supported codec and YouTube’s matching settings; for a basic SDR setup, H.264 is a straightforward option.
Primary and backup stream properties do not match The two feeds differ in properties such as codec or configuration. Align the primary and backup stream properties and confirm health with a test.
Connection drops or health fluctuates The uplink may not reliably sustain the selected stream. Use a wired connection where practical, run a speed test, and lower the stream mode until upload is stable.

YouTube’s Live Streaming API health diagnostics include long or excessive GOP size, open GOP, low or high bitrate, missing audio or video, unsupported video codec, and mismatched primary/backup stream properties. A warning identifies a condition to investigate; the exact corrective setting depends on the encoder and stream configuration.

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

Or let it run in the cloud

If your goal is to keep a pre-recorded YouTube stream running around the clock, rather than encode a live camera or desktop feed yourself, StreamNeo is a cloud option: upload a recording or build a playlist, add your YouTube stream key once, and go live. Nothing has to stay on at home; StreamNeo plays uploaded videos to YouTube, not a live camera feed.

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
  • Any quality up to 4K 60fps as uploaded, at one price per slot, with no re-encode or quality tiers.
  • Automatic recovery if YouTube drops the stream.
  • The first day is free with no card, one free day per account.
  • Monthly billing: $9.99 per month.

Start your free StreamNeo day.

Frequently Asked Questions

Does -g always set YouTube’s keyframe interval?

It sets GOP size in frames for encoders that honor the standard option. Check the selected encoder’s documentation and your installed FFmpeg build, then verify the result in a test stream.

Can I use this command unchanged for 60 fps?

No. For a two-second GOP at 60 fps, use 120 frames, and select a bitrate recommended for the actual resolution, frame rate, and codec.

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.

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 *

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.

Read next

Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
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.