View Full Version : Nandub encoding after stats analysis


vax
16th April 2003, 17:02
Hi everybody!

I would like to share a technique of my own for encoding DivX 3.11 movies with Nandub. I would appreciate any comments on that technique, so there it is:

1. Resize the movie to a given resolution - e.g 640x... if you target a 2-CD movie.
2. Make a first-pass encoding.
3. Have a look at the .stats file using NandubStatsReader by Koepi /best regards for that tool/ - you can find it at http://mitglied.lycos.de/koepi/. Note the size of the movie encoded with bitrate 6000/DRF 2.
4. If you are targeting 2 CDs (1400 MB) and first pass has produced file with size (BR 6000/DRF 2) about 1700 MB go to step 5. If you are over this size try to reduce resolution and repeat steps 2-4. If you are under 1700 MB you can safely increase resolution and repeat again steps 2-4.
5. For the second pass choose audio, calculate the bitrate and open SBC settings.
6. In the DivX tab drop the Min allowed BR to 100Kbps and switch off all Antishit and antifreeze options. In the Bitrate curve tab choose in/out stats files and remove all BR curve tweakings - motion modulation = 0, curve compression = 0, no luma correction, filters - hipass = 0, lopass = 6000, smoother = 0. In the Motion tab leave the default settings. In the Gauge tab set Min gauge = 30, Max gauge = 100 (for a 2-CD movie), In the compression levels set Min DRF = 2 and Max DRF = 3 (!!!), the same settings for KF quality below.
7. Finally run the second pass (F7)

The idea that lies behind this algorithm is to resize the DVD source to a "proper" resolution to achieve best quality after encoding. Resizing means loosing bytes from the source, so you get first file downsizing by resizing (depends on the resolution chosen) and file downsizing by compression (depends on the movie - how "good" it compresses). How many bytes you have "lost" you are told by NandubStatsReader after the first pass. So if you set the first pass size to be close to the desired final movie size (1400 MB in the example above) and you encode with Min/max DRF 2/3 you will get the best encoding quality for your resolution.

I have tested this technique on several dozens of movies and I always get good results - DivX quality varying from 80 to over 90 percent.

Regards,
vax

Pen-Pen
29th April 2003, 17:04
sure your movie will be beautiful (except maybe, sometime, for some shit, luma flip, wrong DRF (the joys of SBC :D))

but there's no challenge in doing that ^^

I can also show you some films (eg 'From Hell') that fit on 1cd, 640x352, with 2 audio tracks

But I get the point with your idea of preserving max quality

To do so, try REAL SBC 1st pass settings :D

DRF2
6000kbps
gauge 100/100/100

:D

or even better, XViD Q2 ;)

vax
29th April 2003, 20:12
Actually you don't need to setup DRF, bitrate and gauge for the first pass. Nandub always encodes 1st pass with DRF2/max BR 6000 . Gauge is not used doing 1st pass also.
Of course you can encode perfect 1CD movies, but this depends on the "compressability" of the movie, which is strictly individual for each movie. As my experience shows darker movies compress much better than movies with colourfull or brighter scenes (I think this is the case with 'From Hell') - try 'The Usual Suspects'/PAL 25fps for example - it compresses extremely good and you can raise the hor. resolution up to 672 while maintaining perfect quality on 1cd.
Following my idea you can see that 'The Usual Suspects' compresses so good only by looking at the 1st pass .stats data using NandubStatsReader and further choose the max. quality SBC settings for the 2nd pass. If you use the standard Nandub guides-recommended settings for the movie above you will probably end up with much undersized movie.
And finally for the shit, luma flip, etc., I suppose the problem is in the codec, not SBC itself. SBC for me is still the best way to have full control over the final encoded movie in the means of overall quality, quality of scenes with much motion, etc.

regards,
vax

Pen-Pen
29th April 2003, 21:46
I meant using Nandub's 1st pass settings for the second pass, I know you can't choose anything for the 1st pass ;)

and for me : SBC = DiVX 3.11 (I know it's a mistake, but it's a mistake I got used to make ;)

I'm ALWAYS aiming towards 1cd (I said "aiming", it's not always possible)...

and I've given up on DiVX since I've learned XViD :)

vax
30th April 2003, 17:04
OK, I get it.

You can use BR6000/DRF2 Gauge100/100/100 only if your 1st pass size equals your target size. But in such a case SBC gets useless ;-(

Anyway I think that 1st pass size gives you a good starting point to compute the max quality 2nd pass settings, not to just guess them.

About XViD, I've never tried it out. I doubt the software you use to encode XViD movies (GKnot maybe?) gives you such a level of control as SBC does.

Regards,
vax

Koepi
2nd May 2003, 09:43
*caugh* well, I feel like I have far more control over XviD than over DivX3/SBC.

Sorry to throw that in here, but I simply couldn't resist as technically nandub/DivX3 is a bit outdated.

Best regards
Koepi

Pen-Pen
5th May 2003, 22:45
Originally posted by vax
OK, I get it.

You can use BR6000/DRF2 Gauge100/100/100 only if your 1st pass size equals your target size. But in such a case SBC gets useless ;-(


of course it is... but with your settings, you don't fully use it either ^^


About XViD, I've never tried it out. I doubt the software you use to encode XViD movies (GKnot maybe?) gives you such a level of control as SBC does.


unlike unfriendly DiVX 3 that needs a whole piece of software like nandub to be fully used, modern codecs (like XViD) come with nice and thorough interfaces that offer you at least as much tweaking as nandub (with all the other additional advantages)

vax
7th May 2003, 11:20
Maybe it is not a good idea to turn this thread into another DivX vs. XViD dispute ;-))

Following the topic would you appreciate an addition to nandub that will allow reading and analysis of stats files, i.e. sth. like Koepi's NandubStatsReader built into Nandub.

I've coded such a thing for myself, still in 'ultra beta' version but I'm not aware of the legal stuff to modify nandub. I would appreciate some advice and comment on that undertaking.

regards,
vax

Pen-Pen
16th May 2003, 17:05
sure, no dispute at all ^^

your idea is great, if you find nando, you can ask him :D

vax
17th May 2003, 09:21
Thanx, Pen-pen

As I've read nando is out of the scene for almost two years. Any idea how to find nando, e-mail, etc.?

Acaila
17th May 2003, 09:43
Nandub is licensed under GPL, which means you can freely make any additions/changes that you want as long as you release the source code of your modifications.

vax
17th May 2003, 15:04
Thank you, Acaila. Is it possible to post my addition to Nandub here? I need some oppinion on what I have done - remarks, suggestions, etc. before I pack the final release.

Acaila
17th May 2003, 15:58
Sure, no problem.

manono
18th May 2003, 08:54
Is there anything wrong with the Stats File Reader/Analyzer that's built into Gordian Knot?

vax
19th May 2003, 12:21
It's built in GKnot, not Nandub. There is no size-to-frame graph as in Koepi's tool. There is no DRF distribution, if you decide to analyze 2nd pass stats file. The latter is much useful for me.

Regards,
vax

vax
21st May 2003, 11:01
I have placed the bare executable at http://free.hit.bg/vax/

It is zipped with password: nandub.exe

The stats file analyzer is under the menu Options->SBC Options->Stats Analysis...

I am waiting for comments.

regards,
vax

dahl
22nd May 2003, 17:23
Originally posted by vax
I am waiting for comments.


It's not possible to download. A couple of mirrors wouldn't hurt.

vax
22nd May 2003, 17:49
Strange, I think. It seems to be working for me. You should see a link to nd.zip at http://free.hit.bg/vax/.

I'll publish it somewhere else tomorrow.

regards,
vax

vax
22nd May 2003, 17:58
I uploaded zipped exe-only on a second server

You can download from:

http://free.bol.bg/vax/index.html
http://free.hit.bg/vax/index.html

or direct link:

http://free.bol.bg/vax/nd.zip
http://free.hit.bg/vax/nd.zip

dahl
22nd May 2003, 22:12
The link shows up but the download never starts when clicking it.
Maybe there are some kind of restrictions on the webserver?

vax
23rd May 2003, 12:28
Possibly not.

I'm trying to upload site at angelfire and fortunecity all the day, but connection is terribly slow and I always end up with timeout.

As I have heard a lot of optical cables that pass beneath the Mediterraniean sea have been damaged due to the earthquake in Algeria, so this may be the cause for the slow connection.

vax
26th May 2003, 13:20
Finally I managed with uploading file at angelfire & fortunecity.
The four mirrors are:

http://free.bol.bg/vax/nd.zip
http://free.hit.bg/vax/nd.zip
http://members.fortunecity.com/vax1/nd.zip
http://www.angelfire.com/alt/vax/nd.zip

best regards,
vax