Quantcast KDVD: Script for Minimal Blur on Action Scenes? - digitalFAQ.com Forums [Archives]
  #1  
01-03-2004, 06:33 AM
Jellygoose Jellygoose is offline
Free Member
 
Join Date: Jun 2002
Location: Germany
Posts: 1,288
Thanks: 0
Thanked 0 Times in 0 Posts
hi everybody...

can someone post a script which only blurs minimally on sudden high action scenes? this is for KDVD target, but it seems the bitrate can't go up that high, so that there are some small blocks whenever there's a sudden high action scene... My Max. Bitrate is already set to 6000kb/sec, but it doesn't help, as it only goes up to 4800kb/sec at the peaks... can't encode with a higher CQ though...
__________________
j3llyG0053
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
  #2  
01-03-2004, 08:30 AM
rds_correia rds_correia is offline
Free Member
 
Join Date: Apr 2003
Location: Chinese Democracy starts now!
Posts: 2,563
Thanks: 1
Thanked 0 Times in 0 Posts
Hmm,
Could you post your script J3lly? Because I had the same problem and then I saw I wasn't resizing at all.
Could you be doing the same? Are you using the MA at all or some static script?
Right now I am encoding anamorphic KDVDs with MA script and have CQ near 70 with no small/big blocks
with min=800 & max=3000 for 166888 frames to fit in half a DVD with AC3 audio @ 384Kbits
__________________
Rui
Reply With Quote
  #3  
01-03-2004, 08:51 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
Hi Jell!
I did a MA-soften-only modification some time ago.

So safe this Code below as .avsi File in your Avisynth Plugins Folder.
It will be usable like a Filter.
Code:
function MaJustSoft(clip c) {
c=ScriptClip(c, "nf = YDifferenceToNext()"+chr(13)+"unfilter( -(fmin(round(nf)*2, 100)), -(fmin(round(nf)*2, 100)))  ") 
return c
} 
function fmin( int f1, int f2) { 
  return ( f1<f2 ) ? f1 : f2 
}
Usage: put the command MaJustSoft() at any place you like in your self generated script. And as the new MA now blurs linear through the whole nf value range - Do not apply any blur filters in front or afterwards!

Also a very good blur-punch at highest action scenes is using the QMF routine with HighMotion treatment ONLY, also by doing this the HighMotion threshold must be set very high where a higher blurring starts.
There won't be any oscillating seen cause at scenes containing such high motion you won't recognise it. And on the other hand no blurring on static or low motion scenes = preserving full quality in case of DVD-R backup. I did it a lot and it resulted very very good, and there was no viewable oscillating on high action scene jumps recognisable.
Reply With Quote
  #4  
01-03-2004, 09:04 AM
rds_correia rds_correia is offline
Free Member
 
Join Date: Apr 2003
Location: Chinese Democracy starts now!
Posts: 2,563
Thanks: 1
Thanked 0 Times in 0 Posts

These guys functions are great!!
Thnx Incredible. I can't wait to try it on my KDVDs
__________________
Rui
Reply With Quote
  #5  
01-03-2004, 12:07 PM
digitall.doc digitall.doc is offline
Free Member
 
Join Date: Jul 2003
Location: Valencia (España)
Posts: 741
Thanks: 0
Thanked 0 Times in 0 Posts
Hi all:
if you just want to blur in sudden action scenes, you could use the approach we used in previous MA script
Code:
ScriptClip("nf = YDifferenceToNext()"+chr(13)+ "nf >= 2 ? \ 
unfilter( -(fmin(round(nf)*2, 100)), -(fmin(round(nf)*2, 100)) )")
You should change the number "2" after "nf >=" maybe to 10 or 12 (or greater) to just unfilter in really high action scenes (nf takes the value of the difference between frames: the greater nf is, the more action is there in the film). If blurring is not enough, you could change the "round(nf)*2" value to "round(nf)*4".
But it has been explained in the forums, this approach is less optimal because filter switches on and off during the film, and you can see its effects. But as you just want to blur in high action, maybe it won't be noticeable the switching on and off. Give it a try.
Reply With Quote
  #6  
01-03-2004, 12:23 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
exact, thats what I meant, you can give also a *10 with a VERY high nf threshold is set. The problem in regular is an "oscillating" behaviour when the motion gives NF values orund the threshold value.
And thats why you only should use it at very high thresholds where already the optical impression is such chaotic by the fast movement that even there you wont recognise that oscillating effect.

But everything based on that this modify is only to avoid blocks on very high action scenes as Jellygoose asked ... the original purpose of MA to give more compression in average of the whole movie is done.
Reply With Quote
  #7  
01-04-2004, 06:43 AM
Jellygoose Jellygoose is offline
Free Member
 
Join Date: Jun 2002
Location: Germany
Posts: 1,288
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks a lot all of you, you're a great help, and I'm testing right now... Also how would I implement Blockbuster filter into an MA routine, so that noise is NOT added at high action scenes, although there might be low-detail areas... (I want to try this to save some bitrate at these scenes because I think you won't notice DCT-blocks when it comes to high action...)

@incredible: Will try your routine later today... I see you're using unfilter, so wouldn't the name JustBlur fit better? Also the QMF part you talked about sounded very good... From what I know QMF is just a Motion Detection Filter, where you can specify other filters to punch in at different levels of motion right? So would you use it on very high motion only with Unfilter as blurring filter? Do you still have the line you used to take as a starting point for me?

Thanks again all of you for your interest!
__________________
j3llyG0053
Reply With Quote
  #8  
01-04-2004, 08:32 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
@ Digital.Doc
I know your intention but watch out:
Quote:
Code:
ScriptClip("nf = YDifferenceToNext()"+chr(13)+ "nf >= 2 ? \ 
unfilter( -(fmin(round(nf)*2, 100)), -(fmin(round(nf)*2, 100)) )")
As you're still thresholding you're performing an "if" routine in there by putting a "?" that means AVS will search for an ":" (= else) alternative command so at least you can put as "else" routine just an unfilter() which is always a good choice.

@ Jell

I called this one MAJustSoft() because it bases on Kwags MA and also the unfiltering process is STILL Motion adaptive because of this essential command: YDifferenceToNext()

According to QMF .... in your case Digital.Doc is defenitely right. Yust perform the old MA incl. adding a ": Undot()" behind the Unfilter Commands instead of TempSoften and set a high threshold like 20 (Im not shure now so you should test) and give the multiplicator a value that high as its needed to avoid your highBitrate Blocks - so test it
Reply With Quote
  #9  
01-04-2004, 08:50 AM
Jellygoose Jellygoose is offline
Free Member
 
Join Date: Jun 2002
Location: Germany
Posts: 1,288
Thanks: 0
Thanked 0 Times in 0 Posts
How about the routine to switch off Blockbuster when there's high action?

Any idea on that?

Edit: Ok, I tried your suggestion incredible, and it worked, with undot() as alternate filter. So if Undot() is always punched in, when there's no high action scene, that's what I want Blockbuster to do! So I tried to substitute Blockbuster for Undot(), and it works with no arguments, but whenever I add arguments to it, I get an AVS error. Where did I forget a bracket? Here's the line...

Code:
ScriptClip("nf = YDifferenceToNext()"+chr(13)+ "nf >= 2 ? \ 
unfilter( -(fmin(round(nf)*2, 100)), -(fmin(round(nf)*2, 100)) ): \ 
Blockbuster( method=noise , detail_min=2 , detail_max=5 , variance=0.8 , seed=5623 ) ")
__________________
j3llyG0053
Reply With Quote
  #10  
01-04-2004, 09:31 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
@ Jell

I gotta add something very important:
I wouldn't go over *4 in case of the multiplicator, beacuse we know that problem of MA on static scenes in foreground and fast moving action in background. So in a fast action scene where is also a static foreground object this static object would be totally blurred! So do use this with caution! And do tests on the movie you want to encode.

According to Blockbuster, you can do that MA routine modification by yourself, so that blockbuster will be performed on lowmotion scenes instead of TempSoften and on high motion scenes does unfilter perform.

But I think that isn't senseful ... and not testet yet.

EDIT: I see now you already did it. So just try and do a testencoding served via AVS incl. Trims to high action and static scenes.

EDIT2: Wrong thinking! You should leave blockbuster non!!-motion adaptive and in Front of MAJustSoft() ... so blockbuster will be active and on high complex fast scenes it will be overrided by the blur of the high action treatment of MAJustSoft() .
And as you do encode in HQ to DVD-R you should at least rise the Threshold to high action NFs, cause lower Thresh will do modify too much your HQ Backup.
Reply With Quote
  #11  
01-04-2004, 09:50 AM
Jellygoose Jellygoose is offline
Free Member
 
Join Date: Jun 2002
Location: Germany
Posts: 1,288
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks I'll try that... With multiplicator you mean the value set to 2 in your MAJustSoft() right?

For nf, what is the standard value?
How do I change the values of nf in your .avsi? Where has nf to be specified with a value? In my AVS or in the AVSI?
__________________
j3llyG0053
Reply With Quote
  #12  
01-04-2004, 10:13 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
Usage:

#######################
Mpeg2source("................")
Bicubicresize(.................)
thresh=20 # Find out which thresh is optimal for your High Action Scenes
ml=4 # Here's the multiplicator Setting by how much the stream will be blurred if nf is over threshold
MAJustSoft()
Addborders(.........)
#######################

The .avsi script INCUDING here the threshold.
Code:
function MAJustSoft(clip c) {
c=ScriptClip(c, "nf = YDifferenceToNext()"+chr(13)+"nf >= thresh ? unfilter( -(fmin(round(nf)*ml, 100)), -(fmin(round(nf)*ml, 100))) : Undot()  ")  

return c
} 
function fmin( int f1, int f2) { 
  return ( f1<f2 ) ? f1 : f2 
}
Reply With Quote
  #13  
01-04-2004, 05:42 PM
digitall.doc digitall.doc is offline
Free Member
 
Join Date: Jul 2003
Location: Valencia (España)
Posts: 741
Thanks: 0
Thanked 0 Times in 0 Posts
Hi folks:
sorry, I was "out" some days, but I see that things keep on working well .
Incredible, you're right, I forgot the ending of the MotionAdaptive blurring. To avoid the problem of swiching on and off filters, I would use this code:
Code:
function MAJustSoft(clip c) { 
c=ScriptClip(c, "nf = YDifferenceToNext()"+chr(13)+"nf >= thresh ? unfilter( -(fmin(round(nf)*ml, 100)), -(fmin(round(nf)*ml, 100))) : unfilter(0,0)  ")  

return c 
} 
function fmin( int f1, int f2) { 
  return ( f1<f2 ) ? f1 : f2 
}
Unfilter(0,0) does... nothing, but you still have the filter switched on. I don't know a word on filtering, but I read this ideas in this forum earlier, and tested them, and worked well for me.
As I told you, you have to find the threshold level to switch on the blurring, and the strength of the blurring (ml and thresh parameters), that work for your film.
Jellygoose, nf takes its value from the YDifferenceToNext() function, you don't have to give it a value.
Tell us how it works in your DVD.
Reply With Quote
Reply




Similar Threads
Thread Thread Starter Forum Replies Last Post
Avisynth: blocks in fast action scenes? vdk_au Avisynth Scripting 6 02-04-2004 05:41 AM
Avisynth: More Blur On Action Scenes! Jellygoose Avisynth Scripting 3 10-25-2003 12:08 PM
KVCD for VERY high action scenes? PyRoMaNiA Video Encoding and Conversion 1 03-28-2003 11:56 AM
KVCD: Can i improve action scenes? emale00 Video Encoding and Conversion 4 08-05-2002 10:43 AM
getting a blocky video during high action scenes? eladbern Video Encoding and Conversion 1 06-16-2002 10:05 PM

Thread Tools



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