What we do Features Showcase Pricing Jukebox TV Blog

OBS keyframe interval: what is the correct keyframe interval for live streaming?

Keyframe interval (also known as keyframe period, sometimes written as key frame interval) is a crucial parameter to take into account when transcoding video, as it is one of the most critical parameters after bitrate and resolution. It determines how frequently a full frame of video is encoded into the stream, which can affect the video quality, the bitrate required for the stream, and the decoder's ability to recover from lost packets. However, other parameters can also have a significant impact on the transcoding process.

For instance, the codec used for encoding, the number of reference frames, and other parameters can also have a significant impact on the quality and performance of the transcoded video. Furthermore, the network conditions and the end-users device can also have a significant effect on the final video quality.

OBS keyframe interval 0 vs 2 ? 0 for sure is not the recommended one for any live stream but there is no good, correct, recommended, perfect value for keyframe interval, even if some Online Video Providers (OVPs) recommend or restrict to some fixed value.

OBS keyframe interval: what is the correct keyframe interval for live streaming
keyframe bits in red, other frames in blue in this 10-second video segment

Is there a best or correct keyframe interval for live streaming?

The optimal keyframe interval for live streaming can vary depending on the specific needs of the stream and network conditions. Please be aware that a shorter keyframe interval can put more strain on the encoder, leading to higher CPU usage and making it harder to maintain a consistent bitrate. This can be an issue when working with limited resources, such as a low-powered computer or a slow or unreliable internet connection.
For a brief answer without elaboration, read our two recommendations based on your requirements at the bottom of the page.

What is the origin of the commonly used 2-second keyframe interval?

"What is the correct keyframe interval for live streaming" (in OBS Studio or others) is a common question answered by copywriters as "2 seconds". Coincidentally, there is never a video quality demo available for the recommended key frame interval settings. Why would we bother having a keyframe interval parameter in transcoders if this was the answer for all use cases and where does this "copy-paste value" come from?

In traditional broadcasting like cable TV, the keyframe interval is established by the standard used for video compression, typically MPEG-2 or H.264. These standards typically set the keyframe interval to several seconds, usually between 1-3 seconds, to ensure smooth decoding of the video on the final device, such as a TV or set-top box. The 2-second keyframe interval is a commonly used and unwritten standard for set-top boxes, as decoders or players that use MPEG-2 need frequent keyframes to function properly.

However, live streaming has distinct needs compared to traditional broadcasting. As it is delivered over the internet using codecs such as H.264 and newer ones, the quality of the video can be impacted by factors like the internet connection and the viewer's device. Thus, live streaming doesn't have to rely on the best practices set by MPEG-2.

Why would a decoder need frequent keyframes?

Keyframes, also known as I-frames, are full frames of video that are encoded independently of other frames. They contain all the information needed to decode the video and display it on the screen. They are different from P-frames and B-frames, which are encoded based on the information from the previous keyframe.

When a decoder receives a video stream, it begins decoding the video starting with the first keyframe it receives. Then it uses the information from the subsequent P-frames and B-frames to fill in the missing details and reconstruct the video. If the decoder receives a new keyframe, it can discard the information from the previous keyframe and begin decoding the video again with the new keyframe.

A decoder needs frequent keyframes for two main reasons:

  • Resilience to errors: In case of lost or corrupted data during transmission, the decoder can use the information from the latest keyframe to rebuild the video and minimize the effects of the lost data. However, current standards for live streaming and VOD like HLS or DASH are more resilient to packet loss
  • Smooth playback: When the decoder receives a new keyframe, it can discard the information from the previous keyframe and begin decoding the video again with the new keyframe. This can help ensure smooth playback of the video, as the decoder can start displaying the new video data as soon as it's received, rather than waiting for all the data from the previous keyframe to be received.

Does HLS have a better capability to handle network fluctuations compared to previous streaming methods?

HTTP Live Streaming (HLS), which has been widely used for live streaming over the past decade, is a more resilient streaming protocol for network variations compared to earlier streaming standards

HLS works by breaking the video into small segments and creating multiple versions of each segment at different bitrates. These segments are then made available to viewers in a playlist, and the viewer's device will switch to the appropriate segment based on the current network conditions. This allows the video to be streamed at the highest quality possible given the viewer's network connection and device capability

One of the key features of HLS is the ability to adapt to changing network conditions by switching between different bitrate versions of the same segment. This is known as adaptive bitrate streaming. This feature allows HLS to provide a better viewing experience on variable network conditions, as the video quality can adjust automatically to the viewer's network connection.

Additionally, HLS also uses HTTP as a transport protocol which is supported by most devices and networks, which makes it more widely compatible than other streaming standards.

What is the default value for keyframe interval in OBS?

Contrary to popular belief, the default keyframe interval in OBS Studio, the latest version of OBS (Open Broadcasting Software), is not set to 2 seconds. It is actually set to 250 frames when the keyframe interval is set to "0 auto" value.

The keyframe interval is the time or the number of frames between each keyframe (I-frame) in a video stream and it's measured in seconds or number of frames. A keyframe interval of 2 seconds means that a new keyframe is inserted in the video stream every 2 seconds, and a keyframe interval of 250 frames means that a new keyframe is inserted in the video stream every 250 frames. It is safer to use seconds, as the playback relies on seconds, and a keyframe interval expressed in frames will have different values depending on the frame rate. For example, for a 25 fps frame rate, the keyframe interval will be 10 seconds, but it will be 8.33 seconds for 30 fps and 4.16 seconds for 60 fps.

Therefore, it is not a good choice for a broadcaster to choose "auto" for keyframe interval, instead, it is recommended to choose advanced mode in output to set it accordingly.

What are some software options for determining the keyframe interval of a video stream or file?

There are several software tools you can use to check the keyframe interval of a video stream or file. Some of the most popular options include:

  1. FFmpeg: FFmpeg is a free and open-source command-line tool for multimedia handling. It allows you to check the keyframe interval of a video stream or file by using the "-show_frames" option. This will display all the frames of the video and their types, including the keyframes.
  2. MediaInfo: MediaInfo is a free, open-source software that displays detailed information about video and audio files, including the keyframe interval. It can be used for both Windows and MacOS.
  3. VLC media player: VLC media player is a free, open-source media player that can play a wide range of video and audio formats. It has a built-in media information window that can display the keyframe interval of a video file, among other information
  4. HandBrake: HandBrake is a free, open-source video transcoding software that can be used to convert video files from one format to another. It has a built-in feature to check the keyframe interval of a video file, among other information.
  5. Streamlink: Streamlink is a free and open-source command-line utility that allows you to watch online video streams in a media player of your choice. It also has the option to display the keyframe interval of a video stream.

These are a few examples of software tools available, but there are other options available, such as commercial software (Elecard StreamEye, Telestream Switch), that may have more features and options to check the keyframe interval of a video stream or file.

Which keyframe interval do I NEED for MY OWN live streaming use case ?

Case 1: I want the best possible video quality and consistent performance during playback.

For optimal live streaming quality and reliability, Apple - the creator of HLS - suggests using a 6-second segment duration and a 15-minute window size at a minimum. To ensure a top-notch live broadcast, it is important to select an online video provider that adheres to and exceeds these recommendations from Apple.

Many HLS players are not able to change resolutions at any point other than the start of a segment. To achieve the best video quality on these players, it is not necessary to use a shorter keyframe interval than the segment duration, as it would result in unnecessary keyframes and wasted bits. A 6-second keyframe interval is highly recommended for video quality and reliability. However, if you plan to use only Apple's ecosystem, such as Safari and native players (AVPlayer) on iOS, iPadOS, and tvOS, these players can handle switching during a segment. In this case, you can use a shorter keyframe period, like 3 seconds, but it may slightly degrade the video quality, as the player will attempt to switch to a higher resolution more frequently..
Explore our other articles to enhance your video quality even more.:
Maximize your live streaming performance with our expert guide on how to correctly configure OBS Studio in 2023

Case 2: I prioritize swift interaction with my live-streaming viewers, and this is the sole motivation.

For minimal delay in live streaming, select an online video provider that offers low latency and set a 1-second keyframe interval in your transcoder. If a 3 to 5 seconds end-to-end delay is acceptable, then a 2-second keyframe interval can be used..
  • Choosing a shorter 1-second keyframe interval may have some tradeoffs in terms of quality of service. The player will change resolutions more frequently, resulting in smaller segment sizes and more frequent adaptive bitrate checks. Additionally, buffering may occur more often due to the increased resolution switching and if the viewer's network is not able to download the segments quickly enough. Consider these potential drawbacks when deciding between a 1 or 2-second keyframe interval..
  • If possible, configure your transcoder for zero-latency tuning.

What is the keyframe interval on the demo TV channel below?

The chosen keyframe interval is 6 seconds as there are no latency requirements, and this is one of the most important parameters to adjust to get higher quality

Use best OBS transcoder settings for any live streaming or recording scenario

iReplay.TV Free trial
No subscription
No credit card required
Article written by
Sylvain Corvaisier (LinkedIn)Corvaisier Sylvain Independent Streaming Engineer
Last modified: September 6th, 2023

Related definitions

GOP Keyframe interval P-frames B-frames Encoder

Blog articles

Share this article

Get your own TV channel on iOS, Android, Roku, Fire TV and Connected TV like this one easily

Unlimited, automated, 24/7 TV Channels from your content at $0.001 per minute

Cars and Roads - Brands (https://ireplay.tv/carsandroads/brands.m3u8)

© iReplay.TV

Powered by Vod2Live.tv
Trusted by

trusted by Arte for low-latency live streaming
trusted by DJing for VOD2Live, very high quality live streaming, Jukebox TV, private podcasts, paygate, iOS, iPadOS apps
trusted by CNRS for 'Antarctica to World' Live Streaming
trusted by Velocix for consulting and ops services
trusted by Thomson Video Networks/Harmonic for OTT/cloud training

A portion of iReplay.TV's revenues, specifically 1%, is being allocated towards funding research and providing assistance for children's cancer treatment at Gustave Roussy Institute
Learn more about Gustave Roussy cancer Institute