[x264-devel] Fixed GOP, keyint and keyint-min

Tom Vaughan tom.vaughan at multicorewareinc.com
Thu Aug 31 00:29:07 CEST 2017


Scene detection is a function that provides useful information, so turning
this algorithm off only makes sense if there is no possible benefit to
knowing where scene changes occur with fixed GOP encoding.  We believe that
there are benefits that can be obtained.  For example, speeding up analysis
once you know that inter-prediction won't work making references to frames
in the previous scene.  Of course, the scene cut threshold also matters.  It
also doesn't make sense to turn off inter-prediction if there are still some
benefits (some similar content in previous frames).

I'm told by people more expert than me (PhD's who contributed to the HEVC
standard) that there are benefits to encoding an all-Intra frame as an I
frame rather than a P frame.  If I remember correctly, the context for each
block is more similar to neighboring blocks, and so this ends up compressing
more efficiently with CABAC.

We have a patch for x264 that we will contribute once we refactor it to
apply to the latest dev tip.

Tom

-----Original Message-----
From: x264-devel [mailto:x264-devel-bounces at videolan.org] On Behalf Of
BugMaster
Sent: Tuesday, August 29, 2017 10:44 AM
To: Mailing list for x264 developers
Subject: Re: [x264-devel] Fixed GOP, keyint and keyint-min

On Mon, 28 Aug 2017 10:21:25 -0700, Tom Vaughan wrote:
> We looked into this, and we concluded that scene detection is useful
> even for fixed GOP length encoding.  When the encoder detects scene
> changes in the lookahead, it can better understand where
> inter-prediction will work, and where it won't work (so it can avoid
> wasting time searching for inter-prediction modes that won't work).
> It can also insert a non-IDR I frame at the start of the new scene, if
> that turns out to be more efficient than using a P frame (because the
> first frame at the start of a new scene is unlikely to find lower
> rdcost inter-prediction references to a previous frame, and a P frame
> that contains mostly I blocks compresses less efficiently than an I
> frame).

> We changed this behavior in x265.  So for x265, if you want fixed GOP
> lengths, you can just set max-keyint = keyint.  Scenecut is
> independent, and it's on by default.

Hi. Dunno about x265 (HEVC) but for x264 (H.264) all my benchmarks showed
that `--keyint 60 --no-scenecut` have higher quality than `--keyint
60 --min-keyint 60` (patched to allow this). The only exception was
with --subme <= 2 due fast_intra mode condtion:
http://git.videolan.org/gitweb.cgi?p=x264.git;a=blob;f=encoder/analyse.c;h=036d6c15397d7a4dd6f1f1876427d0f4dfc86a96;hb=HEAD#l571

Probably this i_subpel_refine condition can be removed without much speed
loss.

P.S. There is no point in discussed behavior because encoding frame as
I-frame instead of P-frame with all intra is not more efficient (i.e.
there is no penalties for this). Also as this frames are not IDR but only
I-frames (i.e. not keyframes) there is no point in them for sync or editing.
There purpose of --min-keyint was not to close GOP due flashes near previous
scenecut and not to force fixed GOP.

_______________________________________________
x264-devel mailing list
x264-devel at videolan.org
https://mailman.videolan.org/listinfo/x264-devel


More information about the x264-devel mailing list