PDA

View Full Version : x264 and I-frames on scenechanges


MetalPhreak
4th July 2006, 13:19
I recently noticed that x264 is really innacurate when it comes
to inserting I-frames on scenechanges. I did a few tests and came up the following:

--min-keyint 25 vs --min-keyint 1:
A short test clip of random frames showed that with --min-keyint 25 x264 will still place keyframes less than 25 frames apart, but a value of 1 was still much more accurate - this was confirmed on a full length movie. Conclusion: --min-keyint 1 is much better than --min-keyint 25 (default), but still far from accurate.

--scenecut 40 vs --scenecut 100:
Obviously --scenecut 100 was more accurate than the default value of 40, but still missed quite a lot of scenecuts, especially in dark scenes. I also noticed that with --scenecut 100 x264 started placing I frames in high motion scenes and aggressive
fades - but this is to be expected.

--ref 1 vs --ref 16:
Surprisingly scenecut detection became less accurate with more reference frames.

Fast first pass vs full quality first pass vs crf:
For some reason even the type of encode made affected scenecut detection.
From worst to best the above modes were:
Fast first pass
Crf (full quality 1 pass encode)
Full quality first pass

Now even with a full first pass, --min-keyint 1, --scenecut 100 and --ref 1 x264 was still worse than XviD most of the time when it came to scenecuts (especially dark scenes). I think this is something that really needs looking into. I challenge everybody to make their own tests or even just go back and look at some previous encodes and you'll easily see how innacurate x264's scenecut detection is.

foxyshadis
4th July 2006, 13:55
There's only one issue, in that while keyframes are good for seeking, they're not necessary for efficient coding of scenecuts in AVC. A P-frame can have a single P block and otherwise all I-blocks, and it's still a P but might as well be a keyframe. Any frame can (and probably does) have clusters of I-blocks mixed with others if it codes more efficiently, and scenecuts can be partly intra and partly predicted if it helps.

So while x264 may not always place keyframes on scenecuts, there's also no good reason to require it.

MetalPhreak
4th July 2006, 14:50
Oh okay, in that case nevermind.