View Full Version : Reference and 'B' Frames
_DW_
9th February 2009, 05:22
I'm looking at the codec configuration in staxrip and I have a few questions. I'm on the first page looking at the reference frames and the b-frames. I'm thinking that a reference frame is a complete frame like a frame of film and a b-frame is the changes that happen in between reference frames. Is this correct?
The page currently says 8 reference frames to 16 b-frames. What is the ratio of ref frames to b-frames and to frame rate? Does this mean that I have 8 reference frames per second of video or 8 reference frames for the whole video?
An finally I remember reading that more than 5 ref frames doesn't do any better for live video. Is this correct? What about anime?
Dark Shikari
9th February 2009, 05:26
I'm looking at the codec configuration in staxrip and I have a few questions. I'm on the first page looking at the reference frames and the b-frames. I'm thinking that a reference frame is a complete frame like a frame of film and a b-frame is the changes that happen in between reference frames. Is this correct?No. Read the manual (http://ffmpeg.x264.googlepages.com/mapping), and if that isn't enough, try Wikipedia.
_DW_
9th February 2009, 05:52
Gee, thanks, I think. That really answered a lot of my questions. Looks like just about everything I thought I knew was wrong.
cogman
9th February 2009, 06:16
Gee, thanks, I think. That really answered a lot of my questions. Looks like just about everything I thought I knew was wrong.
Sorry, but without posting a huge post about what b-frames and reference frames are, Dark Shikari really couldn't tell you all that much. Pretty much all of your questions where based on a faulty assumption made in your first question, so answering them would be like answering a question of "Since the moon is made of cheese, how many mice could it support?"
However, the last statement you made, Yes, over 5 reference frames generally doesn't provide major quality gains. Anime receives some gains with more then five, however, they aren't THAT much.
_DW_
9th February 2009, 07:01
Sorry, but without posting a huge post about what b-frames and reference frames are, Dark Shikari really couldn't tell you all that much. .
Not a problem. I'm just going to assume the question I ask has possibly been ask a 100 or so times. I did look for the answers but didn't find what I was looking for. From what I read just setting the ref frames to 5 and the b-frames to 16 and not worrying about it, at this point, is the best way to go for now.
Which is pretty much what I've been doing.
Selur
9th February 2009, 08:35
b-frames 16 will be damn slow on encoding - when b-adapt is set to optimal, since it's not multithreaded atm. - so you probably want stick to 5 or less b-frames.
JohannesL
9th February 2009, 21:18
does a very high (like 10+) --b-frames actually help?
Selur
9th February 2009, 21:32
if it's used: yes, but for most sources x264 won't use more than 5 frames in a row to setting it higher than will only low the whole thing down.
LoRd_MuldeR
9th February 2009, 22:32
JohannesL, after your encode is done, look at the following line printed by x264:
x264 [info]: consecutive B-frames: 8.4% 52.2% 33.7% 2.8% 0.7% 0.8% 0.3% 0.0% 0.0% 0.4% 0.0% 0.0% 0.0% 0.6% 0.0% 0.0% 0.0%
That line will tell you how many consecutive b-frames were used actually.
The first number is no b-frame, the second number is one b-frame, the third number is two b-frames and so on.
As you can see, in this example x264 use 3 or even less b-frames in 97% of all cases, although I allowed up 16 b-frames!
Hence I could have used 3 b-frames instead of 16 b-frames and the result would have been no different.
Well, there would have been some difference, but that difference would have been negligible. And that is not an unusual example ;)
anonova
9th February 2009, 23:17
I've been using bframes 16 (with b-adapt 2) and ref 16 just to see if it'd ever use up to that many on some recent encodes. I finally saw 16 b-frames usage in a concert I tried. :P
x264 [info]: consecutive B-frames: 5.4% 26.1% 54.3% 8.4% 4.0% 1.2% 0.3% 0.1% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.2%
Still probably wasn't worth the time though. *cough*almost 7 days*cough*
Since we're also talking about reference frames, could you also explain how to read the stats x264 gives at the end?
x264 [info]: ref P L0 59.6% 15.7% 7.2% 3.6% 2.7% 2.4% 2.0% 1.1% 1.0% 0.9% 0.8% 0.8% 0.6% 0.6% 0.6% 0.4%
x264 [info]: ref B L0 78.5% 10.5% 3.5% 1.7% 1.3% 1.1% 0.8% 0.5% 0.4% 0.4% 0.4% 0.3% 0.3% 0.3% 0.2%
x264 [info]: ref B L1 93.6% 6.4%
P frames use at least 1 reference frame? And what are the differences between L0 and L1 b refs?
LoRd_MuldeR
9th February 2009, 23:25
Still probably wasn't worth the time though. *cough*almost 7 days*cough*
In 98.2% of all cases 4 or less consecutive b-frames were used. For that video it's really not worth going higher than 4 b-frames...
P frames use at least 1 reference frame?
I think so. A frame without any references would be an I-Frame.
And what are the differences between L0 and L1 b refs?
Not 100% sure, but I think L0 and L1 distinguishes between "normal" b-frames (referring to i- or p-Frames) and b-frames that refer to b-frames (b-pyramid).
Gabriel_Bouvigne
10th February 2009, 09:44
And what are the differences between L0 and L1 b refs?
P frames can only use only a single reference list (L0), while B frames are using two reference lists (L0 and L1).
In the case of x264:
*L0 are previous frames, L1 are upcoming frames (considering display order)
*when not using b-pyramid, B frames are only using a single L1 frame.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.