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 > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 23rd July 2005, 23:39   #41  |  Link
MOmonster
Registered User
 
Join Date: May 2005
Location: Germany
Posts: 495
@yaz
I had some time to work on my functions the last night. My next just better Cdeint version I´ll offer next week. But I also created the function for your use.
So here is my motion_interpolate_deblend function:
Code:
crop(8,8,-8,-8)

ord = last.getparity() ? 1 : 0

a = tdeint(mode=1)

c = leakkernelbob(order=ord).BilinearResize(480,288)	

motion_interpolate_deblend(a, tclip=c, thresh=45)



Function motion_interpolate_deblend(clip input, clip "tclip", float "thresh") 
{
###### PREPARATION ######
e = input.selecteven()
o = input.selectodd()
tempe1 = e.MVAnalyse(isb=true, sx=4,sy=4, lambda=4000)
tempe2 = e.MVAnalyse(isb=false, sx=4,sy=4, lambda=4000)
eout = MVInterpolate(e, tempe1, tempe2, nb=1, bl=0.5, el=0.5, fbw=4).trim(1,0)
tempo1 = o.MVAnalyse(isb=true, sx=4,sy=4, lambda=4000)
tempo2 = o.MVAnalyse(isb=false, sx=4,sy=4, lambda=4000)
oout = MVInterpolate(o, tempo1, tempo2, nb=1, bl=0.5, el=0.5, fbw=4)

global intout = interleave(oout,eout)
global diffval = default(thresh,50.0)/100.0 + 1.0
global output = input
global blendclip = tclip

###### FRAMES FOR BLENDPARAMETERS ######
global frame_c0 = blendclip
global frame_c1 = blendclip.trim(1,0)
global frame_c2 = blendclip.trim(2,0)

###### VAR.. ######
global diff_c2 = 1
global btest1 = 1
global btest0 = 1

###### Conditional Function Chain, evaluated from bottom to top (!) ######
b99=scriptclip(input, "(btest0 / btestb + btest0 / btest1) < diffval ? intout : output")

b4=FrameEvaluate(b99, "global btest1 = LumaDifference(MergeLuma(frame_c0,frame_c2,blendl), frame_c1) / 
		\	(diff_c1 < diff_c2 ? diff_c1 : diff_c2)")
b3=FrameEvaluate(b4, "global blendl = diff_c1 < diff_c2 ? 0.5 * Exp(0.85 * Log(diff_c1 / diff_c2)) :
				\	1 - 0.5 * Exp(0.85 * Log(diff_c2 / diff_c1))
		global btest0 = btest1")
b2=FrameEvaluate(b3, "global diff_c2 =  YDifferenceToNext(frame_c1)
		global btestb = btest0")      
b1=FrameEvaluate(b2, "global diff_c1 = diff_c2")
return(b1) 
}
It use the newer simpler and better Cdeblend, but it doesn´t double the frames, it interpolates the motion.
I don´t like the results of mvinterpolate too much, just to blocky for my eyes. But of course better than your strange blends.
Higher thresh values mean detecting more blends (everything higher than 75 is too heavy I think).
Just try it out. I don´t tested it till now together with Cdeint, but you can try if they run together. Alone it just runs stable for me.
I hope this help you a little bit.

ps: I don´t know much about the mvtools parameter. If you want to tweak them, therefore you should ask anybody else.

Last edited by MOmonster; 26th July 2005 at 00:00.
MOmonster is offline   Reply With Quote
Old 26th July 2005, 19:26   #42  |  Link
MOmonster
Registered User
 
Join Date: May 2005
Location: Germany
Posts: 495
@all
Ones more I updated the my function. It has many big changes, not only the change of the name.
I wrote a readme and created a package that includes Cdeint, Crestore and Cdeblend.
The bthresh value and with it the blenddetection work different from the last version. The motion is now much better and many other changes applied to the function. It is really worth a try.
Quote:
Originally Posted by scharfis_brain
how does it handle the Starship Voyager Intro video?
Is it able to deblend the nebula scene without jerkyness?
Yes on my test, the newest version really seems to handle this hard stuff.
MOmonster is offline   Reply With Quote
Old 28th July 2005, 15:30   #43  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,391
Oh, the attachment has appeared

Could only do two small tests so far on Crestore. Judging from these, the new routine seem to do a darn good job. Very well done, MOmonster!


And yes, even the VOY intro is almost perfect now. Small problems detected:

1) In the beginning, from ca. 0:06 to ca. 0:14, there was a slight "pulsing" in the motion - not jerky, just a very small speed difference in the flow of motion. However the effect was not very easy to spot.

2) A clear jerk (dup) was produced around approx. 0:37 (floating blue nebula scene), but this could also have been caused by decimating to 24fps instead of 23.976. (Should be re-tryed with another decimator.)

3) The blended scene transition at 0:49 was definetly jerky - the flying rock was appearing in a bonanza style ...


No. 1) is rather minor - I just noticed it on 3rd view. No. 2) could be an issue of the decimator, so it doesn't count for now. This leaves us with 3) as the only noticeable error in the whole sequence. This is a very good result indeed.

In relation to No. 2) , I'd suggest to switch to another decimator than decimate() - either TDecimate or FDecimate. In the most common standard case, for each 1000 PAL frames there *are* only 959 FILM frames available to restore. Decimating to 24fps tries to restore 960 FILM frames instead, so one jerk (duplicate) is preassigned. There's no guarantee to avoid these by decimating to 23.976 fps, but the chances are much better.
__________________
- We´re at the beginning of the end of mankind´s childhood -

My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!)

Last edited by Didée; 28th July 2005 at 15:33.
Didée is offline   Reply With Quote
Old 28th July 2005, 16:15   #44  |  Link
MOmonster
Registered User
 
Join Date: May 2005
Location: Germany
Posts: 495
Thanks for the testing Didee,

the first and the second point I know very well. The first is because it don´t find the pattern so accurate, it need some seconds or better a high motion scene (with clear fields) to find the pattern offset more accurate. And yes the second point is because of the decimation process. Theoretical tdecimate should give better results with the right settings, but I don´t get it running together on my pc (not enough ram I think or something similar). Fdecimate doesn´t create good results, that´s why decimate is recommed.
Because of the third point, I´ll have a closer look on it. Maybe it´s just a point of the bthresh. We´ll see.
I already think about the next version, but mainly to get it more stable and maybe a little bit faster.

MOmonster

Last edited by MOmonster; 9th August 2005 at 23:45.
MOmonster is offline   Reply With Quote
Old 9th August 2005, 23:41   #45  |  Link
MOmonster
Registered User
 
Join Date: May 2005
Location: Germany
Posts: 495
@all
I just updated my Crestore function. Ones more there are big changes.
I still don´t get the voyager intro fully dup free, but the third point Didee spokes about doesn´t happens anymore. The new function is more flexible because of the range parameter. The blend detection core is updated and it doesn´t need anymore a decimater. There are two Crestore functions that output 23,976 or 25fps. Crestore_pal wasn´t tested till now, because I have no sources with such a conversion.
If you use leakkernelbob for the bobbed input the speed increase significantly compared with my last version. If I use tdeint the speed decrease very strong, I think this is a memory problem (256mb ram has my pc). Maybe somebody with more pc performance could test the speed difference. For more informations, please read the updated readme.

So or so, the new functions seems to do what I want. The development of this package will slow down a little bit in the next time, because I don´t have much more ideas for this function and there are other projects, I want to do.

For the near future I plan to test a totally different simpler and faster blend detection, maybe the next version will ones more have a small speedup.
Also the missing mnv & mlv parameter give me the idea for a new function.

Cu, MOmonster

Edit: There was a small bug in the blend detection, I had fixed. Please download the newest version for tryout.

Edit2: I find out where this big slowing down came from. Its the range parameter. Set it smaller (down to 2), if you have this speed problems.

Last edited by MOmonster; 11th August 2005 at 21:40.
MOmonster is offline   Reply With Quote
Old 18th August 2005, 12:59   #46  |  Link
MOmonster
Registered User
 
Join Date: May 2005
Location: Germany
Posts: 495
Ok, ones more a new Version (v0.9b) of Crestore is out. Also Cdeblend is updated. The speed problems are solved. This version is the fastest Crestore till now, also the dup problem seems to be solved. I really like the output.
The readme is updated, there are some new parameters, so please read it.
At this point I think, that it is a real alternative for restore24. Also the quality fanatics should have a look on it.
MOmonster is offline   Reply With Quote
Old 18th August 2005, 14:24   #47  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,391
I would give applause, but ... try processing the Voyager Intro with an additional "trim(8,0)" before doing anything else, and prepare for an effect.

BTW, somehow the flying rock is still riding bonanza for me?
__________________
- We´re at the beginning of the end of mankind´s childhood -

My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!)
Didée is offline   Reply With Quote
Old 19th August 2005, 08:34   #48  |  Link
MOmonster
Registered User
 
Join Date: May 2005
Location: Germany
Posts: 495
@Didee
So I use trim(8,0) before the script. No problems. It makes no difference for me. Or did you use it only on the bobbed inputs?
I switched framewise the first 1800 frames and there were no dups, but how fluency the motion is I can´t say you, because on my 60 hz monitor the whole intro doesn´t looks that smooth. I try to make it better in my next version.

I know what you mean with the motion of the rock. No dups, but bad motion, because there are too many blends left. I think with the right settings it should be possible to make it better. I will play a little bit with the parameter this evening.

Last edited by MOmonster; 19th August 2005 at 08:40.
MOmonster is offline   Reply With Quote
Old 19th August 2005, 13:03   #49  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,391
Oh, indeed. My apologies. In fact I was testing the version you PM'ed me, and that one showed the behaviour I mentioned. And since you said apart from some minor thingies it were practically the same, I drew my conclusion.

Still, I think your used method is not correct, and don't understand why it seems to work nonetheless:
Basically, Crestore_xx is producing a de-blended stream @ input framerate, and you're simply calling a "changeFPS(x.xxx)" on that, at the end. This seems more than risky to me, since the source can contain the blends in arbitrary positions, where ChangeFPS works its way through in a fixed pattern.

Or did I miss something, and ChangeFPS has bacome a smart decimator that chooses the least-difference frames for dropping?
__________________
- We´re at the beginning of the end of mankind´s childhood -

My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!)
Didée is offline   Reply With Quote
Old 21st August 2005, 22:56   #50  |  Link
MOmonster
Registered User
 
Join Date: May 2005
Location: Germany
Posts: 495
@Didee
I pm'd you to explain how my function does it.

@all
A smaller update of the package. A small improving of the blenddetection should give better results (also for the rock scene, but still far from perfect). Crestore and Cdeblend don´t have any longer a nlv parameter.
MOmonster is offline   Reply With Quote
Old 24th August 2005, 21:23   #51  |  Link
Roscoe62
Registered User
 
Join Date: Nov 2004
Location: NZ
Posts: 141
At the risk of incurring wrath for being a total newb, I'd like to know the best way to use this function. I'm trying to "clean up" my PAL ST:TNG episodes and using a function like this seems the right way to go.

However, I'm unsure of the best way to apply it in an avs script. I know I'll be using a .d2v file based on the DVD Vobs of the individual episode for an input. I also know that, ultimately, I wish to produce an XVid file as the finished result, by feeding VDubMod the avs file. However, is it better to apply a function like this as a separate step before doing the XVid conversion - i.e. Produce a "corrected" file first before worrying about doing the XVid conversion (and if so, a file of what format is best?), or do it all in one go - fix it AND produce the XVid?

Sorry if this seems like an overly simple question to ask, but the avisynth FAQs and tutorials don't really cover a situation as specific as this one, and I'm grateful for any help or advice.

Cheers
Ross
Roscoe62 is offline   Reply With Quote
Old 24th August 2005, 21:52   #52  |  Link
MOmonster
Registered User
 
Join Date: May 2005
Location: Germany
Posts: 495
@Roscoe62
Did you already try this function. Imean for some sources it works really nice, but in general restore24 still produced the better results in my tests.
But of course the big advantages till now are the speed and stability. Till now I don´t find any problems running it with virtualdub to get a xvid file. Maybe if you want to do a twopass encoding or your script has many other functions or filters you should first produce the corrected file (I didn´t try a twopass encoding yet), but till now I see no problem to do it in one go.

If you want to produce a corrected file before you should use a lossless codec. The most popular is huffyuv, but there are also some slower but more efficient codecs.
MOmonster is offline   Reply With Quote
Old 25th August 2005, 21:22   #53  |  Link
Roscoe62
Registered User
 
Join Date: Nov 2004
Location: NZ
Posts: 141
Thanks MOMonster,

No, I haven't tried your function yet because, as I thought I hinted at in my earlier post, I haven't quite figured out how to use it yet! I had a look at your script, and I know I'd import it into my own script but, apart from using the import line in my own script and possibly tweaking some parameters in C_package, is there anything else I should do?

I "think" I figured out how to use Restore24 last night and I decided to use it in 2 passes. The first involved importing R24 and doing all normal processing EXCEPT using the dust filter and converting to XVid. Instead I just created a Huffyuv file. The next stage I'll use that Huffyuv file as the input, add my dust filter and do a 2 pass XVid encode. I'm interested to see the results, but I'm still very keen to try out C_restore to compare.

Also, Didee says to try your C-restore function, and you're telling me to try R24, so who should I believe??

Again, sorry for the newbie questions, but I'm grateful for any guidance you can provide.

Thanks again!
Roscoe62 is offline   Reply With Quote
Old 25th August 2005, 22:26   #54  |  Link
Roscoe62
Registered User
 
Join Date: Nov 2004
Location: NZ
Posts: 141
Just quickly checked again and I see the C_package contains 4 distinct functions so do I just choose to use one of the functions (Crestore_film perhaps?) or just import all?Hmmm.....maybe I need to do some more reading :-{
Roscoe62 is offline   Reply With Quote
Old 25th August 2005, 22:27   #55  |  Link
MOmonster
Registered User
 
Join Date: May 2005
Location: Germany
Posts: 495
@Roscoe62
Ok, short to the differences between these both functions.
At this point for non-anime sources restore24 gives the better results. The output of my Crestore isn´t that smooth like restore24 for some sources (on other it works great, but there are many examples restore24 works better).
So qualitywise for the most sources restore24 gives better results (don´t has to be, just try it out).
But my function has also some advantages. It is much faster than restore24 (will change for the next version, restore24 get much faster). You don´t has to load so many filters (only the bobber), because it works with the internal filters of avisynth2.5. The whole function isn´t that komplex and runs more stable on my system and it doesn´t has the limitations of smartdecimate (50min length, but ofcourse you can use tdecimate instead).
So you can do the filtering and encoding in one go
But if time and space aren´t that important for you and you see the motiondifferences between these functions of course you should use restore24.
And yes to use my function just load the avs and the filter for the bobber and then begin to tweak the settings. Defauts doesn´t work that bad. Please read the readme for more.

For pal material Crestore_film. Don´t use Cdeint!!!. If motion isn´t good enough for you, you can also try Cdeblend with a decimater.

Last edited by MOmonster; 25th August 2005 at 23:02.
MOmonster is offline   Reply With Quote
Old 7th September 2005, 12:14   #56  |  Link
MacAddict
XviD User
 
Join Date: Oct 2004
Location: Ky
Posts: 190
Just trying this for the first time. Anyone tried running this function with the latest AVS 2.56 RC1? I'm getting an invalid argument to 'trim' on line 41 of the function. Maybe I'll go back to 2.55 and give it a try later.
__________________
DFI NF4 SLI Expert | Opteron 165 CCBBE 0616 XPMW (9x325HTT=2.9Ghz) | 2x1GB G.Skill HZ (3-4-4-8-12-16-2T) | LG 62L DVD/CD | Geforce 7300GT | All SATA | Antec 650 Trio PSU | XP SP2
MacAddict is offline   Reply With Quote
Old 7th September 2005, 12:19   #57  |  Link
Wilbert
Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 6,370
Which line is line 41?
Wilbert is offline   Reply With Quote
Old 7th September 2005, 14:49   #58  |  Link
MOmonster
Registered User
 
Join Date: May 2005
Location: Germany
Posts: 495
@MacAddict
What function did you use. With avisynth 2.55 it all seems to be ok. I´ll test it with version 2.56rc1 the next time.
MOmonster is offline   Reply With Quote
Old 8th September 2005, 00:06   #59  |  Link
MacAddict
XviD User
 
Join Date: Oct 2004
Location: Ky
Posts: 190
Sorry for the delay guys, just got in from work.

I'm not sure what line is 41 to be honest because it's all dependent on which application opens the avs file. VdubMod editor shows this line as being 41 and in fact has 'trim' in red letters for some reason.

Code:
global testclip = bclip.trim(2,0)
The function I tried was Crestore_film() on a PAL blended DVD source. Korean flick named Seom.
__________________
DFI NF4 SLI Expert | Opteron 165 CCBBE 0616 XPMW (9x325HTT=2.9Ghz) | 2x1GB G.Skill HZ (3-4-4-8-12-16-2T) | LG 62L DVD/CD | Geforce 7300GT | All SATA | Antec 650 Trio PSU | XP SP2
MacAddict is offline   Reply With Quote
Old 8th September 2005, 02:36   #60  |  Link
mg262
Clouded
 
mg262's Avatar
 
Join Date: Jul 2003
Location: Cambridge, UK
Posts: 1,148
It is probably objecting to bclip because there is something wrong with it.

MOmonster may be able to pinpoint the problem straightaway, but I think it might help if you were to post the arguments for your function call -- or even better the whole script you are using.

I've just opened up the script, and it looks to me like you may not be passing enough arguments to the function... but that's just a guess.
mg262 is offline   Reply With Quote
Reply

Tags
mrestore, srestore

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:08.


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