How to change your keyframe interval for Twitch

Discussion in 'Guides' started by R1CH, Aug 14, 2013.

Thread Status:
Not open for further replies.
  1. R1CH

    Admin Developer

    Twitch is currently issuing a warning in preparation for their switch to HLS if you don't have a keyframe interval set. By default, OBS relies on the x264 auto keyframe interval, which puts keyframes at scenecuts for the best quality. Unfortunately this is incompatible with HLS which needs fixed size GOPs, for which Twitch wants a 2 second keyframe interval.

    v0.55b or higher:
    To change your keyframe interval, goto Settings, Advanced, and enter 2 seconds into the keyframe interval box (example).

    To change your keyframe interval, goto Settings, Advanced and in the Custom x264 settings box, enter:


    Where X is your FPS x 2 . Eg, if you stream at 30 FPS, you would use keyint=60, 48 FPS would be keyint=96, and 60 FPS would be keyint=120. (Example)

    Future versions of OBS will not require using the custom x264 settings, as this option will be available in the UI.
    Also note that the "Stream Configuration Quality" check is very new and will sometimes report incorrect keyframe intervals despite setting it correctly; it will also sometimes show unknown audio and video codecs. These warnings can safely be ignored once you have set the keyframe interval as above. Note that the guide linked in the message is incorrect when it describes how to set keyframe interval in OBS, this guide shows the correct way.
  2. ChimeraSyber New Member

    Also, i think, latency tuning factor must be 22. With 20 i have error: Max keyframe interval is just slightly over 2 seconds. Please set it to 2 seconds.
  3. dodgepong Administrator


    I don't think there's any such x264 setting called "latency tuning factor". There's tune=zerolatency but that has to do with reducing quality for the sake of pushing out frames faster.

    Those numbers (22 and 20) sound more like constant rate factors (CRF, aka the Quality Balance setting). CRF shouldn't affect frame timings, unless changing your CRF by 2 intervals taxes your CPU just enough that it throws your frame timings off. Even then, CRF is only used with VBR, and Twitch wants you to use CBR, so I'm not sure what you're talking about.

    Rather, I have heard some people fixing that "slightly more than 2" error by enabling CFR (constant frame rate) in Advanced settings.
  4. Krazy Town drunk


    He's talking about the latency stuff in advanced. This doesn't have anything to do with the encoder, and it should not have any effect on what Twitch is requiring.
  5. ZenVolta Member

    Im using the 54.08 Test build. And after setting the Keyframe interval to 2, twitch says its 2.114. Would setting the custom Keyint help this?

    Not sure if this what ChimeraSyber is talking about
  6. Krazy Town drunk


    Twitch's detection for that stuff is a bit wonky right now, I wouldn't worry about it too much just yet. Though you may see if setting CFR in advanced helps.
Thread Status:
Not open for further replies.