View Full Version : 2-pass XviD gets heavily undersized
masken
31st March 2003, 17:48
Ok, first of all, yes I've been here quite a while and followed development etc, but I've actually never tried encoding myself very much hehe, so please bare with me and don't exclude any n00bie mistakes :D
I'm encoding an R2 DVD that's 122 minutes long, using the following:
XviD build: Koepi's 22032003
AVISynth: 2.51
MPEG2Dec3 v.1.0
Convolution3D-YV12 beta4
decomb 406b6
VirtuaDubMod: 1.4.13.1
First of all, I wanted to use Lanczs3Resize, but I didn't get that to work. I checked the YV colorspace thing in DVD2AVI, following the Doom9 guide. But nevermind that. The real problem is that the encodes ends up in like 650-900mmb's (without audio). I've tried:
* Motion 6, MPEG quant, VHQ2, chroma, and b-frames 3/100/200/0
* Motion 6, MPEG quant, VHQ0, chroma, and b-frames 3/100/200/0
AVISynth script:
# PLUGINS
#LoadPlugin("lanczos3.dll")
LoadPlugin("Decomb.dll")
LoadPlugin("MPEG2Dec.dll")
LoadPlugin("Convolution3DYV12.dll")
#
# SOURCE
mpeg2source("F:\DVD_decrypt\Manhunter\VIDEO_TS\manhunter2.d2v")
#
# DEINTERLACING (1)
FieldDeinterlace()
#
# CROPPING
crop(12,74,700,432)
#
#
Convolution3D(preset="movieLQ")
#
# RESIZING
#Lanczos3Resize(640,272)
BicubicResize(640,272,0,0.5)
The thing is it also seems to get smaller everytime I encode :( I want this in 2CD's at 640 x 272 (with the original AC3). Shouldn't that be possible with a 122min source?
Also, this R2 DVD seems quite interlaced, no? Examples 1 (http://www.home.no/masken/pics/interlaced_mh_pal_01.PNG), 2 (http://www.home.no/masken/pics/interlaced_mh_pal_02.PNG), 3 (http://www.home.no/masken/pics/interlaced_mh_pal_03.PNG), and 4 (http://www.home.no/masken/pics/interlaced_mh_pal_04.PNG). I should use FieldDeinterlace(), right?
Please help! :)
Nic
31st March 2003, 18:13
please post ALL your settings when posting bugs.
I.e. what bitrate did you set, what is the compressibility check like GKnot and how is the quality of the video?
Cheers,
-Nic
ps
@all on forum: Ok, from now on, people posting bugs without posting all there settings (especially important ones) are just going to get striked without warning. Im now going to stress this more in the stickys
@masken:
Sorry if this sounds harsh, as it's not really directed at you, because you did post almost everything :) you just forgot the bitrate :)
FieldDeinterlace should be fine, check the AVS in virtualdub and see if it looks good.
(Also try forcing the quantizers to only use very low quants (like 2-3) the movie should be very large then).
manono
31st March 2003, 18:21
Hi-
1. To make sure that you're really using AviSynth 2.51, make an .avs with just this:
Version()
and open that in VDubMod.
2. Assuming you're really using 2.51. then LanczosResize is built into it. You don't need to load the plugin (which is for pre 2.07 if I'm not mistaken), but just put:
LanczosResize(640,272)
in your script.
3. Yes, that's interlacing, but before giving up and just deinterlacing, you might try and use:
Telecide(Guide=2,Post=False)
in the script to see if that fixes it up.
4. My guess is that your undersize issue is because you've maxed out the filesize. Knock off the B-Frames if you want to make the file size larger, or use fewer of them.
5. Someone correct me if I've said anything wrong or stupid.:)
Asmodian
31st March 2003, 19:59
I just wanted to agree with manono (he sounded somewhat unsure and seemed right on to me - try his suggestions), B-frames are unnecessary (especially @ 3/100/200) if you are getting undersized files - they do lower quality. I also think b-frames aren't quite working properly (2-pass and max key-frame spacing are not quite right with b-frames). I also really like q-pel, H263, VHQ=0 and NO B-frames with the rest of your settings as is (just a suggestion you could try)
masken
31st March 2003, 22:24
Thanks for the suggestions m8's :)
@Nic, I forgot the filesize, sorry. It's set to 1433594 kb, ending up in about half that size it seems...
@manono, I'm doing another encode right now, but I'll try the Version() when it's done.
I'll also try turning off the b-frames, and set VHQ to 0 in the next one.
masken
31st March 2003, 23:02
Originally posted by manono
Version()hmm... nothing at all showed up when I did that?
Mango Madness
31st March 2003, 23:30
about this posting bugs thing, i just had a thought. would it be possible to somehow add a form that you fill out that would have you fill in the settings and what not then have a field at the bottom for comments where you'd describe the problem. Then have this posted onto the forum. Just a thought.
Sharro
1st April 2003, 01:14
Originally posted by Asmodian
...I also really like q-pel, H263, VHQ=0 and NO B-frames with the rest of your settings as is (just a suggestion you could try)
@EDIT (qpel only helps compressibility with very sharp images so go for it and also at higher quants the image is better - not sharper, but less mosquito) END EDIT
lumimasking, h263 will only increase compressibility, so definetly not in this case.
Masken for 2 cd rips run a search here for iago's encoding document. Have a look at it's 2 cds settings as they might solve you'r undersize, specially the way he caps the quantizers which in your case I would try maybe even more agressive settings.
Why use convolution3d? it only increases compressibility. With this case I think you don't want that.
I after getting rid of the above you don't make it to target filesize try higher resolution but I think that without b-frames, convolution and capping quantizers will do.
For further decrease I would give a try to:
LumaFilter(-2) with mpeg2dec3
UnFilter(-5,-5) you have to load it in your script.
Hope it helps.
Take Care.
Sharro
PS: Mango Madness a sticky with that would be great and would certainly avoid "vague" questions.!
kilg0r3
1st April 2003, 08:54
why not uncheck 'discard first pass'. in this way you can see that your undersize is not due to a scaling error.
I'd try with qpel (makes the image better at low quants), chroma motion and vhq = 1.
If your still not satisfied then, you could try some of those crazy custom mpeg matrices floating around. some of them are said to be capable fo increasing image quality and filesize considerably.
APF_Gandalf
1st April 2003, 22:15
I already posted a workaround for undersized files if you really want the file to exactly fit a size when Xvid @ Quantizer 2 without B-frames, VHQ, Lumi Mask (or anything else helping compressibility) stays undersized.
I don't know why you'd want to make a 2 CD rip if it fits on 1 CD @ quantizer 2, but I used a trick to fit a rip that was 200 MB undersized on 1 CD. Maybe it could help.
it's at the end of this thread
http://forum.doom9.org/showthread.php?s=&threadid=47986
masken
2nd April 2003, 10:18
Okay, I'm gonna try editing the statsfile there... (btw, how do I do that?)
I'm trying another encode with iago's I-frame values. Before that I did an encode, setting the bitrate to 1034366 kbytes. It ended up 700000 kbytes... (H.263, VHQ off, b-frames off, chroma, i-frames 2,6,2,12).
masken
2nd April 2003, 10:19
By the way, how about this for a 2nd pass template?
XviD Configuration
Encoding options
• Encoding Mode: 2 Pass - 2nd pass Int
• Desired size (Kbytes): 1034366
Global
Global settings
• Motion Search Precision: 6
• Quantization type: H.263
• FourCC used: XVID
• VHQ mode: 0
• Maximun I-frame interval: 300
• Minimum I-frame interval: 1
• Enable lumi masking: [ ]
• Enable interlacing: [ ]
• Quarterpel: [v]
• Enable Grayscale: [ ]
• Global Motion Compensation: [ ]
B-frame control
• Maximum B-frames: -1
• B-frame quantizer ratio (%): 150
• B-frame quantizer offset: 100
• B-frame threshold: 0
• DX50 B-VOP compability: [v]
• Print debug info on each frame: [ ]
• Packed bitstream: [ ]
Quantization
Quantizer restrictions
• Min I-frame quantizer: 2
• Max I-frame quantizer: 4
• Min P-frame quantizer: 2
• Max P-frame quantizer: 8
• Min B-frame quantizer:
• Max B-frame quantizer:
Two Pass
Two-pass tuning
• I-frame boost %: 2
• Discard first pass: [ ]
• Dummy 2nd pass: [ ]
• Below i-frame distance...: 10
• I-frame bitrate reduction %: 20
Curve compression
• High bitrate scenes %: 15
• Low bitrate scenes %: 15
• Bitrate payback delay (frames): 250
• Payback with bias: ( )
• Payback proportionally: (o)
Stats files etc
• Hinted ME: [ ]
• 1st pass stats: F:\DVD_decrypt\Manhunter\VIDEO_TS\newstest\newtest.stats
• 2st pass stats:
Alt. Curve
Use Alternative curve system [ ]
• Curve aggression:
• High distance from average %:
• Low distance from average %:
• Enable automatic minimum relative quality: [v]
• Strength %: 30
• Minimum relative quality %: 50
• Enable automatic bonus bias calculation: [v]
• Manually set bonus bias: 50
Bitrate and overflow
• Max bitrate (Kilobit/s): 10000
• Max overflow improvement: 60
• Max overflow degradation: 60
Credits
Credits at start of movie [ ]
• Credits start at frame no.: 0
• Credits end at frame no.: 0
Credits at end of movie [ ]
• Credits begin at frame no.: 0
• Credits end at frame no.: 0
Encode credits in grayscale [ ]
• Desired % rate: (o) 20
• I-frame quantizer: ( )
• P-frame quantizer:
• Starting size (Kbytes): 1000
• Ending size (Kbytes): 1000
Debug
Performance optimizations
• Automatically detect optimizations (o)
• Force optimizations ( )
• MMX [v]
• Integer SSE [v]
• SSE [v]
• SSE2 [ ]
• 3DNow! [v]
• 3DNow! 2 [v]
• Number of threads:
Chroma and frame drop
• Chroma Optimizer: [ ]
• Frame drop ratio: 0
CBR options
• Reaction Delay Factor: 16
• Average period: 100
• Smoother: 100
kilg0r3
2nd April 2003, 10:30
You could also try and use hvs best picture matrix or my mpeg-in-half matrix (http://kilg0r3.cjb.net/downloads/mpeg-in-half.rar) which simply divides every quantization factor of the mpeg matrix in half which results in a ca 2,5 times larger file size.
Sharro
2nd April 2003, 11:43
Masken try first with mpeg quant instead of h263.
Remember u got to run a full first pass with mpeg quant so everything works properly.
Take care.
Sharro
Didée
2nd April 2003, 12:39
Originally posted by kilg0r3
... my mpeg-in-half matrix (http://kilg0r3.cjb.net/downloads/mpeg-in-half.rar) ...
... which is only one step away from the unbelievable DoubleBR-matrix :)
(We could need attachements working again, BTW)
But seriously, kilg0r:
I'd suggest to distribute the coeffs a little "smoother" (in the upper-left of intra), and for no reason but my feeling, I'd not use coeffs < 8.
And only heaven knows why XviD's standard matrix has that "big jump" in the upper-left area of intra.
Anyway, that's a very effective method for those over-compressable things.
Sorry for the little OT
kilg0r3
2nd April 2003, 13:28
Originally posted by Didée
Anyway, that's a very effective method for those over-compressable things.
What do you mean?:confused: :)
Didée
2nd April 2003, 13:35
Saturated encoding without reaching desired file size.
masken
3rd April 2003, 09:38
Originally posted by kilg0r3
You could also try and use hvs best picture matrix or my mpeg-in-half matrix (http://kilg0r3.cjb.net/downloads/mpeg-in-half.rar) which simply divides every quantization factor of the mpeg matrix in half which results in a ca 2,5 times larger file size. How do I use this?
I tried an encode with the settings as in the template above... I ran the first pass, then I opened up the .stats file in the XviD stats reader, and set the final size to 1300000kb. When I saved it it said that it had scaled it "down" to a compression ratio of 0.538:1. It produced a 650mb encode that looked like crap.
Argh!
kilg0r3
3rd April 2003, 09:50
erm, perhaps it wasn't such a good tip after all:rolleyes:. I have only started to play with these matrices myself. As Didee already mentioned, my matrix might be seriously flawed. Just try some other matrices. For that, redownload the file. It'll contain some of the mentioned hvs matrices.
Sorry, don't have the time to explain much more. just search for hvs matrix or custom matrix/ces in the forum and will find all info that i have.
btw, are you sure you did the first and second pass with the custom matrix? It's just relatively unlikey to produce an undersized file with it.
masken
3rd April 2003, 09:58
@ kilg0r3, no, I haven't tried your matrix as of yet.. that's why I asked how to use it :) Ok, I'll search and see..
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.