View Full Version : x264's frame decision questions
Chengbin
4th September 2009, 15:58
When x264 encode a video of 2 people talking, and the scenes constantly changes from person 1 to person 2. Does x264 create an I frame for every scene change, or will it reference the previous I frame?
How does x264 deal with duplicate frames? I've heard that people use VFR because it saves bitrate by removing the duplicate frames. I also heard that doubling the frame rate by bobing a video will approximately double the file size, even for anime. There are a LOT of duplicate frames for anime when you bob, why does the file size still significantly go up?
Dark Shikari
4th September 2009, 16:02
When x264 encode a video of 2 people talking, and the scenes constantly changes from person 1 to person 2. Does x264 create an I frame for every scene change, or will it reference the previous I frame?No, it's not smart enough to do that. That's also generally very difficult to do, as it would require a very large lookahead or two-pass and a lot more motion searching to identify similarities to previous scenes.
How does x264 deal with duplicate frames? I've heard that people use VFR because it saves bitrate by removing the duplicate frames. I also heard that doubling the frame rate by bobing a video will approximately double the file size, even for anime. There are a LOT of duplicate frames for anime when you bob, why does the file size still significantly go up?Duplicate frames don't directly cost bits, but they do hurt because they decrease the efficiency of B-frames.
G_M_C
4th September 2009, 16:22
[...]
How does x264 deal with duplicate frames? I've heard that people use VFR because it saves bitrate by removing the duplicate frames. I also heard that doubling the frame rate by bobing a video will approximately double the file size, even for anime. There are a LOT of duplicate frames for anime when you bob, why does the file size still significantly go up?
[...]
Duplicate frames don't directly cost bits, but they do hurt because they decrease the efficiency of B-frames.
Setting the number of b-frames to a higher number would partially help this, wouldn't it ? (At an encoding speed-cost of course).
Chengbin
4th September 2009, 16:23
No, it's not smart enough to do that. That's also generally very difficult to do, as it would require a very large lookahead or two-pass and a lot more motion searching to identify similarities to previous scenes.
So not even 2 pass can do that?
I thought the point of 2 pass was to build a log recording this kind of stuff, where it needs high/low bitrate, etc.
So what does 2 pass do, besides getting a very accurate file size you selected.
Duplicate frames don't directly cost bits, but they do hurt because they decrease the efficiency of B-frames.
Why can't x264 say, for example, for frame 10000, use frame 9999?
DarkZell666
4th September 2009, 17:11
Why can't x264 say, for example, for frame 10000, use frame 9999?
Direct264 (http://forum.doom9.org/showthread.php?t=141441&highlight=Direct264) (roozhou's special x264 build) has this feature via something called "deldup" IIRC, which produces VFR video.
However, the h.264 standard already allows this mechanism on the macroblock level, I'm not sure what extra benefit this would bring at the frame level.
As I personnally understand it, if most (but not all) blocks in a frame are SKIP, then the frame will cost very few bits already since the actual data of SKIP blocs won't be coded, so removing the frame would only save 1-5% bits or so for that frame, that you'd trade for possible stuttering since you'd loose the few blocks/MV's that weren't marked as SKIP. Did I get that right ?
AnonCrow
4th September 2009, 20:37
No, it's not smart enough to do that. That's also generally very difficult to do, as it would require a very large lookahead or two-pass and a lot more motion searching to identify similarities to previous scenes.
Placebo then. Add and code a new option 'I-references' and allow 2|n-pass to change frame-type
decisions made on first pass [1], then a frame that'd normally be an I|i-frame could be a P frame referencing parts in
upto n previous I-frames. Allow use of zones to manually select which I-frames to always take into account as possible references.
Granted, potentially huge increase in memory usage when decoding.
[1] Automatically, without manual qpfile.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.