YouTube Live

YouTube Keyframe Frequency Error: How to Fix It in OBS, vMix and FFmpeg

By the StreamLivestic team · · 12 min read

Keyframe Error Fixed — youtube keyframe frequency error

The YouTube keyframe frequency error means your encoder is sending a full picture (a keyframe) less often than once every four seconds, so YouTube marks your stream health "Poor" and warns that viewers may buffer. The fix is almost always one setting: a fixed keyframe interval of 2 seconds. The one case where that setting does nothing is when you stream a pre-recorded file with -c copy, and we cover that one in detail because we hit it ourselves.

Quick fix: In OBS or Streamlabs go to Settings → Output → Output Mode: Advanced → Streaming, and set Keyframe Interval to 2 (not 0). In vMix set Keyframe Frequency to 2 seconds. In FFmpeg use -g = 2 × your frame rate plus -keyint_min (same value) and -sc_threshold 0. If you loop a file with -c copy, re-encode the file once with 2-second keyframes. Then stop and restart the stream.

What the error actually means

The full message in YouTube Studio's Live Control Room reads: "Please use a keyframe frequency of four seconds or less. Currently, keyframes are not being sent often enough, which can cause buffering." It usually comes with stream health set to Poor, even when everything else (bitrate, frame rate, connection) looks fine.

A video stream is mostly made of small "difference" frames that only describe what changed since the last frame. Every so often the encoder sends a keyframe (an I-frame or IDR frame): a complete picture that can be decoded on its own. The distance between two keyframes is called the GOP (group of pictures) or keyframe interval.

YouTube cares about this because it does not send your stream to viewers as-is. It transcodes it into several qualities (1080p, 720p, 480p and so on) and cuts each one into short segments. A segment can only start on a keyframe, a new viewer can only start watching at a keyframe, and the player can only switch quality at a keyframe. When keyframes arrive every 6, 8 or 10 seconds, every one of those steps waits longer. That is what YouTube is measuring: the time between keyframes in what you send. Its official guidance is a 2-second interval and "Do not exceed 4 seconds".

The error is about spacing, not quality. Your stream can look perfect on your preview and still be "Poor" because of this single number. It also does not mean frames are being dropped. Those are separate warnings.

Why it happens

Here are the real causes of the YouTube keyframe frequency error, most common first.

  1. Keyframe Interval left at 0 (auto) in OBS or Streamlabs. "Auto" does not mean "whatever YouTube wants". It hands the decision to the encoder. With x264 that default is 250 frames, which is about 8.3 seconds at 30 fps and 10 seconds at 25 fps. Even at 60 fps it is roughly 4.2 seconds, just over the limit.
  2. Streaming a pre-recorded file with -c copy. When FFmpeg (or a cloud tool built on it) copies the video stream without re-encoding, the keyframes are exactly where the file's original export put them. Many editors and export presets place them 5–10 seconds apart, or only at scene changes. No encoder setting can fix that, because nothing is being encoded.
  3. Keyframe interval set in frames, not seconds. FFmpeg's -g, hardware encoder web panels and IP cameras often ask for frames. A GOP of 240 frames is exactly 4 seconds at 60 fps, but drop to 30 fps and the same 240 becomes 8 seconds. Values like 250 or 300 copied from old forum posts are over the limit at most frame rates. Change the frame rate and you must recalculate.
  4. Custom encoder options overriding the field. In OBS, anything in "x264 Options" such as keyint=300 wins over the Keyframe Interval box. People paste "quality" presets from old guides and forget about them.
  5. Scene-cut detection on a file with a long maximum GOP. Encoders like x264 add extra keyframes at scene changes. Files encoded this way have irregular spacing: two keyframes one second apart during an action scene, then nothing for eight seconds during a slow dialogue. The average looks fine; the gaps do not.
  6. Variable frame rate sources. Phone footage and some screen recordings have a frame rate that drifts. A keyframe every N frames then lands at a different time each GOP, and long gaps creep in.
  7. Hardware encoders and cameras with their own GOP setting. Standalone encoders, PTZ and IP cameras, and some capture devices have an "I-frame interval" or "GOP" field in their web UI, often defaulting to a large number.
  8. Primary and backup streams configured differently. If you send a backup ingest, YouTube asks for both to use the same keyframe frequency and shows a separate warning when they differ.

How to fix the YouTube keyframe frequency error

Whatever tool you use, the target is the same: one keyframe every 2 seconds, at a fixed cadence. Encoder settings can't be changed mid-stream in most apps, so end the stream, change the setting, and go live again. Give the Live Control Room a few minutes after the new stream starts for the health panel to update.

Use this table to convert 2 seconds into frames when a tool asks for frames:

Frame rateKeyframe every 2 s (frames)Maximum allowed, 4 s (frames)
24 fps4896
25 fps50100
30 fps60120
50 fps100200
60 fps120240

1. OBS Studio: set Keyframe Interval to 2

  1. Open Settings → Output.
  2. Change Output Mode from Simple to Advanced. Simple mode hides the keyframe field.
  3. On the Streaming tab, find Keyframe Interval (shown as "0 = auto" in some versions). Type 2. The unit is seconds.
  4. If you use x264, check the x264 Options box at the bottom and delete any keyint= or min-keyint= entries.
  5. In Settings → Stream, leave "Ignore streaming service setting recommendations" unticked unless you have a reason. With it unticked, OBS can apply the service's recommended limits, but don't rely on that alone; set the value yourself.
  6. Click Apply, start streaming, and check the health panel in YouTube Studio.

The same field exists for every encoder OBS offers: x264, NVIDIA NVENC, Intel QuickSync and AMD AMF/VCE. Set it to 2 in whichever one you have selected. Switching encoders can show a different panel, so check it again after you switch.

2. Streamlabs Desktop

  1. Go to Settings → Output.
  2. Set Output Mode to Advanced.
  3. Under the Streaming section, set Keyframe Interval to 2.
  4. If you have anything in the x264 options or custom encoder settings, remove keyframe overrides there too.
  5. Save, go live, confirm in YouTube Studio.

Streamlabs is built on OBS, so the same "0 = auto" trap applies. If you've used an auto-optimizer before, open the Advanced view and check the value yourself rather than trusting it.

3. vMix

  1. Click Stream at the bottom to open the streaming settings.
  2. Next to Quality, click the gear icon to open Streaming Quality.
  3. Set Keyframe Frequency to 2 seconds.

The vMix help lists 2 seconds as the default, so if you see this error in vMix, someone has raised it (often to squeeze out quality) or you are using a custom profile. Higher values do look slightly better at the same bitrate. On YouTube they cost you stream health, which is not worth it.

4. Hardware encoders (NVENC, QuickSync, AMF) and standalone boxes

Inside OBS, Streamlabs or vMix, GPU encoders follow the app's keyframe field, so steps 1–3 cover them. Outside those apps:

5. FFmpeg for live encoding

For a live input (camera, screen, or a file you are re-encoding on the fly), these flags give you a keyframe exactly every 2 seconds. Example for 30 fps:

ffmpeg -re -i input.mp4 \
  -c:v libx264 -preset veryfast -b:v 4500k -maxrate 4500k -bufsize 9000k \
  -r 30 -g 60 -keyint_min 60 -sc_threshold 0 \
  -bf 2 -pix_fmt yuv420p \
  -c:a aac -b:a 128k -ar 44100 \
  -f flv rtmp://a.rtmp.youtube.com/live2/YOUR-STREAM-KEY

If your source has a variable frame rate, or you'd rather think in seconds than frames, force keyframes by time instead:

-force_key_frames "expr:gte(t,n_forced*2)"

That places a keyframe at 0, 2, 4, 6… seconds of output time no matter the frame rate. Keep -sc_threshold 0 with it. Flag details are in the FFmpeg libx264 documentation.

6. Streaming a pre-recorded file with -c copy: re-encode the file

This is the case most guides on the YouTube keyframe frequency error skip, and it is the one that caught us. A typical 24/7 loop looks like this:

ffmpeg -re -stream_loop -1 -i video.mp4 -c copy -f flv rtmp://a.rtmp.youtube.com/live2/YOUR-STREAM-KEY

-c copy is brilliant for long loops: almost no CPU, no quality loss, no encoder to overload. But it sends the video exactly as it sits in the file. If the file's keyframes are 6 seconds apart, YouTube receives keyframes 6 seconds apart, and there is no flag you can add to this command to change that.

Our test. We streamed a 12-minute 720p, 24 fps H.264/AAC kids' cartoon on a loop to YouTube from our cloud server using FFmpeg with -c copy. It ran for 9 hours without a single drop, but YouTube Studio marked stream health "Poor" with exactly this keyframe error. The file had a keyframe only every 5–6 seconds, straight from its original export. We re-encoded it with libx264 using -g 48 -keyint_min 48 -sc_threshold 0 (2 seconds at 24 fps) and AAC at 128k. The next stream showed "Excellent" in YouTube Studio.

First, check your file. This lists the timestamp of every keyframe without decoding the video, so it's fast even on long files:

ffprobe -v error -select_streams v:0 -show_entries packet=pts_time,flags -of csv=p=0 video.mp4 | grep K

Look at the gaps between consecutive times. If any gap is over 4 seconds, re-encode. Under 2.5 seconds everywhere and steady, you're fine.

Then re-encode once and loop the new file with -c copy as before. The keyframe and audio settings below are the ones from our test (at 24 fps). The preset and CRF are a sensible starting point, not magic numbers:

ffmpeg -i video.mp4 \
  -c:v libx264 -preset medium -crf 20 -maxrate 4000k -bufsize 8000k \
  -g 48 -keyint_min 48 -sc_threshold 0 -pix_fmt yuv420p \
  -c:a aac -b:a 128k -ar 44100 \
  -movflags +faststart video_2s.mp4

Change 48 to 2 × your file's frame rate (60 for 30 fps, 50 for 25 fps). Run ffprobe again on video_2s.mp4 to confirm the gaps are exactly 2 seconds before you go live.

Re-encoding a long file takes a while on a small server, but you do it once. After that the loop runs on -c copy again with near-zero CPU. On StreamLivestic we do this check on every uploaded video and re-encode automatically when keyframes are more than 4 seconds apart, so you don't have to run these commands yourself.

Why 2 seconds, and why scene-cut keyframes break it

YouTube's limit is 4 seconds, so why not set 4 and keep the extra quality? Because 4 is the ceiling, not the target. YouTube's own advice is 2 seconds, and its error page says so directly: "Change so keyframes are sent every 2 seconds. At 30fps, that is every 60 frames." A 2-second cadence gives you headroom. A dropped or delayed frame, a frame-rate wobble, or a rounding difference won't push you over the limit. It also gives new viewers a faster start and lets the player switch quality sooner when someone's connection dips.

Going lower isn't better either. YouTube has an opposite warning, "The GOP (group of pictures) size is small, which can reduce image quality", because keyframes are expensive in bits. At 1 second you spend a large share of your bitrate on full pictures and the in-between frames get blurrier.

Scene-cut detection is the hidden problem. By default x264 (and many GPU encoders) insert a keyframe whenever the picture changes sharply, which is great for files you watch on disk. For live delivery it causes two problems:

That's why the fix always comes as a pair: -g and -keyint_min set to the same number, plus -sc_threshold 0. Together they lock the cadence to exactly one keyframe every 2 seconds.

Keyframe interval is the same at every resolution. Bitrates below are YouTube's H.264 minimum and recommended figures as listed in YouTube Help when we checked in November 2026.

ResolutionFrame rateKeyframe intervalGOP (frames)Video bitrate (min / recommended)
720p30 fps2 s603 / 8 Mbps
720p60 fps2 s1203 / 8 Mbps
1080p30 fps2 s605 / 14 Mbps
1080p60 fps2 s1206 / 17 Mbps
1440p30 fps2 s607 / 21 Mbps
1440p60 fps2 s1208 / 34 Mbps
4K (2160p)30 fps2 s6011 / 42 Mbps
4K (2160p)60 fps2 s12014 / 50 Mbps

Other settings YouTube lists: constant bitrate (CBR), 2 B-frames, 1 reference frame, progressive scan, AAC audio at 128 kbps stereo and 44.1 kHz. Your upload speed should comfortably exceed your total bitrate. If you can't reach the recommended figure, staying above the minimum is fine, and the keyframe fix works the same either way.

How to stop it coming back

FAQ

What keyframe interval should I use for YouTube Live?

Use 2 seconds. YouTube recommends 2 seconds and says not to exceed 4. In frames that is 2 times your frame rate, for example 60 at 30 fps or 48 at 24 fps.

Is keyframe interval 0 (auto) OK in OBS?

No. Auto hands the choice to the encoder, and with x264 that default is 250 frames, which is over 4 seconds at most frame rates. Type 2 into the Keyframe Interval field instead.

Will the keyframe error stop my stream?

No, the stream keeps running, but YouTube marks health as Poor and viewers may see slower starts and more buffering. It is worth fixing before your next stream.

Why do I still get the error after changing OBS settings?

Check that Output Mode is Advanced, that no keyint value is set in the x264 or custom encoder options, and that you restarted the stream. If you stream a file with -c copy, encoder settings are not used at all and you must re-encode the file.

How do I check keyframe spacing in a video file?

Run ffprobe -v error -select_streams v:0 -show_entries packet=pts_time,flags -of csv=p=0 video.mp4 | grep K and look at the gaps between the timestamps. Any gap over 4 seconds will trigger the error when streamed with -c copy.

Can I set the keyframe interval lower than 2 seconds?

You can, but YouTube shows a separate warning when the GOP is too small, because frequent keyframes waste bitrate and reduce image quality. 2 seconds is the safe middle.

Does a higher frame rate change the keyframe setting?

In seconds, no: keep it at 2. If your tool asks for frames, recalculate, because the same frame count means a different time at a different frame rate.

YouTube Livekeyframe intervalstream healthOBS StudioStreamlabsvMixFFmpegNVENC24/7 streamingencoder settings

Sources & official docs