Quantcast Mencoder: Move the Noise Parameter to the Beginning of Your Script! - Page 2 - digitalFAQ.com Forums [Archives]
Go Back    digitalFAQ.com Forums [Archives] > Video Production Forums > Video Encoding and Conversion

Reply
 
LinkBack Thread Tools
  #21  
06-02-2004, 07:21 AM
incredible incredible is offline
Free Member
 
Join Date: May 2003
Location: Germany
Posts: 3,189
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to incredible
Quote:
Originally Posted by Dialhot
Quote:
Originally Posted by incredible
For shure in the case of first scaling and then cropping a different scaling value! is applied!
I was figuring that while I was taking my lunch. I found this idea too crazy to be true but I see you are crazy enought
By "crazy" I mean that you should have screwed up your brain to find the correct formula to apply while the other way was straight to the solution, but I agree with you, the result is the same .
Its not that crazy at all! Its the simple way it would be done also by the TV!

A 720x576 gots an active pixelarea of 702x576 at PAR 128/117(=1,094)
(I do round these 702 to mod8 704!)

720x576 resized correct to PAR 1:1 square pixels TV state will become:
788x576! And as PAL only gots 768x576 the rest will "be out of bounds", means: Cropped.

Quote:
Quote:
The Problem Kwag explained IS DUE that a 2.35:1 source still comes with black bars and these also WOULDNT be respected by FitCD or MS If you WOULDNT enter the active picture area.
That's what I said : it seems I'm the only one that used this area

Since a long time I'm saying that 1.85 DVD have a 16 pixels border and 2.35 a 72 pixels border that must be cropped before any filtering is applied (except for PP or blindPP of course). That's what I do any time and I just figured that any others 'guru' here did the same. I was may be wrong...
Well in Packshot the first of all placed filters (if choosen) is pp .. then a deinterlacer (if choosen) followed by the scaler etc. So that will not be a "big" problem.
And thats why I told that my next toDo will be 2 option checkboxes (2.35:1 and 1.85:1) for the resizing routine.

Quote:
Quote:
... as Mencalc uses in its routines a scaling of mod8 a minimal error could result (In the case above 0.5% maybe, wow .... but show me a resizing in MS/FitCD where you end up in Error=0%! )
720*576 to 704*576 is 0% (just a crop is done in this case)
720*576 to 352*288 is also 0%.

Those are two example . Okay, these are trivials but you just asked for an example :-p
[/quote]

And I give you the answer that a simple resize from 720 width to 352 width (without cropping by 8 before) is wrong and will be endup in a wrong AR! Thats a fact.
As 352 width is PAR 128/117 so it bases on an original "cropped to" 704 width ( PAR 128/117 ) ... so you defenitely have only two choices:

a) The MS/FitCD way:
Crop 720 to 704 and scale down to 352

b) Mencalc
Scale 720 to 360 and Crop to 352

same result, same time, same quality

And as you had a nice lunch Ill give you a nice aperitif:

http://www.uwasa.fi/~f76998/video/co...nversion_table



PS:
Quote:
Originally Posted by Phil
That's all the mistake causing my "strong" speech and your "self-defense" response.
No "strong spech" or "self-defense"

"strong spech" and therfore a resulting "argumentation" as I dont need to defend myself but the little rules as shown in the link above

The relaxing thing is that we both know each other a bit "behind the wall"
Reply With Quote
Someday, 12:01 PM
admin's Avatar
Site Staff / Ad Manager
 
Join Date: Dec 2002
Posts: 42
Thanks: ∞
Thanked 42 Times in 42 Posts
  #22  
06-02-2004, 08:11 AM
maurus maurus is offline
Free Member
 
Join Date: Oct 2003
Location: Madrid
Posts: 387
Thanks: 0
Thanked 0 Times in 0 Posts
I use the Incredible's MenCalc scale, crop and expand values in the script of my KSVCD Express method.

Code:
:: ------ Aspect Ratio y Overscan -------
:: 16:9 or 4:3 Overscan=2
Set vfNormal=yuvcsp,scale=480:576::0:9,crop=448:544:16:16,
unsharp=l3x3:0.6,hqdn3d=3:6:2,unsharp=l3x3:-0.7:
c3x3:-1.5,noise=3th,expand=480:576:16:16
:: Source 16:9 to 4:3 LetterBoxed Overscan=2
Set vfLetterBoxed=yuvcsp,scale=480:432::0:9,crop=448:432:16:0,
unsharp=l3x3:0.6,hqdn3d=3:6:2,unsharp=l3x3:-0.7:
c3x3:-1.5,noise=3th,expand=480:576:16:72
:: File generic mencoder settings
Set fileConf=DVD_KSVCD_PAL.conf

IF '%aspectRatio%'=='4:3' (
	Set aspect=1.3333
) ELSE (
	Set aspect=1.7777
	)
IF '%aspectRatio%'=='4:3LB' (
	Set vf=%vfLetterBoxed%
) ELSE (
	Set vf=%vfNormal%
	)
:: -------------------------------------- 

:: --- Encode video (2 Pass VBR)  --- 
Mencoder.exe -include %fileConf% -vf %vf% 
-lavcopts aspect=%aspect%:vbitrate=%avgBitrate%:vpass=1 "
%directorio%\%pelicula%.vob" -o "%directorio%\%pelicula%.m2v"
I use also the Kwag advice for the noise=3th before the expand and use also hqdn3d=3:6:2, as you can see in the previous code:


And I obtain allways good aspect ratio and good quality. I hope to be using the correct values...

What is yours opinions?

Thanks.


-Maurus
Reply With Quote
  #23  
06-02-2004, 08:24 AM
Dialhot Dialhot is offline
Free Member
 
Join Date: May 2003
Posts: 10,463
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by maurus
What is yours opinions?
In both crop and expand if you don't want to bother yourself to calcute the coordinates of the upper left corner, you can just use in any case -1:-1 (insteed od 16:16 in your example).

That's always 4 values you won't have to change everytime
Reply With Quote
  #24  
06-02-2004, 08:54 AM
incredible incredible is offline
Free Member
 
Join Date: May 2003
Location: Germany
Posts: 3,189
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to incredible
Yep, right .....

these calculated values are still results from the time when I did force vertical Macroblock alignment, but in a case of overscan=1 and 352x288/240 this would cause an ugly big border below at 16px height.
So now they will be alignet vertically centered and that also be don by "-1" values in crop and expand as mentioned by Phil.
Reply With Quote
  #25  
06-02-2004, 09:01 AM
maurus maurus is offline
Free Member
 
Join Date: Oct 2003
Location: Madrid
Posts: 387
Thanks: 0
Thanked 0 Times in 0 Posts
I use only KSVCD PAL at 480x576 and my overscan factor is 2 (16 pixels), not 1.

This values are obtained in MenCalc. Are they correct?
If no, what are the good values for my PAL KSVCD overscan=2? Not is correct still Mencalc?

The correct values are the sames that I am using, but -1:-1 in the center values instead of 16:16?

How about of position of noise filter?

-Maurus
Reply With Quote
  #26  
06-02-2004, 09:10 AM
Dialhot Dialhot is offline
Free Member
 
Join Date: May 2003
Posts: 10,463
Thanks: 0
Thanked 0 Times in 0 Posts
All filters seem to be in good place IMHO.
Reply With Quote
  #27  
06-02-2004, 09:12 AM
incredible incredible is offline
Free Member
 
Join Date: May 2003
Location: Germany
Posts: 3,189
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to incredible
If you cose an overscan of 2 wich is 16 than everytime its vertical & horizontal macroblock aligned cause of 16 pix borders added to each side and thats macroblock based.

Your Syntax would be:

Code:
scale=480:576::0:9,crop=448:544:-1:-1,expand=480:576:-1:-1
Reply With Quote
  #28  
06-02-2004, 09:27 AM
maurus maurus is offline
Free Member
 
Join Date: Oct 2003
Location: Madrid
Posts: 387
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by incredible
If you cose an overscan of 2 wich is 16 than everytime its vertical & horizontal macroblock aligned cause of 16 pix borders added to each side and thats macroblock based.

Your Syntax would be:

Code:
scale=480:576::0:9,crop=448:544:-1:-1,expand=480:576:-1:-1
Yes, I have this, but with 16:16 as it is in MEncalc. But with 16:16 I'm not see something wrong... The aspect ratio is correct and the overscan seems correct in my tv.

And for 4:3 LetterBoxed, I have this settings:

Code:
scale=480:432::0:9,crop=448:432:16:0,expand=480:576:16:72
It's correct?. What are the correct settings here?

Thanks for all.

-Maurus
Reply With Quote
  #29  
06-02-2004, 10:02 AM
incredible incredible is offline
Free Member
 
Join Date: May 2003
Location: Germany
Posts: 3,189
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to incredible
Why they shouldnt be correct?
Thats what I thought that THIS thread could cause confusing.
In generall they are totally correct.
And according to black borders they are totally correct for a 1.778:1 Source ... as we deal with overlayed overscan, so only overscan at the sides will be applied as in case of letterboxing already black bars are present on top/bottom.

And the correct replacings to "-1" you can see on the example above.

where at crop/expand the x and the y (from XXX,YYY,x,y) at "-1" do just say "centered".

But I dont know the BIG DEAL about these -1,-1 as you already use MenCalc (copy&paste) and the x,y Settings are correct values, so the effective result will be the same.
Reply With Quote
  #30  
06-02-2004, 11:11 AM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Ok, I'm here, but a little late
I guess I missed all the fun
I think Phil was indeed a little tired to understand that I was doing 2 overscan blocks
Anyway, as already has been verified, this last crop (or we can call it a final black "MASK"), will indeed kill any noise or filtering that is out of bounds.
I can't see any speed difference, by adding or removing the "crop" before the final expand.
But even with a noise=3th, which is just a very small value, the sample file size (video stream) was a tad smaller with the final crop.
5,038KB with final crop, 5,042KB without.

-kwag
Reply With Quote
  #31  
06-02-2004, 11:28 AM
Dialhot Dialhot is offline
Free Member
 
Join Date: May 2003
Posts: 10,463
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by kwag
I think Phil was indeed a little tired to understand that I was doing 2 overscan blocks
I'm sorry kwag but no matter what overscan you are doing or not : to not remove the complete black border existing in the source, putting noise into it and finally cut it out with a crop command is nothing but stupid. No offense !

Inc explained that is just a feature not yet implemented but you seems to say that for you this is a normal situation and I can't agree

Note: You are answering to Inc about speed but for sure the speed will be better if you cut out everything since the begining (as the working area for the filters will be smaller). Even if the speed gain won't be really big actually.
Reply With Quote
  #32  
06-02-2004, 12:00 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by Dialhot
I'm sorry kwag but no matter what overscan you are doing or not : to not remove the complete black border existing in the source, putting noise into it and finally cut it out with a crop command is nothing but stupid. No offense !
This is NOTHING related to overscan
Please ignore the values I used, and try to focus on the problem.
The problem is that if you don't do the final crop, you have stray noise OUTSIDE the film pixels area. That's a fact
I don't think that's too hard to understand, as you can clearly see it on the last screenshots I posted
If you don't add the final crop, you will have noise outside the true film pixel area, causing a loss of final quality, because of additional noise being encoded outside the real movie area.
Quote:

Inc explained that is just a feature not yet implemented but you seems to say that for you this is a normal situation and I can't agree
I think a screenshot is worth a thousand words, and that's why I posted them.
I also re-created the problem, by encoding with and without the final crop, and verifying that indeed, it's superior quality with the final crop, and the final aspect ratio is also identical.
What's wrong with that
Quote:

Note: You are answering to Inc about speed but for sure the speed will be better if you cut out everything since the begining (as the working area for the filters will be smaller). Even if the speed gain won't be really big actually.
At least for my last two test encodes, there was ZERO difference in speed with or without the final "crop".

-kwag
Reply With Quote
  #33  
06-02-2004, 12:16 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by incredible
... and IF that second crop doesnt reduce encoding speed ...
It doesn't
Quote:
than this way isnt that "elegant" BUT the quality will be EXACT the same.
Elegance is for "taylors". I want results, no matter it they are spartan
And the results are perfect

-kwag
Reply With Quote
  #34  
06-02-2004, 12:22 PM
incredible incredible is offline
Free Member
 
Join Date: May 2003
Location: Germany
Posts: 3,189
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to incredible
I think Phil doesnt still meant the "overscan" situation, ...
He told that it would be more senseful if FIRST a cropping would delete all unneeded black parts OR not wanted picture area and then via scale and expand the process as a whole seems more elegant/logic.

Well .. in relation to "cosmetic" I do agree that a second crop is not elegant, BUT till a new resizing routine is written for Mencalc and as Kwag proofed that NO speed or Quality loss is the result, ... I think the solution is ok (for now, ... so I still see your point Phil! ).

I do think there are much more other problems on mencoder so that THIS issue related to 2 times cropping is one of the tyniest problems.

According to speed .... well Even if that 2nd cropping will cause 1/2 fps loss in speed .... I think there are so many users which dont use a CPU optimized build ... and that REALLY causes speed loss.

I really see your Point Phil and its an issue we have to work on (and for shure me on Mencalc) .... but for now ... lets see the thing as a whole and therefore its speed/quality.
Reply With Quote
  #35  
06-02-2004, 12:27 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
So does this mean that we all have to watch a "noisy" black border area
Because I can clearly see it in my TVs
I rather loose 1/2 FPS, and watch a clear picture without any noise outside the film area, than having very dim black bars shown.
Is it only me that can see this effect
Because it IS clearly visible, specially on a 60" TV set

-kwag
Reply With Quote
  #36  
06-02-2004, 12:31 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Correction, speed IS FASTER with the final "crop"
Seems that the extra noise on the complete screen does slow down the process, so adding the last crop to mask around the FILM area, does speed up the encoding, at least by 1 to 2 FPS.
Try it

-kwag
Reply With Quote
  #37  
06-02-2004, 12:34 PM
incredible incredible is offline
Free Member
 
Join Date: May 2003
Location: Germany
Posts: 3,189
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to incredible
Another very sensible point in case of MencodeME/Packshot/ManualCommandline - Mencoder usage.

In here many users want "more than fast" the 100% of the potential of that encoder "mencoder".

Lets see it like that .... CCE (and also its fast speed) is EVERYtime used via Avisynth .... and for SHURE avisynth even lets CCE going down to its knees if heavy routines are used. CCE doesnt got an internal resizer so Avisynth is more than needed.

Conclusion ... even if a second crop is used .... the capability of internal resizing of mencoder makes it avs independand and thats causes speed advantage!

So I dont see in here the situation why something should be "stupid" we're doing here .... all our techniques are approaches.

Show me another place where that "mencoder" subject is treaten that intensive as in here

No matter if some apps are build by me or VM .... seen as a "whole" we in here do made many experiences, build apps ... and so on.

And if I do see the situation ACTUALLY .... Im very happy with the things we "all" already made now and how the things do work. The rest is a matter of time

This post was not adressed to someone, its something general do I think.

Reply With Quote
  #38  
06-02-2004, 12:39 PM
incredible incredible is offline
Free Member
 
Join Date: May 2003
Location: Germany
Posts: 3,189
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to incredible
Quote:
Originally Posted by kwag
So does this mean that we all have to watch a "noisy" black border area
Nope that means that I can live for now with that 2nd crop solution as it doesnt hurt
But I also do see that it "could" be more elegant to find a resizing solution where the picture will be pre-processed more elegant, so the noise also in such a case would be added optimal (like now). But ... I do now have other things in "ToDo" wich are more importend to solve than cosmetics related to a commandline which wouldnt give a final difference ot adressed to someone! but said as my point of view.
BUT ... as it works and we do not suffer from speed loss or quality (the last one for shure) ... its ok.

Thats what I meant: As both ways give correct outputs ... for now we can "live" with that
Reply With Quote
  #39  
06-02-2004, 12:52 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by incredible
But ... I do now have other things in "ToDo" wich are more importend to solve than cosmetics related to a commandline which wouldnt give a final difference
But there IS a final quality difference
I just verified that with the last crop, the final size in a 1-pass is smaller, meaning that on a full 2-pass encode, there are more bits available to the film area, that are not being wasted on the black bars
Quote:
ot adressed to someone! but said as my point of view.
BUT ... as it works and we do not suffer from speed loss or quality (the last one for shure) ... its ok.
As I just said, there's actually a speed increase.

Do you remember the issue that SansGrip recommended using LegalClip() before and after the filters
Well, this is exactly the same, as the first crop takes care of the initial cropping, and the last crop removes anything that is outside the film area. Just as LegalClip() removed any levels faults that any filter could have introduced.
I see it as a "PRE" and a "POST condition, which indeed is a VERY "elegant" programming practice (At least on Eiffel language. Called "Programming by contract" )

-kwag
Reply With Quote
  #40  
06-02-2004, 01:04 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by incredible
Show me another place where that "mencoder" subject is treaten that intensive as in here
Only the Mplayer developers in their mailing lists

-kwag
Reply With Quote
Reply




Similar Threads
Thread Thread Starter Forum Replies Last Post
Avisynth: Anti-Noise Script? Shibblet Avisynth Scripting 2 12-19-2004 06:46 PM
Mencoder: Pseudo MIN bitrate with noise? kwag Video Encoding and Conversion 40 05-15-2004 09:54 AM
Mencoder: Optimal Script with mencoder filters vmesquita Video Encoding and Conversion 38 04-14-2004 09:55 AM
Avisynth: Additional Noise Reduction for Optimal Script Jellygoose Avisynth Scripting 4 10-21-2003 06:43 PM
Avisynth: noise reduction, lot of mosquito noise? yauman Avisynth Scripting 8 02-02-2003 02:41 PM




 
All times are GMT -5. The time now is 07:47 PM  —  vBulletin © Jelsoft Enterprises Ltd