Log in

View Full Version : MPEG2 Keyframes: Some Characteristics and the Consequences for Recompression


kilg0r3
7th June 2003, 11:20
one day, scrolling through the stream i was about to compress i noticed that ther was something to mpeg to keyframes which renders them a bad foil for the xvid k-frame that would have to be constructed from it. many of the source-k-frames differed very strongly from the succeeding p-frames. Looking at it i saw that it was full of film grain and some other very fine details. some 5 frames later all these tiny bits were gone due to the underlying principle of mpeg compression. the fact that it is this way is not surprising but ...

Today, this leads me to the following question. Are mpeg2 keyframes really good keyframes for the destination stream? I don't think so because it cannot really be used as reference for the succeding frames. Yet, as always, I only have a very vague idea of how to compensate for this. One possibility would be to force an additional keyframe about 5 frames after the actual scene change. Another to simply compress kframes stronger (!, this is crazy) than the succeding p-frames (could be done by appropriate qmatrices.

The more intelligent solutions and thought, i am sure will follow below.

Teegedeck
7th June 2003, 13:10
Feeding the MPEG2-stream to XviD via AviSynth means it's treated like any uncompressed video - so there's no way of telling (for the codec, not for your eyes) what is a keyframe in the original, anyway. It is pretty unlikely that XviD's keyframes will coincide with MPEG2-keyframes reasonably often, I believe. XviD will decide purely on the number of blocks that differ from frame to frame and I believe this is the only valid criterion for any keyframe-decision. If it would be changed, compression would get less efficient and we'd loose more in picture quality than we could possibly gain (always IMHO). There's not much one can do about weaknesses of the video-source except for filtering, is there?

BTW, an insteresting observation.

kilg0r3
7th June 2003, 14:42
Originally posted by Teegedeck
so there's no way of telling (for the codec, not for your eyes) what is a keyframe in the original, anyway.

O.K., sorry I was talking about keyframes on scene changes (cuts only) only. I just forgot that mpeg2 inserts many keyframes inbetween.