Skip to content
streamneo.
Setup Guides10 min read

OBS YouTube Stream Keyframe Interval: Where to Set 2 Seconds

Set OBS’s streaming keyframe interval for YouTube, convert two seconds to frames at 60 fps, and check the selected encoder before going live.

sn.
StreamNeoPublished 4 October 2026
Worth sharing?

In OBS, set the streaming encoder’s keyframe interval to 2 seconds under Settings → Output. If you are configuring FFmpeg or a custom x264 parameter instead, translate that time into frames for your chosen frame rate; at 60 fps, the two-second target is 120 frames.

YouTube recommends a two-second keyframe frequency and says not to exceed four seconds. The exact controls and their effect depend on the output mode and encoder you select, so check the active encoder and verify a representative test stream rather than assuming a saved field guarantees the result.

Use YouTube’s two-second target

A keyframe is a frame that can be decoded without relying on earlier picture frames. Between keyframes, video encoders commonly represent changes relative to earlier frames. A keyframe interval, also called a GOP interval in encoder settings, describes how frequently the encoder inserts one. The setting matters to a live service because it affects how incoming video can be processed and how quickly a viewer or downstream system can begin decoding a segment.

For YouTube live streaming, its current encoder guidance recommends keyframes every 2 seconds and says not to exceed 4 seconds. Treat the two-second value as the target to configure, not as a promise that every OBS encoder exposes an identical control or that every stream will be healthy once it is set. See YouTube’s live encoder settings for the current guidance, supported settings and advice on testing.

In OBS, the ordinary route is Settings → Output. If the streaming controls are not visible, change Output Mode to Advanced, then look for Keyframe Interval in the streaming encoder section. Set it to 2 seconds if the selected encoder provides a seconds-based field. OBS versions and encoders can label or place controls differently, so use this path as a guide and check the setting for the encoder actually selected for streaming.

Do not confuse this with a recording encoder setting. OBS may allow separate streaming and recording configuration, and the video file you record locally is not necessarily encoded using the same controls as the live output. Make sure you are changing the streaming encoder’s interval. If you are preparing a pre-recorded loop rather than encoding through OBS, a separate FFmpeg command may control the output; the distinction between a file loop and a live encode is discussed in this FFmpeg guide to looping worship video without re-encoding.

Convert two seconds to frames at 60 fps

A frame interval expressed in seconds and a GOP length expressed in frames are different units. Convert between them using the output frame rate:

frames per interval = frames per second × interval in seconds

At 60 frames per second, a two-second interval is 60 × 2 = 120 frames. That is the requested conversion for this guide’s 60 fps example. At 30 fps, the same interval is 30 × 2 = 60 frames. The count changes with the frame rate; 120 is not a universal two-second value.

Output frame rate Two-second frame interval Interpretation
30 fps 60 frames 30 frames each second for two seconds
60 fps 120 frames 60 frames each second for two seconds

These are arithmetic conversions, not independent YouTube requirements or a guarantee of how a selected encoder will behave. First establish the frame rate of the stream output, then use the correct units for the relevant field. If OBS asks for seconds, enter 2 rather than 120. If a custom x264 option asks for frames, use the converted frame count that matches the output rate.

Frame-rate changes also change the frame count needed to preserve a time interval. If a setup changes from 30 to 60 fps but the custom frame-count option remains at 60, its intended time span is no longer two seconds. That is why a number copied from someone else’s setup can be wrong even when both streams target YouTube. Check the actual output frame rate and the encoder parameter’s units together.

Set the FFmpeg GOP interval

When FFmpeg invokes libx264, the common keyframe interval control is -g, which sets the GOP size in frames. For a 60 fps output and a two-second target, the corresponding value is 120. A representative option fragment is:

-g 120

This is a parameter fragment, not a complete command and not a tested recipe. It only expresses the intended GOP frame count. It does not by itself select the output frame rate, confirm which encoder was loaded, or establish that an actual stream follows the requested cadence. In a full command, ensure the output rate is set as intended and that -g applies to the selected video encoder.

For libx264, keyint is the underlying encoder option for the maximum keyframe interval. A custom-parameter field may expect an option such as keyint=120; it expects a frame count, not the text “2 seconds”. The OBS forum discussions provide historical navigation clues about the distinction between the seconds-based UI field and custom x264 frame values, but they are community posts rather than current formal documentation: OBS discussion of keyframe settings and OBS discussion of keyframe frequency.

Check the syntax accepted in the exact place you are entering the option. FFmpeg’s command-line options, a GUI’s custom encoder field and OBS’s own keyframe interval control are not interchangeable merely because they concern the same timing. Avoid applying both a custom parameter and a UI control unless you understand which one takes precedence for the selected encoder.

If you need more FFmpeg context, the guide to restarting a looping ASMR stream automatically is relevant to continuity and process recovery, but restarting a process and setting a GOP interval solve different problems. A process can restart successfully while the encoder settings are still not what you intended.

Consider fixed-cadence options

A maximum GOP size and a fixed keyframe cadence are related but not always identical concepts. A maximum interval tells an encoder how far apart keyframes may be; a fixed-cadence option can request a more regular interval. Depending on the encoder and how it is configured, scene changes or other rules may cause keyframes to appear sooner than the maximum. Do not assume that entering a GOP size alone means keyframes will occur at precisely even two-second marks.

With libx264, -g sets the GOP size. The -keyint_min option sets a minimum interval between keyframes, which can constrain how soon another keyframe may appear. Users sometimes pair the two to encourage a more consistent cadence. The appropriate values depend on the desired behavior and encoder configuration; do not add a minimum value without checking what it does in the selected version and context. A setting that appears to make cadence more regular may also limit the encoder’s freedom to place a keyframe sooner when the image changes substantially.

For a 60 fps output, any frame-count value intended to represent two seconds must be considered against 120 frames. Do not use a value above that target on the assumption it will still meet YouTube’s recommended two-second frequency; YouTube’s separate outer guidance is not to exceed four seconds. The simple, safer starting point is to use OBS’s seconds field where available and leave additional custom GOP constraints out until there is a specific reason to use them.

The encoder documentation is the right place to confirm option meaning and syntax for the version you use. A command example from a different FFmpeg build or a tutorial using a different encoder may not map cleanly to your setup. If the available settings are unclear, prefer a field whose units are explicit and avoid stacking multiple controls that could conflict.

Use a closed GOP for optimal transcoding

A closed GOP is a group of pictures that can be decoded without depending on frames outside that group. In contrast, an open GOP may use references that cross a GOP boundary. This distinction can matter when a service transcodes incoming video, because independently decodable groups are easier to handle at boundaries. YouTube’s encoder guide discusses keyframe frequency, but it does not state that a particular OBS checkbox or closed-GOP setting guarantees optimal transcoding.

If the selected encoder exposes an option for a closed GOP, understand its effect before enabling it. With libx264, -flags +cgop is an FFmpeg-style way of requesting a closed GOP, but whether the option is accepted and how it behaves depends on the actual encoder path and invocation. Treat it as an encoder request to verify, not proof of the resulting bitstream. An OBS interface may not expose the same option, and a custom field may use different syntax.

The useful practical distinction is between setting the two-second maximum interval and choosing whether a GOP may reference across its boundary. These are separate questions. Start by meeting the interval target with the active encoder’s available control; consider closed-GOP behaviour only where your workflow needs it and the encoder’s documentation confirms the option. Do not add extra parameters simply because they appear in a command found online.

For a live stream, test the output through YouTube and observe its stream health indicators. If YouTube reports a problem, check the full configuration rather than treating the GOP setting as the only possible cause. Resolution, frame rate, bitrate, network conditions and audio/video consistency all affect the ingest experience. This troubleshooting guide for an RTMP stream that starts but never goes live can help separate a connection or ingest problem from an encoder-setting question.

Confirm the active encoder’s behaviour

OBS’s saved setting is not a bitstream inspection. The selected encoder may be software x264, a hardware encoder or another available implementation, and their controls can differ. A field named “Keyframe Interval” may be presented in seconds while a custom encoder option is in frames. A streaming-service preset may also supply settings automatically. Historical OBS forum advice refers to Advanced output mode and a service-enforced setting, but the posts are old; use them as clues, not as authoritative descriptions of every current OBS release.

First note the output frame rate and the streaming encoder selected in Settings → Output. Then inspect which interval controls are available for that encoder and whether the value is specified in seconds or frames. If you have supplied a custom parameter, check the encoder’s documentation for its syntax and precedence. Do not infer that keyint=120 means two seconds unless the stream output is 60 fps.

Run a representative test before relying on the configuration for an important broadcast. YouTube recommends testing with audio and video movement similar to the actual stream and monitoring stream health. A static image test may not exercise the same workload as a devotional video with moving backgrounds, a news loop with changing scenes or a lofi channel with animation. Include audio if your production stream will include it, and watch for YouTube’s messages rather than assuming a green-looking local preview confirms ingest behaviour.

A practical record of the encoder, output frame rate, interval field and any custom options makes troubleshooting easier later. If a test shows a problem, change one relevant setting at a time and test again. Avoid making several changes together, because then you cannot tell whether the interval, bitrate, frame rate or another variable affected the result. For always-on channels, think beyond the first successful start: recovery and ongoing observation matter too. This guide on keeping a restream running when your computer is off addresses continuity, which is separate from keyframe timing.

If you prefer not to keep a computer encoding a file around the clock, StreamNeo removes that particular burden: you upload the video, provide your YouTube stream key, and the broadcast runs with your computer switched off. It does not change the need to choose suitable video settings and check YouTube’s stream health.

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

Where exactly is the keyframe interval in OBS?

Open Settings → Output and look in the streaming encoder section. If the relevant controls are hidden, switch Output Mode to Advanced. Labels and available fields can vary by OBS version and selected encoder, so confirm you are editing streaming output rather than recording output.

Is 120 the right value for a two-second interval?

It is the frame-count conversion at 60 fps: 60 frames per second multiplied by 2 seconds equals 120 frames. At 30 fps, two seconds is 60 frames. Use 2 when the field expects seconds; use a converted frame count only where the encoder parameter expects frames.

Does setting the interval guarantee YouTube will accept the stream?

No. The setting is one part of the encoder configuration, and a saved value does not prove how the selected encoder behaved in the output. Test with representative audio and video, monitor YouTube’s stream health and check the current official encoder guidance.

Should I use -g or keyint?

For FFmpeg with libx264, -g expresses GOP size in frames, while keyint is the corresponding libx264 interval parameter. Use the syntax supported by the interface and encoder you actually selected, and relate the frame count to the output frame rate. Neither option alone is a complete, tested streaming command.

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 ↗