View Full Version : x264 keyframe interval rules.
Terranigma
13th April 2007, 16:04
Does the same rules that applies to h.263 (divx, xvid) applies to x264 as well where it'd be appropriate to set the keyframe interval 10 times the fps of a clip?
Ntsc film (24.00fps) = 240
PAL (25.00fps) = 250
NTSC Video (30.00fps) = 300?
Or would it be best to keep it at 250?
LoRd_MuldeR
13th April 2007, 16:10
The "rule" is:
* Min IDR Frame Interval = FPS
* Max IDR Frame Interval = FPS * 10
Of course it's only a recommendation, not a must do ;)
Guest
13th April 2007, 16:12
Don't ask for "best" as it violates forum rule 12.
Large GOPs can be problematic for seeking, error recovery, stream switching, etc. It all depends on your application so there is no valid "rule".
Terranigma
13th April 2007, 16:14
The rule is:
Min IDR Frame Interval = FPS
Max IDR Frame Interval = FPS * 10
Of course it's only a recommendation, not a must do ;)
Thanks. I also noticed an option called "Min. GOP Size" that's 1/10th the keyframe interval. Would that be the "Min IDR Frame Interval"? Sorry for the noobish questions. =P
Terranigma
13th April 2007, 16:16
Don't ask for "best" as it violates forum rule 12.
Large GOPs can be problematic for seeking, error recovery, stream switching, etc. It all depends on your application so there is no valid "rule".
Oops, I did'nt mean it like that neuron2, (and i'm usually the one pointing out "best" to others :) I guess I should edit my post). I meant from the guides from the front page. Would it basically be the same thing. Like, does it applies in a similar fashion.
LoRd_MuldeR
13th April 2007, 16:25
Thanks. I also noticed an option called "Min. GOP Size" that's 1/10th the keyframe interval. Would that be the "Min IDR Frame Interval"? Sorry for the noobish questions. =P
That should be the same, yes. If not so, please somebody correct me.
(BTW: Did you notice the "x264 options explained" in my signature? ^^)
Terranigma
13th April 2007, 16:29
That should be the same, yes. If not so, please somebody correct me.
(BTW: Did you notice the "x264 options explained" in my signature? ^^)
Thanks LoRd_MuldeR, you've been very helpful. ;)
bond
14th April 2007, 09:49
Does the same rules that applies to h.263 (divx, xvid) divx and xvid are not h.263 but mpeg-4 asp
fofwp
17th April 2007, 17:32
That should be the same, yes. If not so, please somebody correct me.
(BTW: Did you notice the "x264 options explained" in my signature? ^^)
I read through your doc and in it you say to disable Trellis if you are using quantizer mode because it can cause "unpredictable results". Can you please tell me what I should be looking for if my encodes were done with it enabled using a quantizer mode?
[)370|\|470!2
17th April 2007, 17:45
Generally speaking, the more keyframes video has, the easier navigation would be, the more overall quality most likely it'll have, blockages/artifacts would take less time, since next keyframe usually repairs them. I'd say 100-150 interval will do, fps independent. Imo, ofcoz. :P
LoRd_MuldeR
17th April 2007, 17:55
I read through your doc and in it you say to disable Trellis if you are using quantizer mode because it can cause "unpredictable results". Can you please tell me what I should be looking for if my encodes were done with it enabled using a quantizer mode?
Significant bigger file
LoRd_MuldeR
17th April 2007, 18:05
Generally speaking, the more keyframes video has, the easier navigation would be, the more overall quality most likely it'll have, blockages/artifacts would take less time, since next keyframe usually repairs them. I'd say 100-150 interval will do, fps independent. Imo, ofcoz. :P
I doubt a smaller Keyframe interval will improve the quality of the video! Keyframes are compressed without references to other frames, so they work more or less like JPEG images. Therefore Keyframes compress less efficient than P- or even B-Frames. Or in other words: Keyframes require more data (higher bitrate) to achieve the same visual quality. At least in most cases (scene changes are an exception). So if you are compressing to a target filsize, then a smaller Keyframe interval should hurt the quality. If you are compressing in Qunatizer mode, then a smaller Keyframe interval should make the file bigger...
[)370|\|470!2
17th April 2007, 18:26
So if you are compressing to a target filsize, then a smaller Keyframe interval should hurt the quality. If you are compressing in Qunatizer mode, then a smaller Keyframe interval should make the file bigger...
You seem not to be aware of quantizaton basics. If simplified it's as follows iirc: all frames placed inbetween keyframes are actally buit on them, tehy simply contain more or less movement/difference information, hence removing just one keyframe will most likely destroy all depending block. In reality of couse it's much more complex.
LoRd_MuldeR
17th April 2007, 18:38
You seem not to be aware of quantizaton basics. If simplified it's as follows iirc: all frames placed inbetween keyframes are actally buit on them, tehy simply contain more or less movement/difference information, hence removing just one keyframe will most likely destroy all depending block. In reality of couse it's much more complex.
An I-Frame (Keyframe) stores a "complete" picture, while a P-Frame refers to the previous I-/P-Frame. So the P-Frame only stores the difference to the previous Frame, not the whole picture. This means a P-Frame usually needs to store less data than an I-Frame, except the frames are very different (scene change). And this means a P-Frame usually is smaller than an I-Frame of the same visual quality. In case your bitrate is limited, because you are compressing to a target filesize/bitrate, then P-Frames will obviously produce better quality. The only reason why I-Frames are needed in a certain interval are: You want to be able to seek + you want to efficiently handle scene changes. B-Frames compress even more efficient than P-Frames, because they refer to both, the previous and the following I-/P-Frame.
foxyshadis
18th April 2007, 03:37
You seem not to be aware of quantizaton basics. If simplified it's as follows iirc: all frames placed inbetween keyframes are actally buit on them, tehy simply contain more or less movement/difference information, hence removing just one keyframe will most likely destroy all depending block. In reality of couse it's much more complex.
Mulder's not talking about removing I-frames after encoding, that would be a silly way of trying to cut the size down.
You definitely don't get more quality out of more keyframes, or the logical conclusion would be that keyframe-only encoding is the most efficient. It's a diminishing returns problem, though, where having a single keyframe isn't really visually much better than keyframes every half a percent of the frames. (In reality single keyframe abr video has noticeably worse quality on scenechanges for a frame or three because of curve compression, unless the codec uses a p-frame with mostly i-blocks, but that's a tangent.)
Of course, if you're in an environment where packets get dropped all the time, that changes everything, and regular IDRs/recovery SEIs become vital.
akupenguin
18th April 2007, 04:13
(In reality single keyframe abr video has noticeably worse quality on scenechanges for a frame or three because of curve compression, unless the codec uses a p-frame with mostly i-blocks, but that's a tangent.)
Any codec will use mostly I-blocks if forced to encode a scenechange as a P-frame. That has very little effect on quality, just a few bits spent on block types instead of one bit in the frame header saying "all the blocks in this frame are intra". The question is whether the codec knows to treat any frame full of I-blocks equivalently to an I-frame wrt ratecontrol.
Terranigma
18th April 2007, 16:54
I have a question, it's about the SA-HD-DVD Profile. I noticed that the keyframe interval is 15, and min gop size is 1. Would'nt using such low intervals be a relatively bad idea? :confused:
burfadel
18th April 2007, 18:04
I have a question, it's about the SA-HD-DVD Profile. I noticed that the keyframe interval is 15, and min gop size is 1. Would'nt using such low intervals be a relatively bad idea? :confused:
I guess it would mean very quick searching, but it would take up much more space! Someone on here will clarify this, but the settings depend on what the intended use is for. A keyframe of say 250-300 wouldn't be beneficial for HD-DVD's etc, as although the file size would be smaller, and potentially higher quality for the same file size, searching would become slow and if there is an error on the disk the next up to 10 seconds (250 keyframe for PAL for example) would be messed up. I would have thought a keyframe of 1 second, meaning 25 for pal or 24/30 for ntsc would be more idealistic as a maximum value, but thats just me. If the keyframe interval is small, although the standard doesn't allow for it a large number of reference frames and b-frames would be more beneficial and any loss will still be contained in that 1 second block.
LoRd_MuldeR
18th April 2007, 18:29
I guess HD-DVD has more than enough Discspace, so squeezing out more quality by higher keyframe interval just isn't necessary...
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.