Could you explain how keyint, minkeyint and scenecut interact?
encode current frame as (a really fast approximation of) a P-frame and an I-frame. if ((distance from previous keyframe) > keyint) then set IDR-frame else if (1 - (bit size of P-frame) / (bit size of I-frame) < (scenecut / 100) * (distance from previous keyframe) / keyint) then if ((distance from previous keyframe) >= minkeyint) then set IDR-frame else set I-frame else set P-frame encode frame for real.