digitalFAQ.com Forums [Archives]

digitalFAQ.com Forums [Archives] (http://www.digitalfaq.com/archives/)
-   Avisynth Scripting (http://www.digitalfaq.com/archives/avisynth/)
-   -   Avisynth: CQ Matic static script? (http://www.digitalfaq.com/archives/avisynth/6329-avisynth-cq-matic.html)

audioslave 10-25-2003 03:18 PM

Avisynth: CQ Matic static script?
 
I saw you posted a static script in the CQ Matic section of the forum. To not be totally off topic I decided to post my questions here instead.
The script you posted was this:
Quote:

BlindPP(cpu=4)
Convolution3D(1, 6, 12, 6, 8, 2.8, 0)
LanczosResize(...)
Undot()
TemporalSoften(2,7,7,3,2)
DCTFilter(1,1,1,1,1,1,0.5,0)
AddBorders(...)
I tried it on "The Matrix Reloaded" and got a higher CQ than with the latest Optimal Script :!: Great work, man! Are there anything more I can do with the script to gain a few CQ units? What is your oppinion on adding the MergeChroma/Luma lines? The movie is watchable with a CQ of 56,36 but it would be nice if the CQ was up in the 60's.
Can't wait for your reply! :)

P.S. I will be away for a couple of hours (cover band gig) but I will rejoin the forum after we're done. :wink:

Dialhot 10-25-2003 07:57 PM

Sorry for the delay :-)

I also had good impact on the CQ for a couple of encoding a did with this script. The only fear I have is that usually a gain in CQ is the result of a loss in details.

It seems in this case that it is not the case. So the script seems quite good. Now, if you had too much filter after that perhaps it will be "too much".

I'm pretty sure you can had a blur on the chroma, but a blur on the luma... I don't know. That have to be tested :-)

Note: you can also use BicubicResize insteed of LanczosResize. You will gain 1 or 2 point on your CQ.

audioslave 10-25-2003 08:56 PM

I'm back...
Okay, guess I will be up all night testing then :)
Yes, I really think your static script preserves the details very well! Surprisingly well, in fact. I will try encoding with both MergeChroma and MergeLuma just to see how it turns out.
While I'm at it, do you use 2000 for max. bitrate and 300 for min. bitrate with the script (480x576 resolution). And do you use CalcuMatic to get the average bitrate for CQMatic?
Sorry to bother you with all these questions, but I got VERY excited when I tried the script.

kwag 10-25-2003 09:01 PM

Hi audioslave,

I wouldn't use anything less that 2,500Kbps, if I'm not using the MA script.
With a static script, you won't gain compresion on high speed scenes, and you will have some visible macro blocks if you use a MAX of 2,000Kbps.
If you use the MA scrip, or a combination of dialhot's script with some MA lines included, then you can lower your MAX to 2,000Kbps.

-kwag

audioslave 10-25-2003 09:04 PM

Good evening kwag! Glad to see someone else but me is awake at this late hour (03:02 in Sweden). Okay, then I have to change the bitrate coz I did a test encode with 2000 MAX and I did get some blocks. Not much, but they were clearly there.

kwag 10-25-2003 09:12 PM

Try something like this:

Code:

BlindPP(cpu=4)
Convolution3D(1, 6, 12, 6, 8, 2.8, 0)
LanczosResize(...)
Undot()
SwitchThreshold = (Width<=352) ? 3 : (Width<=480) ? 2 : 1
ScriptClip("nf = YDifferenceToNext()"+chr(13)+ "nf >= SwitchThreshold ? \
unfilter( -(fmin(round(nf)*2, 100)), -(fmin(round(nf)*2, 100)) ) : \
STMedianFilter( 3, round(3/nf), 1, 1 )
DCTFilter(1,1,1,1,1,1,0.5,0)
AddBorders(...)

See what that does ;)

-kwag

audioslave 10-25-2003 09:15 PM

Great! Thanks a lot. Will try it right away. :wink:

Dialhot 10-25-2003 09:18 PM

Quote:

Originally Posted by audioslave
While I'm at it, do you use 2000 for max. bitrate and 300 for min. bitrate with the script (480x576 resolution). And do you use CalcuMatic to get the average bitrate for CQMatic?

As I told you in an other thread, I did 3 movies, but only remember two of them :

1 PAL 25fps 544*576 1h28 min=64 max=2300 CQ=79 (:!:)
1 NTSC 23.976fps 480*480 1h38 min=64 max=2200 CQ=71
(I used 3:2 pulldown while playback for this one)

For both of them I used calcumatic for finding the average setting for an audio bitrate of 128 kb/s and a target size of 807 MB.

CQmatic found the correct CQ and gave me two movie of 796 and 802 MB in near 5 hours for each movie (on a P4 1.3Ghz).

Smart, quick and perfect :-)

audioslave 10-25-2003 09:21 PM

Hmmm, "Parse error: string missing closing quotation mark (line 11, column 46)"...???

Quote:

## Test script ##

MPEG2Source("D:/Rippat/Reloaded/The Matrix Reloaded.d2v")

BlindPP(cpu=4)
ConvertToYUY2()
Convolution3D(1, 6, 12, 6, 8, 2.8, 0)
LanczosResize(448, 302, 6, 76, 708, 424)
Undot()
SwitchThreshold = (Width<=352) ? 3 : (Width<=480) ? 2 : 1
ScriptClip("nf = YDifferenceToNext()"+chr(13)+"nf >= SwitchThreshold ? \
UnFilter(-(fmin(round(nf)*2, 100)), -(fmin(round(nf)*2, 100)) ) : \
STMedianFilter(3, round(3/nf), 1, 1)
DCTFilter(1, 1, 1, 1, 1, 1, 0.5, 0)
AddBorders(16, 137, 16, 137)
ConvertToRGB24()
EDIT: @Dialhot. You didn't get any macroblocks with 2300 MAX bitrate?

Dialhot 10-25-2003 09:27 PM

Quote:

Originally Posted by kwag
Code:

ScriptClip("nf = YDifferenceToNext()"+chr(13)+ "nf >= SwitchThreshold ? \
unfilter( -(fmin(round(nf)*2, 100)), -(fmin(round(nf)*2, 100)) ) : \
STMedianFilter( 3, round(3/nf), 1, 1 )

See what that does ;)

Be careful : 3/nf with nf < 3 is something between [1,inf[. You should put a limit there !
Something like :
Code:

STMedianFilter( 3, fmin(32,round(3/nf)), 1, 1 )

kwag 10-25-2003 09:29 PM

:oops: Sorry :!:
Wrong Cut&Paste :x
Try this:

Code:

## Test script ##

MPEG2Source("D:/Rippat/Reloaded/The Matrix Reloaded.d2v")

BlindPP(cpu=4)
ConvertToYUY2()
Convolution3D(1, 6, 12, 6, 8, 2.8, 0)
LanczosResize(448, 302, 6, 76, 708, 424)
Undot()
SwitchThreshold = (Width<=352) ? 4 : (Width<=480) ? 3 : 2
ScriptClip("nf = YDifferenceToNext()"+chr(13)+ "nf >= SwitchThreshold ? \
unfilter( -(fmin(round(nf)*2, 100)), -(fmin(round(nf)*2, 100)) ) : \
TemporalSoften( fmin( round(2/nf), 6), round(1/nf) , round(3/nf) , 1, 1) ")
STMedianFilter(3, 3, 1, 1)
DCTFilter(1, 1, 1, 1, 1, 1, 0.5, 0)
AddBorders(16, 137, 16, 137)
ConvertToRGB24()

-kwag

kwag 10-25-2003 09:31 PM

Quote:

Originally Posted by Dialhot
Something like :
Code:

STMedianFilter( 3, fmin(32,round(3/nf)), 1, 1 )

Sorry again, should have read: STMedianFilter( 3, 3, 1 , 1) because it's outside the MA part :)

-kwag

Dialhot 10-25-2003 09:32 PM

Quote:

Originally Posted by audioslave
Hmmm, "Parse error: string missing closing quotation mark (line 11, column 46)"...???

Look at the optimal MA script and you will see that you missed ") on the next lineafter StMedianfilter.
Quote:

EDIT: @Dialhot. You didn't get any macroblocks with 2300 MAX bitrate?
In very rare cases. I always used 2300, never 2500. I don't really know why.

audioslave 10-25-2003 09:37 PM

So, kwag, the script should look something like this?
Quote:

nf=0

MPEG2Source("D:/Rippat/Reloaded/The Matrix Reloaded.d2v")

BlindPP(cpu=4)
ConvertToYUY2()
Convolution3D(1, 6, 12, 6, 8, 2.8, 0)
LanczosResize(448, 302, 6, 76, 708, 424)
Undot()
ConvertToYV12()
SwitchThreshold = (Width<=352) ? 4 : (Width<=480) ? 3 : 2
ScriptClip("nf = YDifferenceToNext()"+chr(13)+ "nf >= SwitchThreshold ? \
UnFilter(-(fmin(round(nf)*2, 100)), -(fmin(round(nf)*2, 100)) ) : \
TemporalSoften(fmin( round(2/nf), 6), round(1/nf), round(3/nf), 1, 1)")
STMedianFilter(3, 3, 1, 1)
AddBorders(16, 137, 16, 137)
DCTFilter(1, 1, 1, 1, 1, 1, 0.5, 0)
ConvertToRGB24()

function fmin( int f1, int f2) {
return ( f1<f2 ) ? f1 : f2
}

kwag 10-25-2003 09:40 PM

Yes. that should do it.
It's too much filtering for me :mrgreen:
But if you really want to cram the most "Bang for the buck" ( :lol: ), that should squeeze the crap out of your movie :D

-kwag

Dialhot 10-25-2003 09:47 PM

Quote:

Originally Posted by audioslave
BlindPP(cpu=4)
ConvertToYUY2() <- YOU DO NOT NEED THIS !
Convolution3D(1, 6, 12, 6, 8, 2.8, 0)
LanczosResize(448, 302, 6, 76, 708, 424)
Undot()
ConvertToYV12()<- AND THAT EITHER :-) !
SwitchThreshold = (Width<=352) ? 4 : (Width<=480) ? 3 : 2
ScriptClip("nf = YDifferenceToNext()"+chr(13)+ "nf >= SwitchThreshold ? \
UnFilter(-(fmin(round(nf)*2, 100)), -(fmin(round(nf)*2, 100)) ) : \
TemporalSoften(fmin( round(2/nf), 6), round(1/nf), round(3/nf), 1, 1)")
STMedianFilter(3, 3, 1, 1)
AddBorders(16, 137, 16, 137)
DCTFilter(1, 1, 1, 1, 1, 1, 0.5, 0)
ConvertToRGB24()

Some comments :

1/ C3D and STMedianfitler are quite the same filters. Really don't need both.
2/ try temporalcleaner insteed of temporalsoften. I find it faster and smarter. (use TemporalCleaner(round(5+nf), round(11+nf))
3/ Normally the last converttoRGB24 is useless. Try without it and let see if TMPGEnc does not complain. All is matter of codecs installed on your PC. I never use it !
4/ Your borders aren't block aligned : you aren't in the best configuration and your CQ suffer from this.
EDIT: 5/ use Bicubic precise if you want to raise a little your CQ

audioslave 10-25-2003 09:47 PM

:D It might be too much for me too. But what the hell, that's a price you'll have to pay for squeezing The Matrix Reloaded (PAL) onto 1 CD-R! :wink:

Dialhot 10-25-2003 09:58 PM

You should also try a CD90min : 100 MB more for your movie :-)

audioslave 10-25-2003 10:11 PM

Yes, that would be fantastic. But my burner doesn't support 90-99min CD-R's :cry:

audioslave 10-25-2003 10:30 PM

Dialhot wrote
Quote:

audioslave wrote:

BlindPP(cpu=4)
ConvertToYUY2() <- YOU DO NOT NEED THIS !
Convolution3D(1, 6, 12, 6, 8, 2.8, 0)
LanczosResize(448, 302, 6, 76, 708, 424)
Undot()
ConvertToYV12()<- AND THAT EITHER !
SwitchThreshold = (Width<=352) ? 4 : (Width<=480) ? 3 : 2
ScriptClip("nf = YDifferenceToNext()"+chr(13)+ "nf >= SwitchThreshold ? \
UnFilter(-(fmin(round(nf)*2, 100)), -(fmin(round(nf)*2, 100)) ) : \
TemporalSoften(fmin( round(2/nf), 6), round(1/nf), round(3/nf), 1, 1)")
STMedianFilter(3, 3, 1, 1)
AddBorders(16, 137, 16, 137)
DCTFilter(1, 1, 1, 1, 1, 1, 0.5, 0)
ConvertToRGB24()



Some comments :

1/ C3D and STMedianfitler are quite the same filters. Really don't need both.
2/ try temporalcleaner insteed of temporalsoften. I find it faster and smarter. (use TemporalCleaner(round(5+nf), round(11+nf))
3/ Normally the last converttoRGB24 is useless. Try without it and let see if TMPGEnc does not complain. All is matter of codecs installed on your PC. I never use it !
4/ Your borders aren't block aligned : you aren't in the best configuration and your CQ suffer from this.
EDIT: 5/ use Bicubic precise if you want to raise a little your CQ
If I don't use the ConvertToX() in my script I get errors. What codecs can I install so I don't have to use these lines?
What do you mean with "Your borders aren't block aligned : you aren't in the best configuration and your CQ suffer from this." How do I correct this?


All times are GMT -5. The time now is 01:42 AM  —  vBulletin © Jelsoft Enterprises Ltd

Site design, images and content © 2002-2024 The Digital FAQ, www.digitalFAQ.com
Forum Software by vBulletin · Copyright © 2024 Jelsoft Enterprises Ltd.