follow x264's default keyint-min behavior

Issue #24 resolved
Steve Borho created an issue

x265 currently sets keyint-min to be equal to keyint-max if it is not assigned. I'm pretty sure x264 does something different. We should follow their approach

Comments (3)

  1. Former user Account Deleted

    Well, if keymin isn't manually set, x264 would choose min(fps, keymax/10). Excessive values are also clipped to [1, keymax/2 + 1].

    diff -r 23c65133c555 source/encoder/encoder.cpp
    --- a/source/encoder/encoder.cpp    Thu Jan 23 20:41:05 2014 -0600
    +++ b/source/encoder/encoder.cpp    Thu Jan 23 20:14:37 2014 -0800
    @@ -1264,8 +1264,9 @@
         }
         if (!_param->keyframeMin)
         {
    -        _param->keyframeMin = _param->keyframeMax;
    +        _param->keyframeMin = X265_MIN(_param->frameRate, _param->keyframeMax / 10);
         }
    +    _param->keyframeMin = X265_MAX(1, X265_MIN(_param->keyframeMin, _param->keyframeMax / 2 + 1));
         if (_param->keyframeMax <= 1)
         {
             // disable lookahead for all-intra encodes
    
  2. Steve Borho reporter

    follow x264's keyframe-min logic [CHANGES OUTPUTS] (closes #24)

    If no --keyint-min is specified, default to max/10, and clamp the value to between [1, max / 2 + 1]. This allows x265 to insert I frames when scene cuts are detected between keyframe-min and keyframe-max

    → <<cset 898ccce491e9>>

  3. Log in to comment