PDA

View Full Version : x264 signals 7 reference frames in SPS altough two have been set!?


bond
1st June 2005, 22:31
i noticed recently with the latest svn version, that the SPS signals 7 reference frames in x264 streams, altough i have only set 5

i have to say that i also used 2 b-pyramid b-frames, but

1) the reference encoder doesnt add 1 additional reference frame to the reference flag in SPS because b-frames are used. x264 does that!?

2) even if you count the additional b-frame reference frame, why 7 (from 5 set)? does b-pyramid add an "extra extra" reference frame?



ps: when does x264 write the userdata SEI before the SPS/PPS and when after them? it seems that it does this different sometimes!?

akupenguin
2nd June 2005, 00:53
the reference encoder doesnt add 1 additional reference frame to the reference flag in SPS because b-frames are used. x264 does that!?
x264's --ref actually sets the number of L0 refs in P-frames, and B-frames use all of the same refs plus an addition 1 or 2 L1 refs. JM allows you to encode B-frames with ref=1 (1 L1 ref, no L0 refs), which really sucks. Also, if B-frames used fewer L0 refs than P-frames, then whenever a P-frame used an old ref, the colocated block in the adjacent B-frame(s) would be disallowed from using Skip/Direct modes.

even if you count the additional b-frame reference frame, why 7 (from 5 set)? does b-pyramid add an "extra extra" reference frame? PbBbP
With --ref 5, the 1st 'b' references 5 previous frames + the 'B' and the 2nd 'P'. The 2nd 'b' references 6 previous frames (including the 'B'), + the 2nd 'P'.

when does x264 write the userdata SEI before the SPS/PPS and when after them? it seems that it does this different sometimes!? The SEI is always written 1st. However, muxing/demuxing in MP4 may reorder them, since MP4 puts SPS/PPS in a global header instead of part of the video stream.

bond
2nd June 2005, 19:56
that makes sense, thx!