digitalFAQ.com Forums [Archives]

digitalFAQ.com Forums [Archives] (http://www.digitalfaq.com/archives/)
-   Avisynth Scripting (http://www.digitalfaq.com/archives/avisynth/)
-   -   Avisynth: Optimal script now fully adaptive (http://www.digitalfaq.com/archives/avisynth/4230-avisynth-optimal-script.html)

kwag 06-28-2003 10:36 PM

Quote:

Originally Posted by ovg64
Being that you use a different gop for cartoons, what kind of GOP do you use for a movie like Space Jam :twisted:

That would fall in the regular movie category. Because the toons are also computer generated :)
But if you go and encode "Felix el gato", "AstroBoy", "The Jetsons", or something like that :lol: then you REALLY need the shorter GOP :mrgreen:

-kwag

kwag 06-28-2003 10:44 PM

Here's a VERY critical sample for MPEG encoding. It's very dark, and the colors and tones are poison for MPEG encoding. Scenes like this is where the full adaptive script shines :)
http://www.kvcd.net/k-pax-full-adaptive.mpg

Note that there are almost no visible artifacts :D

-kwag

vhelp 06-28-2003 11:11 PM

@ Kwag..

Hi, I D/L'ed your sample clip.

I did that scene, and I agree w/ ya about it's scene. It's murder !!
Took me a while to get it right, but there were other darkly lite scenes
that drove me crazy (and you) !!

Hay, it's time for a fresh cup of coffee hehe..

Hay Kwag.. I can't seem to get anything better beyond the 24 for the
GOP param in the last entry part. Seems to be the sweet-spot of all :wink:
.
.
But, I think I may have the answer to the "bleeding" in my test clip of
"Ice Age".. you have to play w/ the colors unfortunately. That is what I'm
doing now, and it seems to making the issue go away slightly.

I'm wondering if an U/L is ready for all ta see, thus far..

Thanks for your help all.
-vhelp

kwag 06-28-2003 11:49 PM

Final tuneup before I commit the script :) :

Code:

ScriptClip("nf = YDifferenceToNext()"+chr(13)+ "nf > 2 ? \
unfilter( -(fmin(round((nf/0.5)), 100)), -(fmin(round((nf/0.5)), 100)) ) : \
TemporalSoften(4, round(2/nf)*2 , round(2/nf)*50 ,0,2) ")

Changed the chroma portion of the filter [ round(2/nf)*50 ] to vary 25 times more that the luma part [ round(2/nf)*2 ]. We all know how much we can blur the chroma channel, but not the luma channel ;)
Also, changed the boundary treshold from 2.5 to 2. This means that the unfilter line will kick in at a slight lower value, and again, we gain compression without any visual loss in quality.
Just finished prediction on "K-Pax", and I set the same CQ to start, as the CQ I encoded. ToK exited on the first prediction, meaning that the current CQ is still within the .5% I set for precision :)

Now, let's play a little game: Can you find the dancing DCT blocks in the black and dark areas :mrgreen: www.kvcd.net/k-pax-very-dark.mpg

Edit: Sample above done with the script changes mentioned here.
Edit #2: Also, bye bye mosquitoes. The radius of "4" ( first parameter on TemporalSmoother ), blends them really good. Can you find the flying mosquitoes :mrgreen:

-kwag

vhelp 06-29-2003 12:17 AM

@ Kwag..

I think I figure out my issue w/ YV12 (hence, color washout) !!

* When your source is a .D2V file, and you use AVIsynth in between,
...YV12 support is built-in, and filters for YV12 will work w/out issues.

* But, if you use VFAPI and make a psuedo .AVI file, then YV12 is not
...built-in, and hence, you have to use ConvertToYV12.. 8O hence
...the color washout.

Ahaaa!!

Now, I may have a work around this delima because of the way I frame
serve my source files into TMPG, for my WideScreen 16:9 projects to be
successful in quality.

-vhelp

kwag 06-29-2003 12:19 AM

Quote:

Originally Posted by vhelp

Now, I may have a work around this delima because of the way I frame
serve my source files into TMPG, for my WideScreen 16:9 projects to be
successful in quality.

The only thing you have to do is use GripFit. It will make your aspect correct every time :)

-kwag

vhelp 06-29-2003 12:33 AM

@ Kwag..

Ok, I decided to give GripFit() a try, but I keep getting an error msg
that there's "no function.."

Code:

LoadPlugin(txt_dir252+"GripFit_YV12.dll")
and I'm making the call:
Code:

ScriptClip("nf = YDifferenceToNext()"+chr(13)+ "nf > 2.5 ? \
unfilter( -(fmin(round((nf/0.5)), 100)), -(fmin(round((nf/0.5)), 100)) ) : \
TemporalSoften(4, round(2.5/nf)*3 , round(2.5/nf)*3 , 15, 2) ")

        ScriptClip("nf > scd_trigger ? asharp( -2,0) : asharp(0,0) ")
 conditionalfilter( last, asharp(-2,0), last, "nf", ">", "scd_trigger" )

 #GripBorders()
 #Limiter()

 # ConvertToYV12()

 GripFit()  ##  GripFit_YV12()

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

Over..
-vhelp

kwag 06-29-2003 12:52 AM

Your script is completely wrong 8O
Get the latest script here: http://www.kvcd.net/forum/viewtopic.php?t=3483

-kwag

vhelp 06-29-2003 12:58 AM

@ Kwag..

8O ..I know.. I knew that.., but I'm trying finish w/ my older one first,
than I was gonna try out the NEW one hehe..

Listen, I think I figured out how to use GripFit() (see above)
but it's not working. Instead, i have to use the snipplet below, and then
it works, but w/out GripFit() 8O So, i'm confused:

Code:

GripCrop( width=720, height=480, overscan=2 )
 GripSize()

But, now, what I need, is to narrow it down to the cropped areas. The
above snip seems to crop off too much of what I need.

* The right and left sides are snipped, but I want to keep them!! How do I
...preseve them ??

* And, how can I fine-tune the cropped areas to whatever pixels I need ??

Thanks for accepting my headackes hehe.. :screwy:

-vhelp

kwag 06-29-2003 01:12 AM

You got to do some reading vhelp :)
First of all, why are you encoding 720x480 :?:
You might as well encode 704x480, and save some bitrate.
The 2 blocks overscan cut off what your TV will stretch and crop out, and you wouldn't see it anyway :!:. So you encode less pixels, and the result is a higher CQ and quality.
That's why we use 2 blocks overscan on resolutions >= 528x
It you want to get your correct GripFit lines, run MovieStacker, and check "Use GripFit".
Then when you change the resolutions, etc, you'll see how the script automatically changes the corresponding Grip(X) lines.
Then you can copy & paste those lines to your optimal script in Notepad or any editor.

Try it ;)

-kwag

vhelp 06-29-2003 01:23 AM

@ Kwag..

Touchy!!

I do LOTS of reading. Anyways.. I'll continue, but to be quite honest w/
you, it's just too confusing to just crop and resize and whatnot w/ that
filter GripFit() which is a bit misleading anyways..

I think I'll play around w/ it a little while longer, and if I can't figure it out
enough, I'll have to resort to other means. I'm trying to eliminate the
vdub step if I can, but you're not making easy for me :)

In any case, those number you saw were posted too quickly. Again, I'm
testing numbers (params) and as I post, whatever happended to be in my
sample test to you were shown, which led you to believe either I didn't
read anything (not true) 8O or I'm too deep into what I'm aiming for.

Gosh.. I'm only trying to get a decent clip posted, but it's not ben easy for
me this whole afternoon and evening, and all in the name of ridding the
YV12 bug I've ben hit with lately.

But, I need to get things to work in AVIsynth the way I have them when
I use vdub. If I'm to rid vdub al-to-gether, I have to figure out HOW to
replace the same principles that I currently use in vdub, over in AVIsynth !!
And, it's not easy as I thought.

Well, I can see I'm wearing you out, so I'll stop w/ the questions and try
and figure things out on my own :)

Have a good night 8)
-vhelp

vhelp 06-29-2003 02:06 AM

Ok, hi again.. hehe..

Here's what I've come up w/ so far, and it seems to work pretty decently.

Assuming my source is DVD rip..

Code:

GripCrop(720, 480, source_anamorphic=true, overscan=0)
 GripSize()
 bicubicResize(720,272)

So, why the above, and bicubicResize "size" ???
Well, that's because after the Cropping of the areas, I have to resize a
certain amount (after the cropping) ie, if the cropping from GripCrop()
produced a final size of 260, and my encode required an x272, I would
have to resize to that x272.
So, basically, if your size is smaller than your "required" size, as in my
example above (x272) just bicubicResize(720,nnn) and feed it to
TMPG for encoding. I can't think of an easier way, to quickly CROP your
boarders.

This works for me, and I'm happy again :) :)

I'm a little confused about what source_anamorphic=true does for me.
But, since there were no documentation on GripFit() when I D/L'ed
the file, and it's other siblings, GripBoarder() and GripSize() etc., I had to
do some hunting around for sample snipplets and whatever docs I could find.

Here's a great link by sansGrip (creator of GripFit():
* GripFit - dahh !! :screwy: me..

@ Kwag..
The above works great for me.. and I'm happy now :)
Thanks for staying up late w/ me.
-vhelp

vhelp 06-29-2003 03:20 AM

@ Kwag..

I'm finally trying out your latest "snipplet" (still using my older script) but
changed to your 2nd latest:

Code:

## older version, replaced by above 06.28.03
#        ScriptClip("nf = YDifferenceToNext()"+chr(13)+ "nf > 2.5 ? \
#          unfilter( -(fmin(round((nf/0.5)), 100)), -(fmin(round((nf/0.5)), 100)) ) : \
#    TemporalSoften(4, round(2.5/nf)*3 , round(2.5/nf)*3 , 15, 2) ")

To the newer...

Code:

## newer version, as of 06.29.03 - ~1am or so ##

ScriptClip("nf = YDifferenceToNext()"+chr(13)+ "nf > 2 ? \
unfilter( -(fmin(round((nf/0.5)), 100)), -(fmin(round((nf/0.5)), 100)) ) : \
TemporalSoften(4, round(2/nf)*2 , round(2/nf)*50 ,0,2) ")

I've tried it, and so far, it's as good as the above, but maybe for computer
generated sources, it makes filesize just slitely larger ie,

* 20 second clip w/ older = 1,460kb
* 20 second clip w/ NEWER = 1,499kb

Hay Kwag..
I'm thinking about maybe U/L'ing a sample VOB of "Ice Age" for you to
play with. I feel it's not fair that you don't have something to test with.

Do you want me to try and U/L a small piece to you. If so, please tell
me how to cut a small section from a VOB, and I'll do so. I don't want
to encode and make a VOB (actually, I don't know how hehe) I want to
send an orginal. Up to you.
Sorry, it's almost 4:30am here in NY, and my eyes are falling out :confused:

-vhelp

vhelp 06-29-2003 03:37 AM

ok, update..

From your: http://www.kvcd.net/forum/viewtopic.php?t=3483 thread,
Code:

ScriptClip("nf = YDifferenceToNext()"+chr(13)+ "nf > 2 ? \
 unfilter( -(fmin(round((nf/0.5)), 100)), -(fmin(round((nf/0.5)), 100)) ) : \
 TemporalSoften(4, round(2/nf)*2 , round(2/nf)*50 ,1,2) ")

made my prevous encodes smaller again ie,
* 20 second clip w/ older = 1,460kb
* 20 second clip w/ NEWER(link above) = 1,467kb - - better :)

I think that this one (snipplet above) was better in the details, and a bit
more smoother quality. But, then again, it's late (4:37am) and my eyes
are pretty shot. Sorry. But, it looks great to me so far.

Thanks, and keep up the great work.
-vhelp

vhelp 06-29-2003 03:50 AM

@ Kwag..

After all the headackes, and 40+ test encodes later, I'm finally getting their.

made my prevous encodes smaller again ie,
* 20 second clip w/ older = 1,460kb
* 20 second clip w/ NEWER(link above) minue asharp(2,4) = 1,444kb - - better

Since my source seems to be sharp enough, I felt that it didn't need the
added sharpness filter above.

Now, it's really late, and I have ta get ta bed. (4:47am)

Thanks again.
-vhelp

J-Wo 06-29-2003 10:10 AM

Quote:

Originally Posted by kwag
Final tuneup before I commit the script :)

I'm encoding disc 3 now of Dune and the 90 min movie is again taking only 2 hr to encode! I find it unlikely that disc 2 would take significantly longer to encode than the other discs so it looks like the latest change has gone back to the old speed of MA encoding but with full linearity! Of course I haven't been able to SEE any visible difference between all your changes cause frankly, each of my encodes looks amazing on my tv. Well done Kwag! :D

ovg64 06-29-2003 10:29 AM

Quote:

Originally Posted by J-Wo
Quote:

Originally Posted by kwag
Final tuneup before I commit the script :)

I'm encoding disc 3 now of Dune and the 90 min movie is again taking only 2 hr to encode! I find it unlikely that disc 2 would take significantly longer to encode than the other discs so it looks like the latest change has gone back to the old speed of MA encoding but with full linearity! Of course I haven't been able to SEE any visible difference between all your changes cause frankly, each of my encodes looks amazing on my tv. Well done Kwag! :D

Hey Jwo, i think it has more to do with the Res. n the type of movie you are encoding more so than the adaptive script, but i guess when you r overclocking a Barton 2500+ on an abit board ( that sims like the combo this days) you dont want to go back to the 6 hrs encodes that u had in the past. :wink:

andybno1 06-29-2003 12:59 PM

I'm not sure if this is a good this or bad thing, but with this new snippet it only took tok one attempt to predict a CQ value of 70.

Log File:
Code:

=============================================================
ToK Log: C:\DVD Movie\8 Mile.avs
=============================================================
 
Resolution (fps):352x576 (25.000 fps)
Total Frames: 158888
Total Time  : 01:45:56
-------------------------------------------------------------
 
Audio Size: 101,696,000
Required Video Size: 710,328,960
 
Factor: 60.000
Desired Sample Size: 11,838,816
 
-------------------------------------------------------------
New Faster Prediction
-------------------------------------------------------------
 
Full Sample
Next CQ: 70.000. Sample Size: 11,809,622

Exit Condition: 0.500 % reached ! yahoo !

Final CQ: 70.000
Total Time For Predicition: 00:11:28

Total Time (all operations): 00:11:28
 
Finished


jorel 06-29-2003 04:56 PM

andybno1,

i think that CQ70 is perfect for your movie cos ToK
found 11,809,622 for desired sample size: 11,838,816 .
less then 0.500 % !
seems ok.

:idea:
do the prediction again,if you got the same result... :wink:

jorel 06-29-2003 06:19 PM

8O

please,someone answer me:

did you see the image(colors) "breathing" in each second
after the changes to "adaptive in the TemporalSmoother filter" :?:

the colors seems that encrease and decrease each second...
like beating!
:?


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

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