jon.schaffer
3rd May 2004, 14:01
SUBJECT:
Better Overflow Treatment Settings (?) [Koepi's RC4]
Hi everybody,
I recently had a problem with a DVD encoding (with Koepi's XviD 1.0 RC4 [Hola!]) which led to an oversized file. I searched for a guilty and found a solution to this problem. I later walked around the forum and found some relative threads, but the answers to the same problem didn't satisfy me. So I would like to bring some elements which may be interesting.
Here's the story:
I encoded one of my DVDs (Solaris, by S. Soderbergh, if someone can/wants to test it to verify the problem...) with some personnal settings and a bitrate of 1904 kbps in order to make this 1h34mn movie fit on 2CD (with mp3-CBR-160kbps sound). The final file was over 1.6 Go (with sound). (I must precise that I've already encoded several movies before, without any problem). My settings were not to blame, since the default settings led to the same (even more important!) problem...
So, I did many 2-pass tests with different sequences of different movies with different contents (i.e., from very high to very low-motion, in sequences of 500 to 1000 frames). The final files were nearly always over- or undersized (the error was sometimes very important).
The low-motion scenes generally produce oversized file; the high-motion scenes generally produce undersized files. When a clip (even a short one) has both low-motion and high-motion scenes, the final bitrate is close to the targeted bitrate. It acts as if the correct final-bitrate was achieved thanks to the alternation of high- and low-motion scenes, the first raising the bitrate, the second lowering it . So, the Bitrate Control seems inaccurate for short clips with homogeneous contents.
In a previous thread, Koepi explains that the default settings are OK for entire movies (at least more than 10 minutes said OUTPinged_ in another thread)... It's indeed OK for most movies, but with a movie like "Solaris", which has a lot of long very-low-motion scenes and no high-motion scenes, the default settings of XviD don't seem correct. So, the BitRate Control also seems inaccurate for full-length movies with homogeneous contents.
Some other conclusions to my tests:
- when a target file-size is asked instead of a bitrate, the result is the same.
- with the default settings, H.263 quantization involve a more important final bitrate-error than MPEG quantization.
- with the default settings, when high bitrates (e.g. 1900 kbps) are asked, the final bitrate-error is by far more important than in the case where lower bitrates are asked (e.g. 1000 kbps). So maybe a lower target bitrate aims its goal easily (I didn't test a lower bitrate with the whole movie). With the settings I recommend below, it's OK in both cases.
• I found 2 solutions to the problem:
1) disabling the B-frames allow to get the correct bitrate. But as B-frames are such a good thing to improve quality (at a fixed bitrate), this is not a good solution. I must conclude that B-frames are a difficulty for the BitRate Control... Is it right?
2) tweaking the "overflow treatment" values. A good solution, this time.
For the bad-size files problem, Koepi recommends high percentage for these values (20%). I don't know for which version of XviD these are good, but it seems to me that they're not good/optimal for XviD 1.0 RC4. Indeed, in my short-clips tests, these values lead to a correct final bitrate, but they produce a high number of high-quantizers frames (up to 24-29!), which involve some very ugly visible artifacts: blinking blocks in moving regions, even when the average bitrate is high... (but I must be honest: I didn't test Koepi's advised settings in a full-length movie, since I had already found some good settings by myself... ).
I found settings for this values which allow the codec to create a correct file-size and at the same time which produce a maximum of low-quantizer frames (or at least, which do not produce too high quantizers frames) - the key is to allow the codec to decrease the bitrate a bit more efficiently:
DEFAULT
- Overflow control strength 5
- Max. overflow improvement 5
- Max. overflow degradation 5
MY RECOMMENDED VALUES
- Overflow control strength 0 (the Crusty's FAQ say it is the Automatic setting and (normally) the DEFAULT value - maybe in prior versions?)
- Max. overflow improvement 4
- Max. overflow degradation 9 (this allows the codec to avoid the oversizing by lowering the bitrate easier, but without decreasing too strongly as 20% does)
(Other near values, like "0,5,9", "0,5,10" or "0,10,10", provide close results, but involve slightly more high quantizer frames)
These settings (for all the full-length movies and short clips encoding I made since) are OK for both final file-size and quality...
I won't say that these settings are the best in an absolute way... they seemed to be the best in my tests, and I use them since, that's all... I'm waiting for suggestions...
In fact, I don't know if my reasoning is right: it seems to me that, for a same bitrate, it is better to avoid having high-quantizer frame (if possible...). Let me know if I'm wrong...
I'm kind of a noob... neither developper, nor specialist in anything... This means that I've maybe forgotten some important point, like B-frames behaviour, etc. Furthermore, I don't really know how the 2-pass sytem really works. I don't know exactly how to use the Stats-reader which seems to be an important tool: in some previous threads, I read that the estimated file-size of the 1st pass was an important factor. With the "solution" I found to my problem, I don't bother this 1st-pass information... Is it bad?
###
So, to sum up:
- overflow default settings can lead to oversized (and under?) for certain full-length movies, whose content is too homogeneous.
- Koepi's recommended settings are good for correct final size achievement, but can produce ugly artifacts (in short clips, at least).
- the settings above (just slightly modified compared to defaults) seem to correct the size prediction problem and to preserve quality both in full-length movies and in short clips.
That's all.
I hope that:
- first, the error was not my fault (though, I don't think so). If it's the case, just consider my willingness and excuse me for wasting your time...
- secondly, this can help the development of this wonderful codec... My post is not a "bug"-report, but I think that the Default-Settings should be usable by all users, even rookies (and for almost all the encoded source),...
- in the third place, a final version will come soon...
Yours,
Jon
PS:
BTW another point/question concerning the bitrate: after calculating the bitrate in the built-in BitRateCalc, the value imported in the TargetBitRate param is 4 kbps higher than the one calculated (eg: 1908 instead of 1904). Why? Is it a pre-correction face to the BitRate Control behaviour (the final bitrate is about always 5 kbps lower than the expected one...)? Is it normal?
Better Overflow Treatment Settings (?) [Koepi's RC4]
Hi everybody,
I recently had a problem with a DVD encoding (with Koepi's XviD 1.0 RC4 [Hola!]) which led to an oversized file. I searched for a guilty and found a solution to this problem. I later walked around the forum and found some relative threads, but the answers to the same problem didn't satisfy me. So I would like to bring some elements which may be interesting.
Here's the story:
I encoded one of my DVDs (Solaris, by S. Soderbergh, if someone can/wants to test it to verify the problem...) with some personnal settings and a bitrate of 1904 kbps in order to make this 1h34mn movie fit on 2CD (with mp3-CBR-160kbps sound). The final file was over 1.6 Go (with sound). (I must precise that I've already encoded several movies before, without any problem). My settings were not to blame, since the default settings led to the same (even more important!) problem...
So, I did many 2-pass tests with different sequences of different movies with different contents (i.e., from very high to very low-motion, in sequences of 500 to 1000 frames). The final files were nearly always over- or undersized (the error was sometimes very important).
The low-motion scenes generally produce oversized file; the high-motion scenes generally produce undersized files. When a clip (even a short one) has both low-motion and high-motion scenes, the final bitrate is close to the targeted bitrate. It acts as if the correct final-bitrate was achieved thanks to the alternation of high- and low-motion scenes, the first raising the bitrate, the second lowering it . So, the Bitrate Control seems inaccurate for short clips with homogeneous contents.
In a previous thread, Koepi explains that the default settings are OK for entire movies (at least more than 10 minutes said OUTPinged_ in another thread)... It's indeed OK for most movies, but with a movie like "Solaris", which has a lot of long very-low-motion scenes and no high-motion scenes, the default settings of XviD don't seem correct. So, the BitRate Control also seems inaccurate for full-length movies with homogeneous contents.
Some other conclusions to my tests:
- when a target file-size is asked instead of a bitrate, the result is the same.
- with the default settings, H.263 quantization involve a more important final bitrate-error than MPEG quantization.
- with the default settings, when high bitrates (e.g. 1900 kbps) are asked, the final bitrate-error is by far more important than in the case where lower bitrates are asked (e.g. 1000 kbps). So maybe a lower target bitrate aims its goal easily (I didn't test a lower bitrate with the whole movie). With the settings I recommend below, it's OK in both cases.
• I found 2 solutions to the problem:
1) disabling the B-frames allow to get the correct bitrate. But as B-frames are such a good thing to improve quality (at a fixed bitrate), this is not a good solution. I must conclude that B-frames are a difficulty for the BitRate Control... Is it right?
2) tweaking the "overflow treatment" values. A good solution, this time.
For the bad-size files problem, Koepi recommends high percentage for these values (20%). I don't know for which version of XviD these are good, but it seems to me that they're not good/optimal for XviD 1.0 RC4. Indeed, in my short-clips tests, these values lead to a correct final bitrate, but they produce a high number of high-quantizers frames (up to 24-29!), which involve some very ugly visible artifacts: blinking blocks in moving regions, even when the average bitrate is high... (but I must be honest: I didn't test Koepi's advised settings in a full-length movie, since I had already found some good settings by myself... ).
I found settings for this values which allow the codec to create a correct file-size and at the same time which produce a maximum of low-quantizer frames (or at least, which do not produce too high quantizers frames) - the key is to allow the codec to decrease the bitrate a bit more efficiently:
DEFAULT
- Overflow control strength 5
- Max. overflow improvement 5
- Max. overflow degradation 5
MY RECOMMENDED VALUES
- Overflow control strength 0 (the Crusty's FAQ say it is the Automatic setting and (normally) the DEFAULT value - maybe in prior versions?)
- Max. overflow improvement 4
- Max. overflow degradation 9 (this allows the codec to avoid the oversizing by lowering the bitrate easier, but without decreasing too strongly as 20% does)
(Other near values, like "0,5,9", "0,5,10" or "0,10,10", provide close results, but involve slightly more high quantizer frames)
These settings (for all the full-length movies and short clips encoding I made since) are OK for both final file-size and quality...
I won't say that these settings are the best in an absolute way... they seemed to be the best in my tests, and I use them since, that's all... I'm waiting for suggestions...
In fact, I don't know if my reasoning is right: it seems to me that, for a same bitrate, it is better to avoid having high-quantizer frame (if possible...). Let me know if I'm wrong...
I'm kind of a noob... neither developper, nor specialist in anything... This means that I've maybe forgotten some important point, like B-frames behaviour, etc. Furthermore, I don't really know how the 2-pass sytem really works. I don't know exactly how to use the Stats-reader which seems to be an important tool: in some previous threads, I read that the estimated file-size of the 1st pass was an important factor. With the "solution" I found to my problem, I don't bother this 1st-pass information... Is it bad?
###
So, to sum up:
- overflow default settings can lead to oversized (and under?) for certain full-length movies, whose content is too homogeneous.
- Koepi's recommended settings are good for correct final size achievement, but can produce ugly artifacts (in short clips, at least).
- the settings above (just slightly modified compared to defaults) seem to correct the size prediction problem and to preserve quality both in full-length movies and in short clips.
That's all.
I hope that:
- first, the error was not my fault (though, I don't think so). If it's the case, just consider my willingness and excuse me for wasting your time...
- secondly, this can help the development of this wonderful codec... My post is not a "bug"-report, but I think that the Default-Settings should be usable by all users, even rookies (and for almost all the encoded source),...
- in the third place, a final version will come soon...
Yours,
Jon
PS:
BTW another point/question concerning the bitrate: after calculating the bitrate in the built-in BitRateCalc, the value imported in the TargetBitRate param is 4 kbps higher than the one calculated (eg: 1908 instead of 1904). Why? Is it a pre-correction face to the BitRate Control behaviour (the final bitrate is about always 5 kbps lower than the expected one...)? Is it normal?