Log in

View Full Version : Encoding not reproducible


TKC
15th April 2006, 01:43
Hello,

I encoded a video (X-Men 2) with XviD. I encoded it again to test something. Even though I (mean to have) used the same settings I used in the first encoding, the image have more blocks and more noise.
What's the problem? Then I changed the settings a bit and played with them, but the result was never as good as before.

Info:
The second time I encoded the video, I had ffdshow installed.
The 2nd time, I only encoded the first 2 minutes.

XviD Version: 1.2-127 (Koepi 25022006)
Two-pass encoded
Defined bitrate: 1200 kbps
Quantization Type: MPEG
Motion search precision: 5
VHQ mode: 0
Profile: unrestricted
0 QPel
1 Global motion compensation
1 Use chroma motion
1 Turbo

I'd be very glad if someone could help me!

Greetz

sysKin
15th April 2006, 05:32
First two minutes at 1200kbps is a different quality than entire movie at 1200kbps. In the movie, the 1st two minutes could easily have got 2.5mbps, which was then taken away from some later scenes.

Your settings are weird - you sacrificed some quality for a lot of speed, but you also activated GMC which is horribly slow and is known to give very little quality (in fact, it reduces quality when used without VHQ).

TKC
15th April 2006, 10:49
First two minutes at 1200kbps is a different quality than entire movie at 1200kbps. In the movie, the 1st two minutes could easily have got 2.5mbps, which was then taken away from some later scenes.
So, that means, if the first two minutes had 2.5 mbps, it should be even better than the first, shouldn't it?!

Your settings are weird - you sacrificed some quality for a lot of speed, but you also activated GMC which is horribly slow and is known to give very little quality (in fact, it reduces quality when used without VHQ).
What would you recommend then, that encoding doesn't slow down much?

Thanks,
TKC

shon3i
15th April 2006, 11:00
Two-pass encoded
Defined bitrate: 1200 kbps
Quantization Type: H263 or some other matrix like Sharktooth LR or Soulhunter similar
Motion search precision: 6
VHQ mode: 1-4 (better 4 but if you need speed then use 1 or 2)
Profile: unrestricted
1 QPel
0 Global motion compensation
1 Use chroma motion
0 Turbo
1 VHQ for B frames

foxyshadis
15th April 2006, 13:05
So, that means, if the first two minutes had 2.5 mbps, it should be even better than the first, shouldn't it?!
Yes, exactly, and that's why your first encode was better than anything following. The only way you could replicate your results is to run a first pass on the entire movie once, then always run second passes off of that, even when you only do two minutes worth. (Forcing the first two minutes to 1200 might be forcing the entire movie to 600, which would explain why it's so different.)

This might cause your two minutes to come out tremendously oversized while testing, but that doesn't matter, because it'll even out when you go to do the whole movie.

sysKin
15th April 2006, 13:38
So, that means, if the first two minutes had 2.5 mbps, it should be even better than the first, shouldn't it?!
First two minutes had 2500 at 1st encode, and only 1200 at second encode. Or the other way around, it's just a speculation anyway.
What would you recommend then, that encoding doesn't slow down much?
I'd say your settings are good if you're in a hurry (otherwise, defaults, but your settings are MUCH faster), just definitely disable GMC.

TKC
15th April 2006, 13:50
In the XviD guide (http://www.doom9.org/xvid-vdub-11.htm) is written:
Turbo ;-) enables speed optimizations in the motion estimation. While they theoretically could degrade the output, it seems safe enough to active them and during my tests I was unable to spot any degradation.
@shon3i: Why disabling it? Isn't it that good?

Concerning the bitrate, it's clear to me now. Using direct stream copy I extracted the same duration than the 2nd encode. Indeed, the 1st encode has 2472 kbps, the 2nd (encoded with shon3i's recommendations) has 1180 kbps.

(...) just definitely disable GMC.
Why is it so bad?

Is the quality much worse, if I set VHQ to 2.

In my AVS-script I convert the video to RGB24, does it make sense to activate "use chroma motion" then? Or shouldn't I convert it?

Greetz & Thanks to all!

shon3i
15th April 2006, 14:07
@shon3i: Why disabling it? Isn't it that good?If i tell you that FAQ is little outdated and should be for dev-api 3 bulds that mean builds form 2003. Newermind i used turbo in 2 pass but not see any different until some very noise encoding which is look very terrible on some scens, From than and now always keep off turbo for 2pass for safe reason, btw not incrase speed to much, how you can decrase quality. So turbo is only good at 1pass.

(...) just definitely disable GMC.Why is it so bad?
GMC is very powerfull tool of mpeg4-asp codecs aka DivX/XviD, but you can't know when to use GMC or not, becouse sometimes is not good, only big speed decrase nothing on picture quality incrase. If you have time you should encode clip twice and compare, if picture better than should be used in encoding. btw GMC sometimes good where have a lot a motion aka action scenes, in this scenes can help but that is encoder job and him decide to use GMC or not.

In my AVS-script I convert the video to RGB24Newer do that conversations becouse RGB is lossy and you can extra loose in quality. YV12 is colorspace for XviD.

does it make sense to activate "use chroma motion" thenUse chroma motion always becouse incrase quality much.

Is the quality much worse, if I set VHQ to 2.Can you post encoded video, and vob segment or some screenshoots of problematic frames. THanks

TKC
15th April 2006, 14:48
I packed the critical images and uploaded it: Download here (http://adi.kousz.ch/downloads/imgs.rar)!
I made a RAR, because it compressed it much smaller than pngcrush...

Newer do that conversations becouse RGB is lossy and you can extra loose in quality. YV12 is colorspace for XviD.
Doesn't do DGIndex that too when PC scale is selected, does it?

shon3i
15th April 2006, 14:53
Doesn't do DGIndex that too when PC scale is selected, does it?No by default always is YV12, only if you put at the end of script ConvertToRGB24.

shon3i
15th April 2006, 15:26
I am now looking you pictures, and i can tell one thing if you want keep quality you can forgot speed. So use this settings and try

1pass:

Quantization Type: Mpeg Custom use this EQM V3LR (http://www.webalice.it/f.corriga/CQMs/eqm_v3lr.xcm) or EQM V3ULR (http://www.webalice.it/f.corriga/CQMs/eqm_v3ulr_rev3.xcm) and open into editor
Motion search precision: 5
VHQ mode: 1
Profile: unrestricted
1 QPel
1 Global motion compensation
1 Use chroma motion
1 Turbo
1 VHQ for B frames
1 Adaptive Quantization
Max consectuive BVOPs: 2
B frame quant ratio: 1.62
B frame quant offset: 0
0 Packed Bitsteam
1 Trellis quantization
Quantizer Restrictions: I 2-31
P 2-31
B 2-31

In zones

Click on quantizer and type 4
1 Chroma Optimizer Enabled

2pass:

Quantization Type: same as first pass
Motion search precision: 6
VHQ mode: 1-4 that is you decision i will stay to 1 or 2
Profile: unrestricted
1 QPel
1 Global motion compensation
1 Use chroma motion
0 Turbo
1 VHQ for B frames
1 Adaptive Quantization
Max consectuive BVOPs: 2
B frame quant ratio: 1.62
B frame quant offset: 0
0 Packed Bitsteam
1 Trellis quantization
Quantizer Restrictions: I 2-31
P 2-31
B 2-31

In zones

Click on weight type 1
1 Chroma Optimizer Enabled

2pass more options

I-frame bost 0
I- frames closer than 1
reduced by 0

Overflow Treatment 0/5/5

Hi bitrate degradation 30
Lo bitrate improvments 15


You source is not very clean, little noise is present so you can use light denoiseres like RemoveGrain(mode=2) or (mode=5) or COnvolution3D("MovieHQ") or similar in you avs script. This can help encoder with complicated scens.

If this not look so good for you can try get ansver with x264.

sysKin
15th April 2006, 17:08
Is the quality much worse, if I set VHQ to 2.
No, if you set VHQ to at least 1 then GMC will improve quality a *tiny little bit* and *huge speed cost*. Before you do that, maximize VHQ, motion precision, VHQ for bframes, trellis, and generally everything you can - because GMC is the least useful option of them all.
In fact, even then, don't use GMC. It's not worth it. And it breaks compatibility with standalones.

From than and now always keep off turbo for 2pass for safe reason, btw not incrase speed to much, how you can decrase quality. So turbo is only good at 1pass. This doesn't make sense.... There is no difference between whast turbo does on two-pass encodiong and one-pass encoding, it's just lower motion precision for qpel and for b-frames.
If you like speed, keep Turbo, it's there for exactly this reason.
GMC is very powerfull tool of mpeg4-asp codecs aka DivX/XviD, but you can't know when to use GMC or not, becouse sometimes is not good, only big speed decrase nothing on picture quality incrase.

I'm sorry shon3i but you seem to be completely wrong here ;)
1. GMC is not powerful, it's crap
2. GMC is automatically turned on and off, both on frame level and on macroblock level, depending on whether it's needed or not.

squid_80
15th April 2006, 17:52
1. GMC is not powerful, it's crap
Then can I ask (not that I dispute your point) why it was implemented? Was it just a proof of concept type thing?

shon3i
15th April 2006, 18:05
This doesn't make sense.... There is no difference between whast turbo does on two-pass encodiong and one-pass encoding, it's just lower motion precision for qpel and for b-frames.
If you like speed, keep Turbo, it's there for exactly this reason.
I mean when you doing a second pass, i don't mean betwen single and two pass modes, turbo should be used on single pass mode, becouse than quality is not important, turbo can only degrade quality for little incrase in speed in second pass

I'm sorry shon3i but you seem to be completely wrong here
1. GMC is not powerful, it's crap
2. GMC is automatically turned on and off, both on frame level and on macroblock level, depending on whether it's needed or not.
You didn't understand me. i mean GMC can't know how whole scene looks, i doing some test with DRF analyzer and ffdshow and GMC is more applyed with small motions scens. So when be GMC been in zones to define what is high motion scene not frame, i think GMC will produce better results.

Teegedeck
15th April 2006, 20:41
You didn't understand me. i mean GMC can know how whole scene looks, i doing some test with DRF analyzer and ffdshow and GMC is more applyed with small motions scens. So when be GMC been in zones to define what is high motion scene not frame, i think GMC will produce better results.You can be sure that sysKin did understand you. You can also bet your life that he knows what he's talking about .

Yes, of course GMC is an improvement; nobody debates that. I always use it. But is it really worth the additional encoding time? If one wants to have the good feeling of using every last feature that enhances quality and if one already uses ME precision=6, VHQ=4 and QPel, then: yes. But it's a bit like using V=0 in LAME: you will never be able to tell the difference. But on the other hand, if you have to think about whether you'd rather use VHQ=4 or GMC the choice should clearly be GMC. And if you don't use GMC you certainly don't have to be worried about that.

shon3i
15th April 2006, 21:12
You can be sure that sysKin did understand you.He don't understand me becouse i didn't express corectly, and becouse he give me wrong answer.

I say that: GMC can't know to this whole scene looks and GMC don't know where to put frames

He say: GMC is automatically turned on and off, both on frame level and on macroblock level, depending on whether it's needed or not.

He explain me how GMC works in teory, and there is not my answer.

So why to use GMC when he can do a job where is need, example very high motion scens, than i see is whery present on other low motion scens.

Teegedeck
15th April 2006, 22:13
No, GMC by itself doesn't know when it makes sense. VHQ does. That's why you should use GMC only in combination with VHQ, okay?

shon3i
15th April 2006, 22:17
No, GMC by itself doesn't know when it makes sense. VHQ does. That's why you should use GMC only in combination with VHQ, okay?Okay.

foxyshadis
16th April 2006, 02:30
squid_80: probably because divx did it. I remember some time back when a divx dev talked about it, saying that he understood why GMC was cut out of the AVC spec, and that they wouldn't have implemented it if they thought it wasn't worthwhile but it never gave the kind of promising gains they hoped for.

sysKin
16th April 2006, 08:53
GMC can't know to this whole scene looks and GMC don't know where to put frames

Hmm if I understand you correctly you're saying that GMC can't see the whole frame? Yes it can, this is why the analysis (GME) is so slow, it works on entire frame at once.
By all means GME has all the information it can ever need.

shon3i
16th April 2006, 12:02
can't see the whole frameno no LOL He can see frame but can't see whole scene that mean can see what is next 100 frames. I doing movie Saw with GMC and he do a good job but i see GMC frames is on very low motion scenes, on high motion scenes is very little GMC frames, than when GMC be in zones i think that use GMC on very high motion scenes, that mean if that whole scene have 100 frames than that all frames to be GMC.

Teegedeck
16th April 2006, 12:22
Do I understand you correctly that you think you know better where to use GMC than VHQ knows?

If yes: Why would you think that?

Edit: BTW, I get a funny feeling when I read your posts. I don't know how to put it; perhaps you get my meaning if you picture sysKin as being the 'Professor emeritus' of XviD around here and the rest of us as students. Using words like LOL in response to his answers to your questions does seem a bit... odd.

Edit: What gave you the idea that XviD can only 'see' one frame ahead? That's not correct.

GodofaGap
16th April 2006, 12:59
It is almost completely irrelevant if XviD can "see" the whole scene or not for GMC. You shouldn't be wanting to force GMC on a whole scene anyway, because a. GMC doesn't work very well in all kinds of situations and b. b-frames are usually much more efficient.

In practice, GMC is just a worthless tool speed/quality wise. So what is there really to argue about?

sysKin
16th April 2006, 13:49
no no LOL He can see frame but can't see whole scene that mean can see what is next 100 frames.
Hehe sure, bt it doesn't need to. Next 100 frames are completely irrelevant for current GMC because current GMC only ever affects current frame. In fact same applies to past frames, they don't matter at all.

There are some codec aspects that could benefit from seeing into the future (RC, quantization, b-frame decision) but GMC is absolutely not one of them.

shon3i
16th April 2006, 15:02
that you think you know better where to use GMC than VHQ knows?
Sure, i know how that picture looks visualy, GMC can't know, so then if i define zone where to used GMC this can help. For example same thing wit quants. Some scene use higher quants and looks more blocky, using zones reduce qunats.

Hehe sure, bt it doesn't need to. Next 100 frames are completely irrelevant for current GMC because current GMC only ever affects current frame. In fact same applies to past frames, they don't matter at all.That's the good answer, So why to use GMC when his use one or two frames in GOP, and GOP have 25-30 frames. That can't improve visual quality. I think when some high motion scene looks like ISSSSSSSSSSSSSPBI looks more better than IBBPPBSBPPSBBI for example if that can be.