Log in

View Full Version : Adptive bi-encodig working right?


V-tec
16th July 2004, 10:10
I have done some test at low bitrate (4/500 kbps), and I have noticed that for long periods, b-frames is not used in high motion scenes, something like a 8 b-frames on over 2000 frames. The resulting video comes more blocked of that gotten with divx 5.1.1.
It's possible to set the sensibility of codec to place more b-frames?

bond
16th July 2004, 16:06
which leads to an interesting question: whats the maximum number of consecutive b-frames divx5 will use?

Sharktooth
16th July 2004, 16:50
Maybe they have not a hard limit...
As with xvid the codec would not put more than "n" bframes even if you specified to add a greater number...

SeeMoreDigital
16th July 2004, 18:16
I thought they might have put some information about this in their 'Official DivX5.2 Guide' but there's nothing special in here!


Cheers

V-tec
16th July 2004, 19:14
if on the CLI i put -b -1 the encoder uses old bi-enc method

but old method is accepted only if a certified profile is enabled.

DigitAl56K
16th July 2004, 22:08
Originally posted by V-tec
I have done some test at low bitrate (4/500 kbps), and I have noticed that for long periods, b-frames is not used in high motion scenes, something like a 8 b-frames on over 2000 frames. The resulting video comes more blocked of that gotten with divx 5.1.1.
It's possible to set the sensibility of codec to place more b-frames?

B-frames are not really suitable for high-motion scenese, because neither the forward or backward frames is likely to resemble the current frame. Placing multiple B frames in fast motion scenes can have a very negative impact on quality.

DigitAl56K
16th July 2004, 22:16
DivX will use up to 2 consecutive B frames adaptively, based on the characteristics of the source.

SeeMoreDigital
16th July 2004, 22:48
Originally posted by DigitAl56K
DivX will use up to 2 consecutive B frames adaptively, based on the characteristics of the source. Odd... according to the graphic and text that appears in your new guide, it's more than this...

http://img17.exs.cx/img17/1821/DivX_mB-VOP.gif

... I see three B's... :confused:


Cheers

DigitAl56K
16th July 2004, 22:57
Good point :) I should change that illustration. I used 3 B-frames for clarity of illustration, but it could be interpreted that we support 3 B-frames...

nicco
17th July 2004, 00:52
I'm still a bit confused about new b-frames options.
First of all I don't understand if adaptive b-frames is the "old" b-frames encoding (the same of divx5.1.1) or if it's different :confused:

@DigitAl56K
In the Divx Guide you explain how the "adaptive b-frames" and "multiple adaptive b-frames" works, but you don't explain when these two options should be used (like an use tip).

By the way I tried the "multiple consecutive b-frames" (with multipass, 900Kbps) and I was not happy for the result: I get a very blocky picture especially in scenes with maps or draws, there is a lot of flickering.
Tomorrow I'll try to encode the same video with "adaptive b-frames" and I'll compare the result.

chilledoutuk
17th July 2004, 04:42
I have not had problems with multiple bframes have you tried slow encode performance as that enables rate distortion which helps prevent blocking.

nicco
17th July 2004, 08:11
I have slow enabled...

SeeMoreDigital
17th July 2004, 09:57
Well, as I've reported on other threads, I'm very surprised how multiple B-VOP works in hardware...

For instance, I can't get any of my mB-VOP .AVI encode tests to work smoothly in hardware. But if I mux them into the MP4 container using GraphEdit/3ivX, they work perfectly!

A few weeks ago DXN and a few of us on the forum had a big discussion about Mpeg4 in MP4 and the problems associated with it compared to AVI. But in this instance MP4 rocks!

So to make sure it's not just me. I'm goings to generate and post some test files for some of our Philips DVP642 and 630 stand-alone player owners to try!


Cheers

DigitAl56K
17th July 2004, 11:04
Multiple B-frames in 5.2 are implemented as unpacked. The reason is that most HT profile certified devices don't know about multiple B-frames, and this method was most compatible with all of the devices we tested on. We'd like to switch to packed at some point in the future, which would offer better performance. This is why multiple B-frames are currently outside of DivX Certified profiles in the codec :)

Testing against one particular player in one container or another doesn't really help - performance will vary. One point we did make on MP4 was that for very large containers (e.g. a full movie), some players may struggle (or fail) to parse the container correctly.

nicco
17th July 2004, 11:10
Ok, I understand that the new adaptive b-frames are different from the older b-frames (previous divx version).
I understand that the "adaptive" means the encoder intelligently decides when insert b-frames (so it should be better).
But what is the different impact of single adaptive or multiple adaptive on my final movie, when do I should use one of them instead of the other?
For example multiple adaptive is better for low-motion and single for fast motion movies or whatever?
:confused:

DigitAl56K
17th July 2004, 11:19
Single adaptive should always be used instead of the old non-adapative method. In some cases with 5.1.1 or lower, B-frames would occasionally be selected for frames where they really shouldn't be. Usually, this was hard to notice, but occasionally you would see something that was fairly visible. Single adaptive is fully compatible with Home Theater-certified devices.

Multiple adaptive b-frames should improve compression for low-motion scenes, which means the quality of very low bitrate videos (e.g. 2hr on 1 cd for a movie that contains a lot of low motion scenes) should be enhanced. B-frames by their nature are, of course, most useful where the forward and backwards frames bare strong resemblance to the current frame - so where frames 2 & 3 strongly resemble 1 & 4 you will likely see multiple B-frames selected by the encoder (if enabled).

Note that the behavior of the codec is not always as you'd expect: if you actually analyze frame type selection after encoding sometimes where you might think multiple B-frames should be used it is actually more efficient (and better for quality) to P-frame. Try encoding a video composed of a single static frame repeated on every frame, for example :)

Hope this helps, and I'd love to update the guide after some more feedback from you guys! :)

nicco
17th July 2004, 12:22
Tanks a lot!
So multiple b-frames should be used for low bitrate movies, with low motion scenes, can you tell me a "bitrate threshold" for using m-Bframes?
If I have a movie with many semi-still images like static maps with a path moving on it or similar, should I use m-Bframes for better result?
I'm glad to help you improving your great divx guide :)

Nicco

nicco
17th July 2004, 16:52
I did some tests on a 60frames video, it has some part with still images, like titles, and I get these log results:

Single adaptive b-frames


##map version 8
nframes 561
timescale 30000
passes 1
seq deltaT type total_bits motion_complexity texture_complexity modulation
0 0 I 36000 0.000000 0.581896 1.000000
1 1200 P 2920 0.004651 0.025552 1.000000
2 1200 P 4168 0.005020 0.054038 1.000000
3 1200 P 7824 0.005688 0.184216 1.000000
5 2400 P 15304 0.008398 0.306832 1.000000
4 -1200 B 5368 0.002344 0.114101 1.000000
7 3600 P 21656 0.011282 0.440798 1.000000
6 -1200 B 6800 0.003829 0.175878 1.000000
9 3600 P 33592 0.015425 0.705978 1.000000
8 -1200 B 13904 0.006395 0.292056 1.000000
11 3600 P 41200 0.017079 0.885751 1.000000
10 -1200 B 17376 0.008128 0.363623 1.000000
13 3600 P 48080 0.020896 1.023274 1.000000
12 -1200 B 17976 0.010250 0.356222 1.000000
15 3600 P 49376 0.018147 1.086713 1.000000
14 -1200 B 15016 0.009305 0.289563 1.000000
17 3600 P 51872 0.019370 1.138310 1.000000
16 -1200 B 17024 0.008746 0.347679 1.000000
19 3600 P 55384 0.022979 1.547892 1.000000
18 -1200 B 18456 0.011767 0.352482 1.000000
21 3600 P 66632 0.023044 1.481964 1.000000
20 -1200 B 18552 0.011335 0.359494 1.000000
23 3600 P 67016 0.023510 1.487027 1.000000
22 -1200 B 19720 0.011027 0.393148 1.000000
24 2400 P 28512 0.010147 0.631036 1.000000
25 1200 P 7712 0.006660 0.128435 1.000000
26 1200 P 6488 0.006279 0.100702 1.000000
27 1200 P 6080 0.006404 0.088731 1.000000
28 1200 P 6152 0.006414 0.090471 1.000000
29 1200 P 6392 0.006180 0.099378 1.000000
30 1200 P 6400 0.006260 0.098650 1.000000
31 1200 P 6320 0.006204 0.097144 1.000000
32 1200 P 6512 0.006243 0.101663 1.000000
33 1200 P 15352 0.010315 0.219842 1.000000
34 1200 P 5160 0.005609 0.073384 1.000000
35 1200 P 5848 0.005881 0.088471 1.000000
36 1200 P 6312 0.006156 0.097508 1.000000
37 1200 P 6384 0.006255 0.098339 1.000000
38 1200 P 5960 0.006064 0.089406 1.000000
39 1200 P 11640 0.007820 0.166664 1.000000
40 1200 P 8272 0.006653 0.109435 1.000000
41 1200 P 4320 0.005372 0.054168 1.000000
42 1200 P 5120 0.005650 0.072034 1.000000
44 2400 P 61816 0.024530 1.340856 1.000000
43 -1200 B 22432 0.014986 0.321890 1.000000
46 3600 P 61848 0.027558 1.309124 1.000000
45 -1200 B 23456 0.013956 0.458715 1.000000
48 3600 P 53432 0.022126 1.149139 1.000000
47 -1200 B 22808 0.012486 0.457755 1.000000
50 3600 P 52344 0.021135 1.131455 1.000000
49 -1200 B 22656 0.012505 0.453548 1.000000
52 3600 P 57560 0.021766 1.260201 1.000000
51 -1200 B 21304 0.011258 0.431865 1.000000
54 3600 P 54176 0.023028 1.158721 1.000000
53 -1200 B 21688 0.012707 0.426282 1.000000
56 3600 P 54928 0.024684 1.160460 1.000000
55 -1200 B 23280 0.013747 0.456404 1.000000
58 3600 P 52424 0.021231 1.132545 1.000000
57 -1200 B 21528 0.012835 0.420751 1.000000
60 3600 P 46504 0.018468 1.008603 1.000000

filesize 2.114 Mb

Multiple adaptive b-frames

##map version 8
nframes 561
timescale 30000
passes 1
seq deltaT type total_bits motion_complexity texture_complexity modulation
0 0 I 36000 0.000000 0.581896 1.000000
1 1200 P 2920 0.004651 0.025552 1.000000
2 1200 P 4168 0.005020 0.054038 1.000000
3 1200 P 7824 0.005688 0.184216 1.000000
6 3600 P 20352 0.009705 0.423867 1.000000
4 -2400 B 6208 0.002636 0.132616 1.000000
5 1200 B 7112 0.003118 0.150897 1.000000
9 4800 P 33456 0.015526 0.701511 1.000000
7 -2400 B 11896 0.005517 0.249418 1.000000
8 1200 B 14632 0.006062 0.314622 1.000000
11 3600 P 41312 0.016770 0.891983 1.000000
10 -1200 B 17520 0.007967 0.369024 1.000000
13 3600 P 47832 0.021005 1.015692 1.000000
12 -1200 B 17944 0.010270 0.355183 1.000000
16 4800 P 53336 0.020860 1.160253 1.000000
14 -2400 B 18872 0.011446 0.366739 1.000000
15 1200 B 18416 0.010405 0.366141 1.000000
18 3600 P 59088 0.020431 1.314188 1.000000
17 -1200 B 14232 0.009961 0.340852 1.000000
20 3600 P 63248 0.024202 1.381677 1.000000
19 -1200 B 17688 0.012015 0.329761 1.000000
22 3600 P 63400 0.023845 1.389468 1.000000
21 -1200 B 18296 0.012242 0.343212 1.000000
25 4800 P 64240 0.019857 1.454204 1.000000
23 -2400 B 10936 0.011085 0.164504 1.000000
24 1200 B 4224 0.007755 0.026123 1.000000
26 2400 P 7400 0.006872 0.118126 1.000000
27 1200 P 5648 0.005992 0.082005 1.000000
28 1200 P 6184 0.006421 0.091276 1.000000
29 1200 P 6216 0.006228 0.094210 1.000000
30 1200 P 6072 0.006308 0.089640 1.000000
31 1200 P 6384 0.006269 0.098053 1.000000
32 1200 P 6296 0.006530 0.092990 1.000000
33 1200 P 14056 0.009508 0.200739 1.000000
34 1200 P 8384 0.006990 0.108898 1.000000
35 1200 P 5016 0.005664 0.069151 1.000000
36 1200 P 6096 0.005924 0.094392 1.000000
37 1200 P 6040 0.005992 0.092107 1.000000
38 1200 P 5896 0.006156 0.086783 1.000000
39 1200 P 11128 0.007718 0.157331 1.000000
40 1200 P 8240 0.006836 0.107171 1.000000
41 1200 P 4536 0.005577 0.057700 1.000000
42 1200 P 5640 0.006057 0.081096 1.000000
44 2400 P 61296 0.024542 1.327250 1.000000
43 -1200 B 23024 0.015210 0.331799 1.000000
46 3600 P 59368 0.026939 1.251373 1.000000
45 -1200 B 21504 0.013626 0.411636 1.000000
48 3600 P 54112 0.022709 1.160564 1.000000
47 -1200 B 22376 0.012674 0.444485 1.000000
50 3600 P 52040 0.021470 1.119951 1.000000
49 -1200 B 22752 0.012840 0.452353 1.000000
52 3600 P 59824 0.022852 1.307177 1.000000
51 -1200 B 22224 0.012047 0.447160 1.000000
54 3600 P 53664 0.022683 1.149087 1.000000
53 -1200 B 21240 0.012654 0.415168 1.000000
56 3600 P 55792 0.025292 1.176327 1.000000
55 -1200 B 23568 0.013467 0.466791 1.000000
58 3600 P 54552 0.021834 1.181234 1.000000
57 -1200 B 20784 0.012360 0.406469 1.000000
60 3600 P 50136 0.019640 1.090374 1.000000

filesize 2.068Mb

"old" b-frames:

##map version 8
nframes 560
timescale 30000
passes 1
seq deltaT type total_bits motion_complexity texture_complexity modulation
0 0 I 36000 0.000000 0.581896 1.000000
2 2400 P 4168 0.005020 0.054038 1.000000
1 -1200 B 848 0.000535 0.016230 1.000000
4 3600 P 11208 0.007528 0.272864 1.000000
3 -1200 B 3112 0.001724 0.080748 1.000000
6 3600 P 20344 0.009057 0.430671 1.000000
5 -1200 B 6400 0.003164 0.132097 1.000000
8 3600 P 31192 0.014125 0.657704 1.000000
7 -1200 B 10720 0.004825 0.226203 1.000000
10 3600 P 38464 0.018863 0.795514 1.000000
9 -1200 B 16072 0.007152 0.340200 1.000000
12 3600 P 47616 0.019753 1.023534 1.000000
11 -1200 B 19680 0.008787 0.416337 1.000000
14 3600 P 49008 0.019915 1.058071 1.000000
13 -1200 B 16848 0.009496 0.335214 1.000000
16 3600 P 48984 0.018762 1.069834 1.000000
15 -1200 B 16352 0.009377 0.323581 1.000000
18 3600 P 57736 0.019842 1.285494 1.000000
17 -1200 B 14616 0.010491 0.346320 1.000000
20 3600 P 63576 0.024190 1.390324 1.000000
19 -1200 B 17616 0.011760 0.330618 1.000000
22 3600 P 64784 0.024079 1.422888 1.000000
21 -1200 B 15752 0.011386 0.372314 1.000000
24 3600 P 63344 0.019784 1.431717 1.000000
23 -1200 B 10888 0.010858 0.165621 1.000000
26 3600 P 8768 0.009862 0.121294 1.000000
25 -1200 B 2616 0.005789 0.007055 1.000000
28 3600 P 8720 0.009346 0.125760 1.000000
27 -1200 B 2744 0.005903 0.007557 1.000000
30 3600 P 9176 0.009510 0.135836 1.000000
29 -1200 B 2936 0.006289 0.008362 1.000000
32 3600 P 9120 0.009471 0.134771 1.000000
31 -1200 B 2824 0.006180 0.006726 1.000000
34 3600 P 16536 0.011205 0.235986 1.000000
33 -1200 B 2560 0.005500 0.007089 1.000000
36 3600 P 8344 0.009254 0.116906 1.000000
35 -1200 B 3264 0.006578 0.010505 1.000000
38 3600 P 9040 0.009438 0.132979 1.000000
37 -1200 B 2696 0.006019 0.005064 1.000000
40 3600 P 14400 0.009978 0.203619 1.000000
39 -1200 B 2616 0.005980 0.003376 1.000000
42 3600 P 7952 0.009293 0.106233 1.000000
41 -1200 B 2640 0.006072 0.002986 1.000000
44 3600 P 61400 0.024677 1.328470 1.000000
43 -1200 B 22128 0.015013 0.315754 1.000000
46 3600 P 61424 0.025369 1.321718 1.000000
45 -1200 B 22240 0.013098 0.436409 1.000000
48 3600 P 51312 0.021687 1.098762 1.000000
47 -1200 B 22088 0.012406 0.439837 1.000000
50 3600 P 52280 0.022051 1.119977 1.000000
49 -1200 B 22656 0.013011 0.448095 1.000000
52 3600 P 58592 0.022386 1.280326 1.000000
51 -1200 B 22368 0.012264 0.448666 1.000000
54 3600 P 54416 0.023124 1.163888 1.000000
53 -1200 B 20856 0.012985 0.401639 1.000000
56 3600 P 55696 0.025178 1.174950 1.000000
55 -1200 B 23032 0.013399 0.453756 1.000000
58 3600 P 53176 0.021863 1.145244 1.000000
57 -1200 B 21312 0.012999 0.413350 1.000000
60 3600 P 49064 0.019555 1.063368 1.000000

filesize 2.130 Mb


From these results I can see that when there are still images the codec puts only P-frames instead of P and B.

B-frames are not really suitable for high-motion scenese

So I thought that for still-low motion scenes b-frames would be better. :confused:

Sharktooth
17th July 2004, 17:10
I think the codec choose to place a B frame where the combination of motion and texture complexity are lower than an unspecified value.
It may also decide depending on how much bits the codec saved with PSY, GMC and other fancy stuff...
At least this is the way I THINK it works.

nicco
17th July 2004, 17:17
B-frames by their nature are, of course, most useful where the forward and backwards frames bare strong resemblance to the current frame - so where frames 2 & 3 strongly resemble 1 & 4 you will likely see multiple B-frames selected by the encoder (if enabled).

In case of still images frame 1,2,3,4 ar not similar, they are exactly the same! So why the codec does not put B-frames?

Sharktooth
17th July 2004, 17:22
about 6000 bits...
They're small enaugh for the specified bitrate.
Why place a B frame (with a higher quant and lower quality) instead of a P frame if you have enaugh spare bitrate?:p

EDIT: however the "similar/same" frames are those with 0,00xxxx motion complexity...

Manao
17th July 2004, 17:27
If the frame are almost exactly identical, it is less costly to put p-frames than b-frames, mainly because the second reference doesn't bring any new information.

Sharktooth
17th July 2004, 17:29
That's true! OMG... i have to be drunk...

V-tec
17th July 2004, 18:00
I havo found a little code comparison between

VP6 (6.1 good Qulity)
XVID 1.1.0 build 13.07.04 (not official)
DivX 5.11 Pro standard mode
Divx 5.20 Pro standard mode

test (http://www.divxmania.it/index.php?showtopic=5455&st=0&#entry35409)

D-wizzz
17th July 2004, 19:47
no speako italliano:p

Sharktooth
17th July 2004, 20:55
The test is b0rked.
First of all he used DivX 5.2's multiple B-Frames with high motion source (NEEP NEEP!!!), he didnt specify what quantization type he used (h263 or MPEG?) and what parameters where used for the codecs?
He says he used all default settings except bitrate... i have my doubts...
Definatly not a good comparison.

EDIT: And i'm Italian too:p

DigitAl56K
17th July 2004, 23:56
Originally posted by nicco
In case of still images frame 1,2,3,4 ar not similar, they are exactly the same! So why the codec does not put B-frames?

Because it is more efficient to use P frames :) (which was my point above). E.g. you can use a P frame full of (0,0) mv's.

P.S. Good call Manao :)

nicco
17th July 2004, 23:58
Ok, thanks a lot guys, I'm a bit hard to understand!

I looked at the tests above and I agree with Sharktooth, there is no explanation about used settings.

What about 5.2 vs 5.1.1?

V-tec
18th July 2004, 12:27
Originally posted by Sharktooth
The test is b0rked.
First of all he used DivX 5.2's multiple B-Frames with high motion source (NEEP NEEP!!!), he didnt specify what quantization type he used (h263 or MPEG?) and what parameters where used for the codecs?
He says he used all default settings except bitrate... i have my doubts...
Definatly not a good comparison.

EDIT: And i'm Italian too:p

no multiple b-frame are used for this HM source, with multiple b-frames of divx 52 SSIM return strange results.
b-frames are used because in a DVD rip is not possible to activate and de-activate the b-f during the encondig or specify zones to use b-frames or not. Eevery way, the placed b-frame by DivX 5.2 in the HM source are so little that it is as if they had not been used.

If I speak of default settings that signify I have used default settings, except for XivD, where I have set max b-f to 1. Quant matrix is H.263 for all codec for that is possible the choice of quant matrix. Post process are deactivate for all codecs.

In any case also visually this new release o DivX for me sounds bad. specialy for low bitrate scenes.

Sharktooth
18th July 2004, 15:29
It IS bad. But the test was not done at "best possible quality" for all codecs.

V-tec
18th July 2004, 16:05
yes it's true, the tests have been made to have an idea of as the new release of the codec works.

if you put a look you can see that independently from the fact of low motion or High motion DivX 5.2 at low bitrates is not at the level of others codecs, also of DivX 5.11.

also with the goal to obtain maximum quality, the situation don't change, DivX 5.2 is a step under the others.

I will make some test also on al long clips to see if that is always true.

nicco
18th July 2004, 17:46
This is the BIG problem: Divx5.2 seems to be the same or even worse than the "old" divx 5.1.1 :eek:

Sharktooth
18th July 2004, 18:32
Originally posted by V-tec
yes it's true, the tests have been made to have an idea of as the new release of the codec works.

if you put a look you can see that independently from the fact of low motion or High motion DivX 5.2 at low bitrates is not at the level of others codecs, also of DivX 5.11.

also with the goal to obtain maximum quality, the situation don't change, DivX 5.2 is a step under the others.

I will make some test also on al long clips to see if that is always true.
Thanx. It will surely help to understand what circumstancies or combination of settings should be absolutely avoided with this version.

bond
29th July 2004, 19:56
hm did a quick test with divx5 and the multiple b-frame setting

my finding was that it used in my sample max. 2 b-frames in a row + it indicates the multiple b-frames in the user data in the vol with adding a "m" at the end of the bitstream description (similar to how they added a "p" with packed bitstream/only 1b in a row)