[x264-devel] Global optimization of keyframes

Jason Garrett-Glaser jason at x264.com
Mon Dec 27 15:20:29 CET 2010


On Mon, Dec 27, 2010 at 5:51 AM, Nicolas George
<nicolas.george at normalesup.org> wrote:
> Le sextidi 6 nivôse, an CCXIX, Jason Garrett-Glaser a écrit :
>> This idea has a few problems.
>>
>> x264 currently makes all frametype decisions in the first pass.  It
>> also makes various decisions *based on* these frametype decisions,
>> such as MB-tree.  Changing frametypes in the second pass would require
>> either ignoring the inaccuracy of the other decisions, or redoing them
>> all.
>
> That makes things difficult indeed.
>
>> Secondly, I don't really get your example.  Why would you want
>> keyframes at all in that case?  Keyframes are for scenecuts, and your
>> described video has no scenecuts.
>
> Unless I am mistaken, if the scene is too long, the encoder is expected to
> add keyframes at regular intervals to allow seeking (and, for some codecs
> but not H.264, tu avoid drifting due to rounding errors). Or am I using the
> wrong words.
>
> A stupid encoder would just put these periodic keyframes as far apart as
> possible, but a good encoder would place them sometimes early if it detects
> a better place. That is the selection of these "better places" that I think
> would benefit from global optimization.

This is less useful with long keyframe intervals (like x264 uses by
default).  It's also less useful when one isn't relying on keyframes
as a "quality boost" mechanism.

x264 uses MB-tree, which does exactly what you're looking for -- it
tracks references between frames and raises quality on areas of the
frame that will be referenced more in the future.  This effectively
solves that problem.

Jason


More information about the x264-devel mailing list