Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Video Encoding > MPEG-4 ASP

Reply
 
Thread Tools Search this Thread Display Modes
Old 9th December 2009, 01:17   #81  |  Link
LoRd_MuldeR
Software Developer
 
LoRd_MuldeR's Avatar
 
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,048
Quote:
Originally Posted by n0an View Post
For example, this is the ultimate matrix. Could anyone kindly explain me how it will work on the quality?
This cannot be explained easily. The effect of quantization matrices (positive or negative) may highly depend on the kind of content and on the target bitrate.

For example there are "sharp" matrices tuned to keep fine detail at high bitrates. Such a matrix will give horrible results at medium/low bitrates.

At the same time there are "smooth" matrices tuned to keep reasonable quality at low bitartes. Such a matrix won't give satisfactory results at medium/high bitrates.

In short: Don't use a custom matrix, unless you know exatcly what you are doing and why you need a non-standard matrix.

(Note: H.264 is known to give best results with the standard "flat" matrix. Psy optimizations, as implemented in x264, usually work better than custom matrices)

Quote:
Originally Posted by n0an View Post
One more thing, if I set bitrate of 1200 kbps and use this matrix, will the ultimate matrix increase the file size or all matrix work within the fed bitrate?
Of course the resulting file size will always be the same, as long as you set the same target (average) bitrate. The following rule applies, no matter what:
size = bitrate * duration

Well, given that the rate control of your encoder works properly and doesn't fail with non-standard matrices
__________________
There was of course no way of knowing whether you were being watched at any given moment.
How often, or on what system, the Thought Police plugged in on any individual wire was guesswork.



Last edited by LoRd_MuldeR; 9th December 2009 at 01:19.
LoRd_MuldeR is offline   Reply With Quote
Old 9th December 2009, 02:25   #82  |  Link
n0an
Britain's Finest!
 
n0an's Avatar
 
Join Date: Jun 2009
Posts: 143
I need to experiment to understand the usage. Practical knowledge and examples help me understand better. Anyway, I am wanting to have a low and medium bitrate based matrix. I am trying to understand each matrix in the CQM editor.

The higher the bar means all details below that threshold will not be encoded - that means they will remain as it is? You think you could help me understand it during your free time? I would really appreciate it. I won't take long to understand as I have been reading and grasping stuff for quite a while now .

P.S. I am mainly looking for XviD and HD (x264) based matrix.
n0an is offline   Reply With Quote
Old 9th December 2009, 15:44   #83  |  Link
LoRd_MuldeR
Software Developer
 
LoRd_MuldeR's Avatar
 
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,048
Quote:
Originally Posted by n0an View Post
The higher the bar means all details below that threshold will not be encoded - that means they will remain as it is?
No, it doesn't. Each coefficient in the DCT transformed macroblock will be divided through the corresponding entry in the quantization matrix. It's important to understand the DCT transform, before you try to understand what quantization matrices do! After division, the DCT coefficients are rounded - that's what causes loss! The higher the value in the quantization matrix, the higher the rounding error (loss) for the corresponding DCT coefficient. That's why we use high quantization values for the "high" frequencies: The coefficients for the "high" frequencies usually have low values anyway. If we divide that through a high value (from the quant matrix), it will be extremely small and thus rounded to zero, most likely. So after quantization we have a lot of zero coefficients in our transformed DCT block. This doesn't save us any bits yet, but it does in the next step, which is entropy coding! At the same time the loss in the "higher" frequencies ("fine detail") isn't as noticeable as loss in the "lower" frequencies ("coarse" detail).

Furthermore it is important to understand that all this high/low frequency to fine/coarse detail mapping only applies to I-Frames. In P- and B-Frames the story is a bit different:
http://forum.doom9.org/showpost.php?...9&postcount=17

Quote:
Originally Posted by n0an View Post
P.S. I am mainly looking for XviD and HD (x264) based matrix.
As said before: Most likely you won't ever need any custom matrices for x264. It works best with the default (flat) matrix. That's because most things people tried to achieve with custom matrices in the past is done by x264's Psy-optimizations nowadays, only in a better way. So again: Don't mess with custom matrices, unless you know exactly why you need them...

Quote:
Originally Posted by n0an View Post
Anyway, I am wanting to have a low and medium bitrate based matrix. I am trying to understand each matrix in the CQM editor.
Look here for examples:
http://forum.doom9.org/showthread.php?s=&threadid=83125
__________________
There was of course no way of knowing whether you were being watched at any given moment.
How often, or on what system, the Thought Police plugged in on any individual wire was guesswork.



Last edited by LoRd_MuldeR; 9th December 2009 at 20:50.
LoRd_MuldeR is offline   Reply With Quote
Old 9th December 2009, 21:03   #84  |  Link
kool
Registered User
 
Join Date: Nov 2009
Posts: 79
Quote:
Originally Posted by LoRd_MuldeR View Post
In short: Don't use a custom matrix, unless you know exactly what you are doing and why you need a non-standard matrix.
* a question, What is your opinion on Xvid? as you already know there is lots of custom matrix around and you also post a link at # 83.

* Will MPEG produce a good output result for larger file size and x263 for smaller 1 CD, for user which don't know what they are doing with matrix?

* Will matrix keep more detail than default MPEG and x263?

Last edited by kool; 9th December 2009 at 21:09.
kool is offline   Reply With Quote
Old 9th December 2009, 23:11   #85  |  Link
LoRd_MuldeR
Software Developer
 
LoRd_MuldeR's Avatar
 
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,048
Quote:
Originally Posted by kool View Post
* a question, What is your opinion on Xvid? as you already know there is lots of custom matrix around and you also post a link at # 83.
Well, Xvid is one of the best MPEG-4 ASP encoders (along with DivX). But it certainly can't reach the quality of a good AVC/H.264 encoder, such as x264.

Quote:
Originally Posted by kool View Post
* Will MPEG produce a good output result for larger file size and x263 for smaller 1 CD, for user which don't know what they are doing with matrix?
This question makes no sense. There is no such thing as "x264". You probably mean x264. But x264 is a MPEG-4 AVC (H.264) encoder, so you can't compare it to MPEG.

MPEG is standard that defines many things, such as MPEG-1, MPEG-2, MPEG-4 ASP (implementd by DivX/Xvid), MPEG-4 AVC (H.264) as well as various audio and container formats.

Quote:
Originally Posted by kool View Post
* Will matrix keep more detail than default MPEG and x263?
This question makes even less sense. Maybe you refer to MPEG-4 ASP quantization matrices ???

MPEG-4 ASP (as implemented by Xvid and DivX) supports two types of quantization. They are called "MPEG" and "H.263". Only the "MPEG" quantization type allows custom matrices.

Whether a custom matrix gives any benefit over the default matrix depend on what you are trying to achieve. But an unsuitable matrix can easily screw up your encode!
__________________
There was of course no way of knowing whether you were being watched at any given moment.
How often, or on what system, the Thought Police plugged in on any individual wire was guesswork.


LoRd_MuldeR is offline   Reply With Quote
Old 9th December 2009, 23:16   #86  |  Link
n0an
Britain's Finest!
 
n0an's Avatar
 
Join Date: Jun 2009
Posts: 143
Okay, so I will try to understand DCT first. I will try to get a *study* partner for this as a few imp. things go over my head.

One question, I like the H.264 matrix a lot and I was wondering if there is a way to use that matrix for XviD encodes? I have read mixed reviews on H.263 for 1CD and MPEG for 2CD encodes, and someone said H.263 is way better than MPEG. If that is true then why not use H.263 for 2CD+ encodes as well?

How different is H.263 for H.264 and is there a method to incorporate the detail preserving matrices of H.264 in H.263?

Last edited by n0an; 9th December 2009 at 23:18.
n0an is offline   Reply With Quote
Old 9th December 2009, 23:21   #87  |  Link
LoRd_MuldeR
Software Developer
 
LoRd_MuldeR's Avatar
 
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,048
Quantization in H.264/AVC is completely different from MPEG-4 ASP. Therefore H.264 quantization matrices are not even comparable to MPEG-4 ASP matrices!

And to make this clear again: For MPEG-4 ASP (Xvid/Divx) the "MPEG" and "H.263" quantization types are not different quantization matrices. They are two different types of quantization.

Only the "MPEG" type can use custom matrices (as replacement for the default one). That's not possible with the "H.263" quantization type.

However the "H.263" type is known to create a slightly "smoother" image than the "MPEG" type (with standard matrix). Generally "H.263" seems to be preferable for low bitrate encodes.
__________________
There was of course no way of knowing whether you were being watched at any given moment.
How often, or on what system, the Thought Police plugged in on any individual wire was guesswork.



Last edited by LoRd_MuldeR; 10th December 2009 at 00:14.
LoRd_MuldeR is offline   Reply With Quote
Old 9th December 2009, 23:32   #88  |  Link
kool
Registered User
 
Join Date: Nov 2009
Posts: 79
Quote:
Originally Posted by LoRd_MuldeR View Post



This question makes even less sense. Maybe you refer to MPEG-4 ASP quantization matrices ???
Yes
kool is offline   Reply With Quote
Old 10th December 2009, 00:47   #89  |  Link
n0an
Britain's Finest!
 
n0an's Avatar
 
Join Date: Jun 2009
Posts: 143
Quote:
Originally Posted by LoRd_MuldeR View Post
Quantization in H.264/AVC is completely different from MPEG-4 ASP. Therefore H.264 quantization matrices are not even comparable to MPEG-4 ASP matrices!

And to make this clear again: For MPEG-4 ASP (Xvid/Divx) the "MPEG" and "H.263" quantization types are not different quantization matrices. They are two different types of quantization.

Only the "MPEG" type can use custom matrices (as replacement for the default one). That's not possible with the "H.263" quantization type.

However the "H.263" type is known to create a slightly "smoother" image than the "MPEG" type (with standard matrix). Generally "H.263" seems to be preferable for low bitrate encodes.
Ah I see. My friend has created a custom matrix which preserves a lot of details on lower to medium bitrates. It smooths rough edges and preserves minute details as well. I am not sure, but I think it's a combination of H.263 and MPEG matrix.

Could you tell me how to understand the structure of a matrix in the CQME? I want to use it as a visual aid to learn better .
n0an is offline   Reply With Quote
Old 10th December 2009, 11:40   #90  |  Link
LoRd_MuldeR
Software Developer
 
LoRd_MuldeR's Avatar
 
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,048
Quote:
Originally Posted by n0an View Post
...but I think it's a combination of H.263 and MPEG matrix.
Don't think that's possible. H.263 and MPEG are two different types of quantization. If you use a "custom" quantization matrix, then you definitely use the "MPEG" type, as the "H.263" type doesn't offer a way to use custom matrices. Also those quantization types cannot be "mixed", because you either use the one or the other...
__________________
There was of course no way of knowing whether you were being watched at any given moment.
How often, or on what system, the Thought Police plugged in on any individual wire was guesswork.



Last edited by LoRd_MuldeR; 10th December 2009 at 11:50.
LoRd_MuldeR is offline   Reply With Quote
Old 10th December 2009, 12:34   #91  |  Link
n0an
Britain's Finest!
 
n0an's Avatar
 
Join Date: Jun 2009
Posts: 143
Quote:
Originally Posted by LoRd_MuldeR View Post
Don't think that's possible. H.263 and MPEG are two different types of quantization. If you use a "custom" quantization matrix, then you definitely use the "MPEG" type, as the "H.263" type doesn't offer a way to use custom matrices. Also those quantization types cannot be "mixed", because you either use the one or the other...
Oh so matrices are only MPEG based. So is Sharktooth's E_3ULR_revision_2 is better than the H.263 for 1CD and the E_3UHR better than MPEG for 2CD?

I am currently encoding a 1hr 50min movie for 1CD at 780 kbps and a 2hr 50mn movie for 3CD at 1300 kbps. Would you recommend me using the default ones or Sharktooth's?
n0an is offline   Reply With Quote
Old 10th December 2009, 12:56   #92  |  Link
LoRd_MuldeR
Software Developer
 
LoRd_MuldeR's Avatar
 
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,048
Quote:
Originally Posted by n0an View Post
Oh so matrices are only MPEG based.
For the last time:The MPEG-4 ASP standard allows two types of quantization, "MPEG" and "H.263". The standard allows custom matrices for the "MPEG" type only. Heck, the "H.263" type doesn't even have an equivalent to a quantization matrix! It's simply a different way of quantization. Or in other words: You can not make the "MPEG" type work like the "H.263" type just by using a different matrix.

And a quote from earlier this thread:
Yeah, the matrix is always included in the bitstream (in the case of MPEG quantization)... H263 quantization is not actually a matrix, nor can it be directly compared or converted to one. It's just a method of quantizing that doesn't use weights (which MPEG does, and those are the quant matrix elements).

Quote:
Originally Posted by n0an View Post
So is Sharktooth's E_3ULR_revision_2 is better than the H.263 for 1CD and the E_3UHR better than MPEG for 2CD?
That's impossible to answer for each an every source. Even the other Xvid settings you use may have an effect. But if you use an average bitrate higher than 1600 kbits, it may be worth a try. After all you must decide what looks better for your eyes. So either pick the easy way and go with the default matrix or do some testing!
__________________
There was of course no way of knowing whether you were being watched at any given moment.
How often, or on what system, the Thought Police plugged in on any individual wire was guesswork.



Last edited by LoRd_MuldeR; 10th December 2009 at 22:59.
LoRd_MuldeR is offline   Reply With Quote
Old 10th December 2009, 13:26   #93  |  Link
n0an
Britain's Finest!
 
n0an's Avatar
 
Join Date: Jun 2009
Posts: 143
okay, got it. Better to read basics than annoying you :P. Thanks for the help.
n0an is offline   Reply With Quote
Old 11th December 2009, 17:36   #94  |  Link
henryho_hk
Registered User
 
Join Date: Mar 2004
Posts: 889
Try reading the sticky "XviD Preset" thread. It describes the concept of choosing a custom matrix according to the compressibility of the material. It may give you further insight.
henryho_hk is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:36.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.