Log in

View Full Version : How to get good quality?


Van the man
13th May 2004, 00:11
Hi!
Everytime I encode an Xvid the final video is bad quality.
If you have seen a good video from a "scene group" you know what good quality is.
Even if the movie is 1.30h the video is bad.Is there any filters to use?
Oh,yeah I do 2pass encoding.

This is the .avs script I use for all movies:

#
# Created with Gordian Knot
#
# http://gknot.doom9.org
#
# PLUGINS
LoadPlugin("c:\INSTAL~1\03-DIV~1\GORDIA~1\mpeg2dec3.dll")
LoadPlugin("c:\INSTAL~1\03-DIV~1\GORDIA~1\undot.dll")
#LoadPlugin("c:\INSTAL~1\03-DIV~1\GORDIA~1\decomb.dll")
#LoadPlugin("c:\INSTAL~1\03-DIV~1\GORDIA~1\KernelDeInt.dll")
#LoadPlugin("c:\INSTAL~1\03-DIV~1\GORDIA~1\dgbob.dll")
#LoadPlugin("c:\INSTAL~1\03-DIV~1\GORDIA~1\Convolution3d.dll")
#LoadPlugin("c:\INSTAL~1\03-DIV~1\GORDIA~1\FluxSmooth.dll")
#LoadPlugin("c:\INSTAL~1\03-DIV~1\GORDIA~1\TomsMoComp.dll")
#LoadPlugin("c:\INSTAL~1\03-DIV~1\GORDIA~1\VSFilter.dll")
#LoadPlugin("c:\INSTAL~1\03-DIV~1\GORDIA~1\SimpleResize.dll")

So any other filters to use?

Thanks....

obieobieobie
13th May 2004, 00:25
Depends on the source. I use Gordian Knot and it makes the .avs for me with the settings I choose. Sometimes other filters are needed. I suggest you read doom9's xvid guide. If you follow it, you'll get a nice encode.

bond
13th May 2004, 10:41
Van the man,
plz read up yourself as much as possible (in the forum, the guides aso..)
there is not THE one solution which brings the best quality, quality always heavily depends on the sources, the used bitrate aso...
only testing out yourself and practice will tell you what settings would we good for a movie

communist
13th May 2004, 10:46
Originally posted by Van the man
Hi!

This is the .avs script I use for all movies:

Huh? Your script only shows that it loads those plugins, maybe you can be a bit more specific and post your full script. It would also help to track down your problems if you state the type of content you'd like to compress with XviD. There are movies that just look as good as the original even on 1CD while there are others that require a higher bitrate.
Oh and this has been said a lot of times post your XviD settings etc. (you are doing 2pass but what exact settings?).
We need a lot more info to help you ;)

Soulhunter
13th May 2004, 20:25
Clear question, clear answer... (http://forum.doom9.org/showthread.php?s=&threadid=74477) :D


Seriously...

- Post your full AVS, but without these "#" lines !!!

- Post all your XviD settings !!!

- Maybe give us some info about the source also !!!


Bye

GolovachLena
14th May 2004, 04:45
Originally posted by Van the man
So any other filters to use?


Try VDub's Smart Smoother HiQ by Klaus Post. Or use VP6, it's far less noise-dependable than Xvid, Divx etc.

Koepi
14th May 2004, 06:20
If you use vdub filters, you need full processing.

your video gets converted from yv12 to rgb then - and the codec converts it back to yv12.

Bad idea, you loose speed and quality.

Nice hint golovachlena, don't mess around with people that aren't as knowledgable, they tend to blindly believe the answers given here.

Also VP6 isn't what he asked about.

Regards
Koepi

GolovachLena
14th May 2004, 06:53
Originally posted by Koepi
Bad idea, you loose speed and quality.


Sure. But quality loss isn't actually noticeable under common circumstances, as you may know. The bad thing really is that this filter is very slow itself, but it can effectively remove unseen but crucial noise without much blurring, preserving significant amount of detail. Anyways, a one can give it just a try.

Koepi
14th May 2004, 08:17
Convolution3d() does the same in YV12 colour space. So it's possible to "gain" some quality with those filters, and lightning fast. You should give it a try.
For your purpose a simple Undot() filter could suffice, too (I use it most of the times) - it has no visible effect but compressability raises by a good amount.

The quality loss introduced by colour space conversions is noticable with good sources. That's why we started to adopt all our favorite tools to a plain yv12 process chain. In the avisynth forum there is a sticky thread on that topic (beware, it's very long) which might be an interesting reading for you.

Regards
Koepi

SeeMoreDigital
14th May 2004, 10:48
Originally posted by Soulhunter
Clear question, clear answer... (http://forum.doom9.org/showthread.php?s=&threadid=74477) :D Ha, ha.. that's wicked!

Hey Soulhunter, when Kiss bring out their new range of HD (Sigma) chipset based standalone players. We'll be able to play all our HQ XviD encodes in hardware :D

Personally speaking I can't wait!


Cheers

kilg0r3
14th May 2004, 12:10
Originally posted by SeeMoreDigital
We'll be able to play all our HQ XviD encodes in hardware :D Do you have any information about the containers and features to be supported by these players? Matroska? (Ha,ha!) Ogm? MP4? Vorbis Audio? AAC? Subtitles? ...................................?

Or, will they try stomping avi down our throats again (I love inventing new idioms for foreign languages :D)?

SeeMoreDigital
14th May 2004, 12:46
Originally posted by kilg0r3
Do you have any information about the containers and features to be supported by these players? Matroska? (Ha,ha!) Ogm? MP4? Vorbis Audio? AAC? Subtitles? ...................................?

As it happens, hans-jürgen posted an link here: -

http://www.mpeg-playcenter.com/modules.php?name=News&file=article&sid=95

Time to start saving your pennies boys and girls...


Cheers

Soulhunter
14th May 2004, 17:07
34: Will MP4 data format be supported?
YesHmm, MP4 data format ???

Does this mean MP4 container... :confused:

Btw, does someone know if its able to read DVD's written in UDF mode ???


Bye

bond
14th May 2004, 19:27
Originally posted by Soulhunter
Hmm, MP4 data format ???

Does this mean MP4 container... :confused:yes, as i wrote it will support chapters and subs as placed by nero recode2 in .mp4

i am sure ahead is behind this .mp4 support on the new sigma chip :D

Soulhunter
14th May 2004, 19:35
Originally posted by bond
yes, as i wrote it will support chapters and subs as placed by nero recode2 in .mp4Nice... :)


Bye

SeeMoreDigital
14th May 2004, 19:50
Can somebody here generate and post a short Nero .MP4 encode with chapters?


Cheers

kilg0r3
14th May 2004, 20:28
Originally posted by Soulhunter
Btw, does someone know if its able to read DVD's written in UDF mode? I am not sure about, but if it plays files that are larger than 2 GB, i think, it has to support udf because of the filesize limit of the iso file system. When you see the light you know if it's wrong or if it's right. Ding ... :D

Koepi
14th May 2004, 21:08
So this is all about good quality achievement in xvid.

Quite interesting.

Please focus on the thread purpose...

:)

Regards
Koepi

kilg0r3
14th May 2004, 21:45
Sorry, i let myself go somewhat ... :)

@ Van the man

If you are still reading, please provide us with some more info. The things we usually need to help are all listed in the Sticky of this forum. This may sound a bit harsh, especially after having highjacked your thread but the more info you provide the better we can help.

SeeMoreDigital
14th May 2004, 22:07
Yep,

A 90min 2pass XviD encode should look pretty good even if you kept the image pixel frame size the same as the source and stuck it onto an 700MB CD~R.

What's your source like Van. PAL, NTSC, interlaced, animie....


Cheers

Soulhunter
14th May 2004, 22:21
Ok, maybe reading this (http://forum.doom9.org/showthread.php?s=&threadid=64054) and this (http://forum.doom9.org/showthread.php?s=&threadid=29221) thread could be useful... ;)


Bye

Van the man
15th May 2004, 01:09
thanks for the replys so far.I will check out the stuff koepi and soulhunter ;)

And here is abit more info,from the source and my script.

# PLUGINS
LoadPlugin("c:\INSTAL~1\03-DIV~1\GORDIA~1\mpeg2dec3.dll")
LoadPlugin("c:\INSTAL~1\03-DIV~1\GORDIA~1\undot.dll")
#LoadPlugin("c:\INSTAL~1\03-DIV~1\GORDIA~1\decomb.dll")
#LoadPlugin("c:\INSTAL~1\03-DIV~1\GORDIA~1\KernelDeInt.dll")
#LoadPlugin("c:\INSTAL~1\03-DIV~1\GORDIA~1\dgbob.dll")
#LoadPlugin("c:\INSTAL~1\03-DIV~1\GORDIA~1\Convolution3d.dll")
#LoadPlugin("c:\INSTAL~1\03-DIV~1\GORDIA~1\FluxSmooth.dll")
#LoadPlugin("c:\INSTAL~1\03-DIV~1\GORDIA~1\TomsMoComp.dll")
#LoadPlugin("c:\INSTAL~1\03-DIV~1\GORDIA~1\VSFilter.dll")
#LoadPlugin("c:\INSTAL~1\03-DIV~1\GORDIA~1\SimpleResize.dll")

# SOURCE
mpeg2source("C:\DVD\A man apart\KDVD\apart.d2v")

crop(0,4,720,568)
LanczosResize(640,346)
Undot()



As you can see I removed all the "#".

Source:

PAL
Interlaced
16:9
157570 frames
105minutes
(not anime ;) )

heres my xvid settings:

2pass - 1st:

Motion search precision: 6 - Ultra high
Quantization type: MPEG
FourCC used: XVID
VHQ Mode: 0 - Off
Maximum i-frame interval: 300
Minimum i-frame interval: 5
In the Quantization settings, I used 2,6,2,16
I also used the Credits settings.

2pass - 2nd.int

Motion search precision: 6 - Ultra high
Quantization type: MPEG
FourCC used: XVID
VHQ Mode: 4 - Wide search
Maximum i-frame interval: 300
Minimum i-frame interval: 5
In the Quantization settings, I used 2,6,2,16
I also used the Credits settings.

thats pretty much what I have.If you want to know something else I will try to get an answer.

:)

Thanks again

gatormac
15th May 2004, 03:39
The most glaring thing: where are you setting "minimum I-frame interval"? The only thing I have ever set is "maximum I-frame interval". Are you sure that 5 isn't for "frame drop ratio"? if it is you need to change it to zero for both passes. I wouldn't change settings between passes, therefore you probably should change VHQ in your first pass to 4 (or change both passes to 1 as I don't think there is much benefit to a VHQ > 1). Also, how did you "set" your zones for credits? You may have made an error there. Also, thats a weird quant setting....probably should be OK, but why the 16?

manono
15th May 2004, 04:39
Hi-

LanczosResize(640,346)

That's a bad resize, as 346 is only Mod 2. Reset the W and H-Moduls to the default 32 and 16, or at least to 16 and 16.

If you have seen a good video from a "scene group" you know what good quality is.

There's my laugh for the day.

malkion
15th May 2004, 04:57
if u're capping quants, 2-6 will only use bframes at 4-10 for the default settings.

Blue_MiSfit
15th May 2004, 05:47
If you have seen a good video from a "scene group" you know what good quality is.

There's my laugh for the day.


:D I concur!!

Everything I have seen online is truly sad compared to what is possible...

IE a 700mb version of the south park movie at full resolution and 6ch ac3... leaves so little space for video.

GolovachLena
15th May 2004, 06:18
Originally posted by Van the man
heres my xvid settings:

Some hints (hope Koepi won't interfere too much with criticism ;)):
1. Use same settings on both passes (VHQ mostly)
2. DON'T use quantizer caping (at least for a while)
3. What the sh... is Min I-frame interval? What version of codec do you use actually? ;) This option vanished long time ago and the setting it to 5 in early RC's led to really horrible quality (as i remember this issue...)

p.s. I'v seen A Man Apart the movie coded in Xvid it was near perfect quality.

Koepi
15th May 2004, 09:41
Sounds like an old build to me too.

Upgrade to 1.0 as soon as it's out (damn, still no announcement, my binary starts getting old....).

Undot is a very fast filter, use it before you resize.

After resizing and not deinterlacing the source the "interlace" is wrong, it has nothing to do with real interlacing. Uncheck that. Earlier (dev-api-3) builds had problems with bframes and interlaced encoding IIRC, so don't check "interlaced" in xvid configuration (this doesn't make sense at all - and was broken in some old builds, but as it makes no sense even don't use it in 1.0 - just use it on full PAL resolution [or on full ntsc resolution]).

In xvid 1.0 you don't need different settings for first and second pass, fast firstpass will speedup encoding by a good amount.

Regards
Koepi

virus
15th May 2004, 10:04
Originally posted by Koepi
Upgrade to 1.0 as soon as it's out (damn, still no announcement, my binary starts getting old....).
<offtopic>
I believe they have a serious problem accessing the server. Six days of delay for an update have never happened :(
</offtopic>

Van the man
15th May 2004, 10:17
SO :)
Could someone write exactly what setting I shall have in the xvid settings?

2pass - 1st:

Motion search precision: 6 - Ultra high
Quantization type: MPEG <-- ?
FourCC used: XVID
VHQ Mode: 4 - Wide Search
Maximum i-frame interval: 300 <-- dont know what to type there.
Minimum i-frame interval: 5 <-- dont know what to type there.
In the Quantization settings, I used 2,6,2,16 <-- dunno there either
I also used the Credits settings.

2pass - 2nd.int

Motion search precision: 6 - Ultra high
Quantization type: MPEG <-- ?
FourCC used: XVID
VHQ Mode: 4 - Wide search
Maximum i-frame interval: 300 <-- same as above
Minimum i-frame interval: 5 <-- same as above
In the Quantization settings, I used 2,6,2,16 <-- same as above
I also used the Credits settings.

Hope someone can help me out here :)
Thanks for all the help so far

Koepi
15th May 2004, 10:38
Just use xvid-1.0-rc4 and you get rid of your minimum interval problem.

MPEG quant is good.

You should use trellis quantisation also, and keep the quantizer range at default.

virus
15th May 2004, 10:38
mmhhh... "2nd.int"... "minimum I-frame interval"... "Credits settings"... looks like ffdshow/ffvfw. You should download RC4 from Koepi's site first.

[EDIT] ooops... Koepi typed faster :)

Van the man
15th May 2004, 16:25
Just use xvid-1.0-rc4 and you get rid of your minimum interval problem.

MPEG quant is good.

You should use trellis quantisation also, and keep the quantizer range at default.

Shall I use the chroma motion?
And what shall the VHQ be?

Should I use some more filter perhaps in my script?

Gonna test out with the rc4 codec now,used the version before rc4,on the last tests.

gatormac
15th May 2004, 16:40
Maybe you should try AutoGK....you will get excellent results with just a few clicks.

malkion
15th May 2004, 16:42
the unofficial xvid faq web site seems to be down for me, i was going to recommend it for some reading.

chroma motion should help quality, yes.

vhq, the higher u choose, the higher the quality.

keeping with good quality, if your source is very clean, there's no need for extraneous filters.

you should keep minimum i-frame interval at default, while setting maximum i-frame interval to your desired fps * 10. 240 for ntsc, 250 for pal. this is just all according to the faq.

for your 2nd pass, if u kept your first pass encode, for best quality, keep your desired file size around 75% of your 1st pass, or minimum of around 60% (i wouldn't go below 65%). u can also check your 1st pass size using stats reader (thanks koepi)

Magno
16th May 2004, 11:16
I really have the same question than that of Van the Man; i have encoded several times a cartoon episode from a DVD with Xvid 1.0 RC4 and i have configures it an the most proper way (i guess...) as i am full experieced with MPEG-2 (anyway, i use the same options you all guys have recommended).

But the point is that i think i could get even more quality with some AVS filter; i have tried with MSmooth, MSharpen, both of them in either order, and i even use the (cpu=6) option in MPEG2DEC3.dll, but i am still getting those awful square borders in the characters; whenever a red color appears, the distorsion of that border apears too :( And kind of the same with the blue colors...

Dou you, masters, think i should use some filter after resizing?

BTW, what are those H-MOD and V-MOD parameters in GKnot useful for? I can't understand how they affect in final quality...

SOme information about the encoding:
- Xvid 1.0 RC4 two passes
- resolution 512x384
- about 980Kbps
- MPEG quantization (i use too a home-made matrix which gets better quality)
- B-VOP -> offset 0.85 and ratio 1.25
- adaptative quatization
- quantizers in their default range, execpt for the maximum-I quantizer = 15
- Chroma optimization
- Soft-bicubic resizing

Teegedeck
16th May 2004, 11:25
Minimum i-frame intervall should be '1'.