Skip to content
streamneo.
Setup Guides11 min read

FFmpeg YouTube Live Bitrate Settings with a 2-Second GOP

Set YouTube Live H.264 bitrate and a two-second GOP in FFmpeg, with the right OBS streaming keyframe control and a practical test checklist.

sn.
StreamNeoPublished 5 October 2026
Worth sharing?

For H.264 YouTube Live, use CBR and choose the video bitrate for the resolution and frame rate you are actually sending. Set the keyframe interval to two seconds; in FFmpeg, where the GOP control is expressed in frames, that means 60 frames at 30 fps or 120 at 60 fps.

In OBS, the setting that matters is under Output > Streaming in Advanced Output mode. Set that streaming encoder’s Keyframe Interval to 2 seconds; do not change the recording encoder and expect it to alter the live broadcast.

Why YouTube asks for regular keyframes

A keyframe is a complete reference frame from which a decoder can begin reconstructing the following frames. Between keyframes, video encoders commonly store changes relative to earlier frames. Regular reference points help a receiving system join, recover, or process a stream without waiting an unpredictable length of time for the next one.

For live ingest, YouTube’s encoder guidance says the recommended keyframe frequency is two seconds and says not to exceed four seconds. That is a recommendation about the interval between keyframes, not an instruction that every tool must express it as a number of frames. In OBS, the relevant field is in seconds; in FFmpeg’s libx264 options, -g expresses the maximum GOP size in frames.

A keyframe interval is only one part of a healthy stream. A two-second interval cannot compensate for an upload connection that cannot sustain the chosen bitrate, an incompatible codec, or an encoder that is overloaded. Conversely, a stream can appear to run while using a bitrate or interval that is not a good match for the chosen output. Treat the YouTube guidance as the starting point, then check the live control room’s stream health while testing.

The official YouTube live encoder settings and bitrate guidance covers keyframe frequency, bitrates, codecs, transport and audio. Its recommendations are ingest settings, not a guarantee of a particular picture quality: source quality, motion, encoder behaviour and network conditions still matter.

Open OBS Advanced Output

Open OBS and go to Settings > Output. Change Output Mode to Advanced if it is set to Simple. Advanced mode exposes separate controls for streaming and recording, which is essential here: OBS can use different encoders and settings for the two jobs.

Select the Streaming tab or section within Output. Depending on the OBS version and platform, the layout and labels may vary slightly, but you are looking for the controls attached to the stream output, not the recording output. Confirm that the streaming encoder is NVIDIA NVENC if that is the encoder you intend to use. The available NVENC label can vary with OBS and driver versions.

If you do not see an NVENC choice, check that OBS can see a supported NVIDIA encoder and that the application is using the intended graphics device. Do not work around a missing streaming control by changing a recording profile: those settings have a separate purpose. If your setup uses software encoding or a different hardware encoder, the equivalent keyframe field may be present under its own streaming controls, but the names and options need not be identical.

Before editing settings, note the current values or take a screenshot. This makes it easier to reverse a change if the next test reveals an unexpected result. If you are also considering moving a prerecorded loop away from a local OBS workstation, this guide to running a prerecorded YouTube stream from a Windows PC without OBS describes a different workflow; it does not replace configuring a local OBS stream.

Select the streaming encoder controls

In Output > Streaming, inspect the encoder selection and the rate control field. For an NVENC H.264 stream, select the H.264 NVENC encoder offered by your OBS installation, then use the streaming-specific controls shown below it. YouTube recommends CBR for this H.264 live workflow. Choose CBR in the rate control field where available, and set the target bitrate to the value that corresponds to your output resolution and frame rate.

Do not infer that a setting is relevant merely because it is visible somewhere in Output. The key question is which output path it controls. Streaming settings affect the encoded video sent to YouTube; recording settings affect the file OBS writes locally. If the encoder selection appears in both places, check which section is active before changing anything.

Other fields may include preset, profile, look-ahead, psycho-visual tuning, B-frames or related encoder options. Defaults are not a reason to alter all of them. Start with the stream’s codec, CBR target, and keyframe interval. Make one change at a time if a test indicates a problem, so you can identify what fixed or worsened it.

The FFmpeg codec documentation explains the libx264 GOP and bitrate controls used in the command-line example below. NVENC is a different encoder, so do not assume that FFmpeg’s option names map one-for-one to OBS fields. The shared concept is a maximum interval between keyframes; set it using the control and units the selected encoder actually offers.

Set the keyframe interval to two seconds

Still in Settings > Output > Streaming, find Keyframe Interval for the NVENC stream encoder and enter 2. In OBS this control is specified in seconds. You are setting a two-second interval, not asking OBS to interpret 2 as two frames.

Leave the recording section alone unless you separately want to alter the local recording. Changing the recording encoder’s keyframe interval does not set the interval sent to YouTube. A common mistake is to scroll through Output, find a similarly named field under Recording, and assume it applies to both outputs. It does not: return to Streaming and check the value in the streaming encoder controls.

After entering the value, apply the settings and reopen the Streaming section to confirm it has persisted. If your OBS version uses a different label or hides the field for the chosen encoder, consult the documentation for that version and encoder rather than substituting a recording control. The aim is a two-second streaming interval; the interface’s exact presentation can differ.

Convert seconds to frames only when needed

Some encoders and command-line options describe a GOP as a number of frames rather than a time interval. In that case, multiply the intended interval in seconds by the frame rate being sent. For a two-second interval, 30 frames per second gives 30 × 2 = 60 frames; 60 frames per second gives 60 × 2 = 120 frames.

This conversion applies to FFmpeg’s libx264 -g option, documented as the maximum GOP size. For example, a 1080p30 H.264 command can use -r 30 and -g 60; a 60 fps output can use -r 60 and -g 120. Do not use -r simply to force a different frame rate unless you intend that conversion. Keep the output frame rate aligned with the source and the workflow you have chosen.

YouTube’s instruction is expressed as a two-second frequency recommendation, with a four-second maximum, not as a required frame count. Thus OBS’s seconds field should remain 2; there is no need to convert it to 60 merely because the stream runs at 30 fps. Conversion is appropriate only when the selected control expects frames.

For a fixed spacing requirement, remember that a maximum GOP size is not necessarily a promise that every interval will be identical under every encoder configuration. Scene changes and encoder-specific behaviour can affect placement. Check the selected encoder’s behaviour and the resulting stream if exact spacing matters to your workflow.

Choose a bitrate for the actual output

YouTube’s recommended H.264 ingest bitrate depends on both resolution and frame rate. Use the row matching the video you send, rather than choosing one familiar figure for every stream. The following values are YouTube’s recommended H.264 video bitrates, not guaranteed visual outcomes.

Output sent to YouTube Recommended H.264 video bitrate
720p at 30 fps 8 Mbps
720p at 60 fps 8 Mbps
1080p at 30 fps 14 Mbps
1080p at 60 fps 17 Mbps
1440p at 30 fps 21 Mbps
1440p at 60 fps 34 Mbps
2160p at 30 fps 42 Mbps
2160p at 60 fps 50 Mbps

These figures are from YouTube’s guidance checked on 3 October 2026. The recommendations are for H.264; do not transfer them to H.265/HEVC or AV1, which have different figures in the official table. Also distinguish video bitrate from total stream bitrate: audio adds to the data sent, as do protocol and other overheads. Allow stable upload capacity above the video target rather than planning a connection that can only just meet it.

For a 1080p30 H.264 FFmpeg example, YouTube recommends 14 Mbps video. In an appropriate libx264 workflow, the rate controls can be set to equal target, minimum and maximum rates for CBR, and -g 60 provides the two-second maximum GOP at 30 fps:

ffmpeg -re -i input -c:v libx264 -preset veryfast \
  -r 30 -b:v 14M -minrate 14M -maxrate 14M -bufsize 28M \
  -g 60 -c:a aac -b:a 128k -f flv 'rtmps://INGEST_URL/STREAM_KEY'

Replace the input and destination placeholders with your own source and YouTube ingest destination. Never publish your stream key. FFmpeg’s maxrate control requires bufsize; the example’s buffer value is an example for this command, not a universal YouTube requirement. Select buffer and rate-control behaviour for your encoder workflow. At 1080p60, the corresponding recommended H.264 video target is 17 Mbps, with a 120-frame GOP if output is 60 fps.

If your connection cannot sustain the chosen output reliably, consider a lower resolution or frame rate and then use the matching bitrate recommendation. A lower target that your connection can maintain is more useful than a higher target that repeatedly strains upload capacity. When diagnosing interruptions on a long-running channel, the checklist for a 24/7 YouTube stream that keeps stopping can help separate encoder and connection symptoms from playlist or content issues.

Verify streaming rather than recording settings

Use a short checklist before you go live:

  • In Settings > Output, confirm Output Mode: Advanced.
  • In Streaming, confirm the intended NVENC H.264 encoder, rate control and bitrate.
  • In that same Streaming section, confirm Keyframe Interval: 2.
  • In Recording, do not treat a separate keyframe value as evidence of what the stream sends.
  • Confirm the resolution and frame rate in use, then match the bitrate recommendation to them.

The distinction is especially easy to miss when both outputs use NVENC. They can still have separate configuration. If you change the streaming interval and later inspect Recording, a different value there does not mean your stream setting failed. Verify the streaming controls themselves, then confirm behaviour in YouTube’s live control room.

Keep a record of the streaming values that worked for the specific machine, source and output. That is useful when an update resets a profile or when you switch from a 30 fps programme to a 60 fps source. It also prevents a recurring setup error: copying a recording profile and assuming every field controls the live output.

A continuous channel has another failure mode worth checking separately: the content can finish or leave a gap even while the encoder is functioning. For looped material, see how to avoid playlist gaps when rotating videos on a YouTube 24/7 stream in India. That is a scheduling issue, not something a keyframe setting can fix.

Test the stream before relying on it

Start with a private or otherwise appropriate test broadcast, using the same resolution, frame rate, encoder and content type planned for the real channel. Include a representative section of the material: a static devotional image and a fast-moving video place different demands on an encoder, while spoken or musical audio reveals problems that a silent test will not.

Watch YouTube’s stream health indicators while the test runs. Check for warnings, unstable ingest, dropped frames or audio problems, and compare the reported stream with your intended output. YouTube also advises testing before going live and checking upload speed. A speed test is a useful indication, but it does not prove that the connection will remain stable under sustained load, particularly when other people or devices share it.

If YouTube reports a bitrate problem, first compare the actual output resolution and frame rate with the selected H.264 recommendation. Then check whether the encoder is dropping frames or the connection is struggling. Reduce output demands if necessary and test again. If the video appears intact but the stream health reports irregular keyframes, revisit the Streaming keyframe control, not the recording settings.

For an always-on channel, repeat the test after meaningful changes such as an OBS update, a new encoder selection, a change of output frame rate, or a network change. Monitor a real run rather than assuming that a single successful start proves the setup will remain healthy overnight. StreamNeo can remove the need to leave your own computer on for a prerecorded 24/7 broadcast; for a local OBS setup, the test and monitoring steps still matter.

Before committing, compare the operating options on the pricing page. When the file and channel are ready, start free — 24-hour trial, no card.

FAQ

What should -g be for 30 fps or 60 fps?

For a two-second maximum GOP in FFmpeg libx264, use -g 60 at 30 fps or -g 120 at 60 fps. This conversion is for a frame-count control; OBS’s streaming Keyframe Interval field is in seconds, so enter 2 there.

Does the OBS recording keyframe interval change my live stream?

No. The recording and streaming sections configure different outputs. Set and verify the value under Settings > Output > Streaming for the encoder sending video to YouTube.

What bitrate should I use for 1080p YouTube Live?

For H.264, YouTube recommends 14 Mbps at 1080p30 and 17 Mbps at 1080p60. Match the setting to the actual frame rate you send, and check YouTube’s current official table before a live run.

Is a two-second keyframe interval a guarantee of a healthy stream?

No. It follows YouTube’s recommended frequency, but it does not guarantee stable upload, clean audio or a particular picture quality. Test the full setup and monitor YouTube’s stream health indicators.

YOU’VE REACHED THE END

Keep the ideas coming.

More guides, useful tools and a little help for your next broadcast.

Back to the journal ↗
YOUR NEXT READ

A little more to explore.

More Setup Guides guides ↗ · All topics ↗