View Full Version : Restore24 revisited.
scharfis_brain
1st May 2004, 20:33
Restore24 is a AVISynth-Function created by Didée, that is able to do the nearly impossible: Restore 24fps FILM out of a fieldblended
FILM -> Telecine -> NTSC -> Blendconversion -> PAL - Video.
Most know cases are:
Startrek, X-Files, Simpsons and much more.
But the original restore24 - Thread:
http://forum.doom9.org/showthread.php?s=&threadid=61792
has become very confusing for poeple, who are new to this.
So I decided to collect all needed information and plugins into a package.
here, you can download it: http://forum.gleitz.info/attachment.php?attachmentid=70159
( http://forum.gleitz.info/showthread.php?p=141426&posted=1#post141426 )
If I do voilate any rules by collecting plugins in this way, please PM me, I'll remove it asap in that case.
EDIT: 2004-07-14
2nd update of this package.
cahnges:
------------------------------------------------
1)framerate decimtation ratio is now arbitary:
this means, it is not fixed to restore 23.976fps out of 50Hz PAL
it is also able to restore 25fps out of 59.94 Hz NTSC
restore24(analysis_clip, render_clip, int "numerator", int "denominator")
following ratios are practicable:
24fps blended into PAL
2997, 6250 (default, if no ratio is given)
improvement: output is no longer 24fps.
It is perfect 23.976fps
25fps blended into NTSC:
2500, 5994
this is similar to rePAL, exept that it has better blend recognition
and matches the 25fps perfect (rePAL puts out 24.975 fps)
24fps blended into NTSC:
24, 60
----------------------------------------------
2) it is possible to process everything in YV12 without converting to YUY2
(please test, before using it widely!)
----------------------------------------------
3) decimation-output is improved
there are no longer remaining combs due to decimation by smartdecimte
----------------------------------------------
4) improved blend detection using other method to build an edgemask
Didée calls it double sobel (Doppelter Sobel)
It now should be much more resistant against noise.
EDIT 3rd Update:
2004 - oct - 01
1) no major changes on the restore24-core itself.
I only changed a small little weird behaviour:
r24 sometimes returns a black frame as the very first frame.
it now returns the very first field of the input stream
instead of this black frame.
2) heavily changed the deinterlacing routines.
intellibob() is dead now.
matchbob() is the current state of art.
matchbob() is based on tricticals tdeint(),
which implements the idea of intellibob() into a plugin, and on telecide().
matchbob() has a progressive frame detection,
which usually produces up to 16 progressive (non-deinterlaced; weaved)
frames per 50 frames on standard FILM -> telecine -> NTSC -> PAL video.
this means, in the final output, there will be up to 7 of 24 frames,
that have maximum quality (they are weaved)
when dealing with FILM -> SPeedup -> PAL -> NTSC video, most frames of the final output will be weaved.
This is nice, isn't it?
The deinterlacing functions are now included into the file restore24.avs
So there is no need for loading a separate *.avs for the deinterlacers.
EDIT: 4th Update
2005-jan-05
pogo stick
2nd May 2004, 12:37
Great! Very impressive!
Big THANKs to Didée and scharfis_brain!
It is what I was looking for.
Worked good even in ultrafast mode.
Can I speed up things even more?
I need to encode about 45 hours of video with blended fields.
And 1 hour video takes about 10 hours of encoding using Restore24 on my PC.
Can this process be simplify by using only even fields, detecting blends and replacing them without deinterlacing and decimating to 24?
I want to get 384x288 output.
Mug Funky
2nd May 2004, 12:45
hmm... how about:
separatefields().selecteven().bicubicresize(384,288,0,.5)
unblend()
YourFilterHere(blah=10)
this should run fast as hell.
pogo stick
2nd May 2004, 13:31
Thank you, Mug Funky! :)
I will try unblend.
I also found deblend. What settings is this filter have?
Is there anything else I can try?
All these useful things about blended fields should be documented somewhere, so Avisynth beginners like me wouldn't ask about it over and over again.
Searching helps :) and confuses :confused: at the same time.
scharfis_brain
2nd May 2004, 14:03
separatefields().selecteven().bicubicresize(384,288,0,.5)
unblend()
YourFilterHere(blah=10)
@Mugfunky don't do that this way.
on 24fps stuff unblend will produce garbage.
better use:
source()
kernelbob()
unblend()
smartdecimate(24,100)
but restore24 will produce much better pans and lesser yerk.
restore24 can be sped up further using this:
a0=horizontalreduceby2().ibob()
b1=bilinearresize(yourwidth,a0.height).kernelbob(7)
restore24(a0,b1)
I do not recommend ibob() for the b_ - clip, because it produces a jumpyness-effect. always use at least dgbob() or kernelbob() for it.
vispgraedde
2nd May 2004, 14:15
Will be interesting to test this on some really nasty stuff I have stored away.
But. If I understand this right, it is only working on stuff with constant blends?
The stuff I have contains nonlinear blends.
In principle it's normal blending of fields, but with a twist...
on the top of the field the blending may be 0% and at the bottom 100%, where the transition from top to bottom is not linear either.
other fields may have blending 100% at top and 0% at bottom. Again nonlinear.
What I mean with constant blend is that the blending is 100% from top to bottom of a field, and not variable.
I don't know when I will have time to test this on the stuff I have, but if anyone have tried with nonlinear blends and got it working, please post about your results =)
scharfis_brain
2nd May 2004, 14:37
it works this way:
dectect blends, replace them by the best fitting neighbor avoiding lonely frames and triple-frames (it tries to ensure every frame becoming a dupe).
then it removes duplicated frames.
if your source has enough good frames (non blended) in it and the partially blended frames are detected by restore24, it would work, too.
You have to try it.
vispgraedde
2nd May 2004, 15:58
A theoretical example
Original top fields: A B C D
Encoded as: A (blend AB) (blend BC) C D
Original bottom fields: a b c d
Encoded as: a b (blend bc) (blend cd) d
In the example you can disregard the nonlinear blending and just consider the constand blend case.
Will it be able to produce a goodlooking top field B and bottom field c?
If yes on that, can it in theory handle nonlinearly blended frames as well to recreate B and c?
If not... is there any 3D interpolating scheme (or something) that can recreate B and c using Aa b C and Dd?
edit:
I can't test the filters until beginning of June for various reasons.
Mug Funky
2nd May 2004, 16:21
theoretically it can handle blends like that.
it defines a blend as having more "edges" than the previous and next frames, so blends like these _should_ be picked up.
Close, but not a full-hit ;)
Restore24 reckognizes blends through the fact that the "prominence" of edges is lower in blended fields/frames than in non-blended.
Furthermore, it assumes that there never appear 2 blends directly after each other (and through a "clean" blend-conversion, this indeed should never happen).
In other words, only blends that have 2 "clean" neighbors in both directions can be reckognized safely.
And lastly, it internally only works with full frames, by bobbing the stream.
Summary (c=clean, B=blend):
Most kinds of field-sequences of this kind:
c B c B c B c c c B c c B c c c B c B c B c ...
or similar, should be handled correctly.
If you have something like
c B c B B c c B B c ...
or whatever else might have come out of strange conversions, will give funny, unpredictable results.
- Didée, interlacing impaired ;)
vispgraedde
3rd May 2004, 02:56
Originally posted by Didée
If you have something like
c B c B B c c B B c ...
or whatever else might have come out of strange conversions, will give funny, unpredictable results.
- Didée, interlacing impaired ;)
That's what I thought...
Back to the drawing table for my ideas about how to restore nasty blends like the ones I have :(
pogo stick
3rd May 2004, 14:35
Originally posted by scharfis_brain
restore24 can be sped up further using this:
a0=horizontalreduceby2().ibob()
b1=bilinearresize(yourwidth,a0.height).kernelbob(7)
restore24(a0,b1)
I am not sure I understood everything right.
Should I insert output width (in my case 384) instead of "yourwidth"?
Should I leave "height" untouched?
And will it be OK if I put crop(16,4,-8,-4) before everything else?
scharfis_brain
3rd May 2004, 23:15
@pogo stick:
yourwidth can be replaced by your custom value.
do not change the height. I WILL mess up everyting.
leave it as a0.height.
a0.height reads out the height of clip a0 and reuses this value for resizing b1.
you may crop horizontally before, but do not crop vertically, because of a kerneldeint-issue.
Do your vertical cropping afterwards. (the vertical resize, too!)
nanga parbat
14th May 2004, 04:16
hello,
i am not entirely sure if i shouldn't make a separate post, but i am running into some problems here.
thing is i have that ghost in the shell dvd here and it's really horrible. just the material for restore24.
anyway, i wanted to try it out and set up a script - vdub instantly died away upon loading the avs. so i removed more and more stuff until i found out that just by loading the dll's
(masktools and maybe another one to be precise) and just loading the d2v it crashes. i mean not avisynth crashes, just vdub.
so i uninstalled avisynth, cleaned plugins (restarted ;) ), installed again (restarted) and only put the necessary dll's into the plugin directory.
now avisyth is complaining about smartdecimate not being an avisynth 2.5 plugin, again just on plugin loading. i mean i am happy to see an avisyth message, but what the??
i am sure smartdecimate is for v2.5x _only_
so, actually i am a bit at a loss here now. i tried it with moving smartdecimate.dll and avisynth_c.dll to some other folder, as suggested in another thread - no go.
avisyth is v2.5.5 (20.03.04)
i tried with vdubmod 1.5.4.1, 1.5.10.1 and vdub 1.5.9 but that no longer seems to be the problem.
d2v is generated by dvd2avidg (latest version) and read by according mpeg2dec3dg, but that alone loads fine.
here's the tiny script:
#
loadplugin("d:\...\avisynth_c.dll")
loadplugin("d:\...\SmartDecimate.dll")
loadplugin("d:\...\plugins\MPEG2Dec3dg.dll")
mpeg2source("d:\...\gits2.d2v",cpu=4,idct=7,iPP=true)
#
now you can see, i actually didn't get so far to even import and call the functions.
on a sidenote: loading ibob.dll also gives that message, though i think i wouldn't need it. and loading just masktools or that and everything else except smartdecimate and avisynth_c does work now... hmm
so can anyone give me a hint maybe, is there something i am forgetting? i mean i definately need smartdecimate, it's used in restore24.
i'd really appreciate some help.
thanks, nanga.
p.s: hum, now when just opening vdub it says: ... "avs_release_video_frame" could not be found in the library "avisynth_c.dll". (please, bear the dots and my translation ;) )
well...
i think i will try with avisynth 2.5.4, but then again, i think i've read something about masktools need 2.5.5 or so -
i'll see.
edit: with avisynth v2.5.4 loading the dll's is ok, but when trying out restore24 i get: "Avisynth open failure: ResetMask: RGB32 data only (...\restore24.avs, line 78)..."
now, must be masktools, right?
man, how do you guys get those scripts working?
i am considering to let run that fielddeinterlace script i had earlier...
Didée
14th May 2004, 08:01
@ nanga parbat
Computers are fun, aren't they? :)
You almost made everything right - almost.
1. Under AviSynth 2.54, Restore24 never had worked. That's OK.
2. C-Plugins, such as SmartDecimate and ibob, must be loaded with "LoadCPlugin("...")" ! (This little "C"-letter is a very common foot-trap.)
3. It's right to keep all those C-Plugins in a seperate directory. Put them there, keep them there.
4. For safety, check that your "Windows/System32" directory doesn't contain any copies of those C-Plugins. They sometimes tend to sneak in there, somehow...
Having made this, it should work. Otherwise, report back.
- Didée
Boulder
14th May 2004, 15:21
I tried the function on Citizen Kane (PAL), but I can't get it working in CCE or TMPGEnc. CCE simply crashes and TMPGEnc shows "can not open or unsupported) when the script is loaded. I used Scharfis's example script as it is (of course altering all the necessary stuff). Opening the script in VirtualDubMod works fine.
If you have any other methods for this video (see the sample VOB), please advice - I'm a total n00b when it comes to this stuff:D
http://www.saunalahti.fi/sam08/kane.rar (~5.5MB)
nanga parbat
14th May 2004, 22:05
well, thanks for the explanation, Didée!
so it all seems to come down to that little letter. and as i look into the example script again, i actually see it ;).
well, should've noticed it earlier...
anyway, it seems to work now.
unfortunately, since i installed avisynth 2.5.5, i do always get that message "...'avs_release_video_frame' could not be found in the library 'avisynth_c.dll'." upon starting virtualdub and/or loading a script.
i mean, it doesn't seem to be a fatal thing, but it's a little annoying to click it away all the time.
i looked into /system32 and renamed that dll, but then it is just complaining about this one being missing...
ok, it works, i am happy!
just previewed the script a little - seems to look really nice! now i will encode a snippet, to see how motion behaves.
thanks again, nanga.
nanga parbat
16th May 2004, 07:29
hi,
i just wanted to report back here to say that the results are really good. motion seems to be perfect now at 24fps, in fact even better than in the original.
there are some artefacts left, but nothing to worry about given the source.
just one little thing: could anyone tell me if there's a way to get rid of that avisynth message i mentioned earlier ("... 'avs_release_video_frame'...")? the thing is, when running a 2-pass (at least in avs2avi) , upon start of the second pass when it opens the avs again this message appears again.
and it's a bit unfortunate when you wake up and want to look how it came out, you see that it never actually started the second pass because you would have needed to click that message window away...
well anyway, thanks for that great script!
nanga
Originally posted by nanga parbat
just one little thing: could anyone tell me if there's a way to get rid of that avisynth message i mentioned earlier ("... 'avs_release_video_frame'...")?
Try moving avisynth_c.dll (is this even needed anymore?) and all C-interface plugins (like SmartDecimate) away from your autoloading plugins folder and load them by hand.
np: Vladislav Delay - Onttola (Demo(n) Tracks)
nanga parbat
16th May 2004, 10:34
Try moving avisynth_c.dll (is this even needed anymore?) and all C-interface plugins (like SmartDecimate) away from your autoloading plugins folder and load them by hand.
yeah i already did that.
and i thought i read in avisynth 2.5.5 changelog that avisynth_c.dll doesn't autoload anymore, so i wonder why i get that message (also on just opening vdub, as i said).
i renamed both that files (the one in /system32, too) but then it's just complaining about it missing...
so i guess i the best thing to do after using such c-plugins is to do a quick reinstall of avs.
anyway, thanks Leak.
nanga
p.s: (OT) i enjoy your np: - found that ultrahangfest mixes this way. quite some funny stuff there.
scharfis_brain
16th May 2004, 10:43
remove all avisynth plugin dll's from your system folder.
create separate folders like c:\avsplugins and c:\avsCplugins
for your plugins
nanga parbat
16th May 2004, 12:34
there aren't any avs plugins in my systemdir. just avisynth_c.dll. really, i just looked through.
it isn't that much of a problem, really. i'll see when i'm finished with that encode.
nanga
scharfis_brain
14th July 2004, 14:56
pushing to top.
I've made an update. See first post.
Stan64
6th September 2004, 13:04
Ok really good work. But I still end up with some blended frames. But I loose very many too. =) What can I modify?
Didée
6th September 2004, 13:41
No clue :D
Depends on what's going on exactly. It could be that Restore24 indeed is making some wrong decisions.
But ... I've come across many glitches on Paramount (C)rap stuff, where the field-blending is accompanished by some (rather poor) motion compensation. In these cases, the fields that should be fully blended are only *partially* blended, and the neighbors (which should be blend-free) contain some blending in exchange :(
Moreover, scenechanges are currently not fully safe, and I can't tell for sure if they'll ever be.
Stan64
6th September 2004, 14:10
Ok. Why don't make a scene fade change detector? That ignores them. Or deblend in a special way?
Didée
6th September 2004, 14:44
Yeah.
By the time you have implemented that, please inform me.
I see no clean and proper way to implement a special-case scenechange treatment within that tricky framework of ConditionalEnvironment + SmartDecimate.
Detection of blended scenechanges is trick enough since the change then is two frames long. Of course there are methods - but they're probably too complicated to additionally burden this already *complex* script with.
No, no ... scenechanges should naturally be treated correct, directly out of the metrics. I had some things under examination that seemed to work better, but ... currently, its senseless to wait for me to script anything. Don't hold your breath.
Is your problem indeed related to only scenechanges and nothing else? If so, you should look around for one of those "replace frame before/after scenechange" scripts, and try if you can use it as postproc for Restore24.
Stan64
6th September 2004, 16:21
No. That was just an idea.
The bproblems lies with this:
C = clean frame
B = blended frame
C C C B C C C B C C B C C C
A natural pattern with blended frames. And it can't handle them. =/
Look here.
http://stan64.ath.cx/after_restore24.jpg
It is a good filter and takes away around 60-80% of my blended frames. But there is many of them left.
EDIT:
If I append my smooth sharp filters from vdub before it takes away blended files. Would it be better then? It maybe detects them finer?
How do I do that? Where should I put the plugin codes?
http://stan64.ath.cx/pkmn_postprocessing.png
Didée
6th September 2004, 16:32
Hrmh. It misses such blends?
Sometimes there can be problems when suddenly motion appears, after several frames of no-motion. I guess that's pretty common with animee - but that's not my world ...
If possible, make an unprocessed sample of the source available. The more frames, the better - but please try to keep it < 10 MB.
EDIT: (To your edit above)
Yes, that makes sense. The better the "definition" (sharpness) of the source, the easier life is for Restore24. After all, the strength of edges is what it evaluates.
Stan64
6th September 2004, 16:44
Ok, but where should I write those calculations. It must be done after bobbing it to 50 frames and before the blenddetector takes things away? (yes I am lazy).
And, you seem to have right but this scene have a constant panning so it isn't the case. It works very well otherwise. =)
EDIT:
Here is onewhy not make it smooth/sharp all areas look for blending and then discard and then work? That would be slow but really great.
Didée
7th September 2004, 08:22
Of course you can let the function evaluate a sharper source than the one that gets actually processed. Syntax is still "Restore24(analyse,render,...)", and both clips have to be bobbed sources.
So, you can start with a simple
analyse=XYZbob().sharpen(1),
and can go up to
analyse=XYZbob().mftoon().iiP()._VD_SmartSharpen(...)
if you really feel the need ... ;)
Stan64
7th September 2004, 10:20
As you saw I need it. But I'm not soo good at you think I am. Where in the restore24 script do I implement that. And the SmartSharp script you use isn't supported in the vdub avisynth addon. =/
Didée
7th September 2004, 11:58
Okay then.
In the package of scharfis_brain, there is "example.avs", which demonstrates the basic usage.
In the second half, there are those "a1|a2|a3" and "b1|b2|b3" defined. The a's are the clips meant for analyzing, the b's those for final rendering. The higher the number, the better, but slower.
So, if you're going to call Restore24(a2,b2), then you should apply additional sharpening to the a2 clip, as that's the analyzing clip you've specified to use:
...
a2=R24KernelBob()
...
a2=a2.WhateverSharpen()
...
Restore24(a2,b2)
...
Since the sharpening here is only applied to the analyze clip and has nothing to do with final rendering, you need not necessarily use a slow hi-Q sharpener here. A simple sharpen(1) eventually could suffice - you just have to try out what works best. (If that's not enough, perhaps LimitedSharpen (http://forum.doom9.org/showthread.php?s=&postid=532809#post532809) could be an option, too. Speed is reasonable, and with Smode=3/Lmode=2 stronger sharpening is possible.)
Stan64
12th September 2004, 13:18
Nope, no effect. =/ Great idea but didn't work very well on my source. I will leave it as it is. =/
Audionut
15th September 2004, 01:03
With this script, i get the error
edit: still working on problem myself for the moment.
:devil:
scharfis_brain
1st October 2004, 21:18
3rd update of that package!
please read the first post for further detail.
Didée
2nd October 2004, 16:33
Originally posted by scharfis_brain
this means, in the final output, there will be up to 7 of 24 frames, that have maximum quality (they are weaved)
Are you sure that's a good idea? While fiddling with pattern guidance, I also had the option to prepare the bobbed stream accordingly. However, my decision was to use only one field from those clean full frames, too. Isnt't there a noticeable "quality jitter", when the series of interpolated frames is periodically interrupted by two full-resolution frames?
scharfis_brain
18th November 2004, 16:13
huh, completely missed that post.
I think, this quality jitter is negligible.
1) the eye doen't follow it that fast
2) it marks the best possible resolution -> reduced flicker for that frame, i think
but the best thing is: it runs faster!
now, what I really wanted to wrote here:
currently smartdecimate has a BUG, as found here:
http://forum.gleitz.info/showpost.php?p=151211&postcount=23 (german)
when doing a restore with 25i PAL sources, you might get this error message by restore24:
log2(num-frames*numr*4)>31
there are two possible workarounds jet:
1) set the decimation ration of r24 to 24,50:
restore24(a,b,24,50)
2) trim the video down to max. 179111 Frames (nearly two hours of video)
trim(0,179110)
directly after loading the video
divide your video in parts and restore them separately.
CrazyCow69
29th November 2004, 15:27
Hmm I tried to get this script working for several times but I keep getting an odd error wich I can't seems to fix.
The old vesion of restore24 works fine do..
I already tried all suggestions & tips in this thread ( used different dirs for plugin & cplugins etc etc) but still gives me the error.
now this is the thing wich happens always when loading it :
1)I open avs file in VD , loads fine, shows me the preview etc
2) when I press refresh , I get this error message ( same error message if I would try to encode) :
Avisynth open failure:
Parse: Unrecognized exception!
C:\#RIP\AviSynth\plugins\restore24.avs, line 69 column 0
E:\DVDVolume\VIDEO_TS\r24-cf.avs line 7
what I noticed is that "line 69" could be some other number too depends; 68, 69 ,83 ,... it's some kind of a random error
but it's fact that all those error lines are located under the part of ###### INITIALIZING MORE VARS ###### in the restore24.avs file
When I press ok, and then try to refresh again, VD just quits(crashes)
below my avs file:
setmemorymax(384)
import("C:\#RIP\AviSynth\plugins\restore24.avs")
loadplugin("C:\#RIP\plugins\masktools.dll")
loadplugin("C:\#RIP\plugins\tdeint.dll")
loadplugin("C:\#RIP\plugins\kerneldeint.dll")
loadplugin("C:\#RIP\plugins\decomb.dll")
loadplugin("C:\#RIP\plugins\dgdecode.dll")
loadplugin("C:\#RIP\plugins\avisynth_c.dll")
loadCplugin("C:\#RIP\cplugins\smartdecimate.dll")
loadCplugin("C:\#RIP\cplugins\ibob.dll")
mpeg2source("E:\DVDVolume\VIDEO_TS\sample.d2v",cpu=4,iPP=true)
AssumeTFF()
a2=r24kernelbob(0)
b2=matchbob()
restore24(a2, b2)
crop(0,2,-2,-4)
lanczosresize(640,480)
Any idea what could cause this problem or even better how it could be solved ?
Didée
29th November 2004, 16:11
Oh yeah ... that's one of the quirks that I've once experienced, too. I got it fixed for me, but alas no "general" solution has been found so far.
Somehow the C-plugins are always prone to give errors, especially when used in complex scripts.
My solution was to move the avisynth_c.dll out of /Windows/system32 (it's placed there during Avisynth installation), and to try manual loading of different avisynth_c.dll versions until I found one that made things work smooth again.
Try it both ways: like written above, but also the other way round: put avisynth_c.dll in /system32, and do not load it manually at all (!), relying on the one in /system32 to be autoloaded (better: auto-provided by Windows).
After all, if the script loads and works correctly when opening it once, then it's at least usable. (There were times when I could not use my own script at all, because it bailed out immediately when loading it...)
BTW, what Avisynth version are you using? I think I remember that I never got R24 to work under AS v2.54. With the initial v2.55 release, everything was smooth and fine. And for the later versions I don't know ...
zilog jones
30th November 2004, 17:50
Hi - is there much point in using Restore24 to convert from badly-converted PAL back to proper 25fps PAL, or will it just end up looking worse than the original conversion?
CrazyCow69
5th December 2004, 12:22
I'm using avisynth 2.55
Tried all ur suggestions Didée, but seems none worked for me. Got it temp working now by restarting vd before each pass to encode.
dapipa
10th February 2005, 17:55
@scharfis_brain
hi!
just a few questions concerning the latest restore24 package (2004-jan-08):
1. why didn't you include masktools 1.5.6 instead of 1.4.16? is it buggy, or is 1.4.16 better for the purpose of restore24?
2. is it OK to replace leakkerneldeint 1.5.3 with 1.5.4 (some speed improvement) and tdeint 0.9.6 with 0.9.7?
3. a few posts above you stated, that because of a bug in smartdecimate: "trim the video down to max. 179111 Frames (nearly two hours of video)," but in the restore24's readme it's written: "you cannot process Videos longer than about 50 minutes," so which one is correct? the movie i'm trying to encode now is only about 90 minutes long, so it would be more convenient not to split it during processing;-)
thanks!
dp
scharfis_brain
11th February 2005, 19:04
1) I included the older version of masktools, because the newer ones no longer contain YV12layer()
2) it is okay
3) NO way around this misbehaviour.
you do only have the two choices which I offered in the documentation.
(cutting after 50mins, or setting decimation ratio to 24/50 instead of the default 23.976/50)
dapipa
13th February 2005, 11:09
arigatou gozaimasu:D
scharfis_brain
13th February 2005, 11:14
what?
zilog jones
13th February 2005, 13:28
(it's "thank you" in Japanese)
scharfis_brain
13th February 2005, 13:55
oh. okay.
but japanese words with latin letters :confused:
how does that work
(scharfi, who has absolutely NO knowledge about asian languages...)
dapipa
13th February 2005, 17:48
hi!
this is way off topic, but yes, it works:-) i don't know the right english term for that (i'm not a natural born killer... aaam, english speaker i mean;) ), but it's something like "transcription", or "romanization" of japanese "letters"... i'm learning japanese almost 2 years by now, because i like anime & i hate reading subtitles, but it's not a big help so far, because there's not much anime, where people are asking "reizouko no naka ni wa naniga arimasu ka" (what's in the fridge?), or "eki wa doko desu ka" (where's the railway station?):D but something on topic: matchbob is dead now - does the new deinterlacer (r24kernelbob?) produce better quality, or matchbob's better (but it can produce combing)? if the 2nd is right, wouldn't it be better (for me) to use matchbob and check for combing manually? i'm always stepping trough my "encodes" frame by frame before encoding anyway... cheers!
dp
scharfis_brain
13th February 2005, 22:25
matchbob can be completely 'simulated' by using
tdeint(mode=1,type=2,tryweave=true,full=false)
plus tweaking the motion-detection comb-detection and other thresholds to your needs.
but going thru your encodes framewise is more then masochism.
(comparision:
So where is the need for r24, then? you 'could' go through the unprocessed file to select the good field manually...)
dapipa
14th February 2005, 04:15
i sure can try that:) but it's probably not as simple as adding separatefields at the end of my script, is it?
FatBoyGod
22nd March 2005, 20:09
Hi, I've been trying to get this to work, but i'm stumped, this is the script I'm using:
### Set this value to 2/3 of your Systems RAM (I have 768MB),
# if your machine ceeps crashing using this script
#setmemorymax(512)
#### ensure modifying the paths to your *.AVS and *.DLL files
# load the needed functions
import("C:\Documents and Settings\Fatboy\Desktop\restore24\restore24.avs")
# load the needed plugins
loadplugin("C:\Documents and Settings\Fatboy\Desktop\restore24\plugins\masktools.dll")
loadplugin("C:\Documents and Settings\Fatboy\Desktop\restore24\plugins\tdeint.dll")
loadplugin("C:\Documents and Settings\Fatboy\Desktop\restore24\plugins\leakkerneldeint.dll")
loadplugin("C:\Documents and Settings\Fatboy\Desktop\restore24\plugins\mpeg2dec3.dll") #or dgdecode.dll
loadplugin("C:\Documents and Settings\Fatboy\Desktop\restore24\plugins\avisynth_c.dll")
loadcplugin("C:\Documents and Settings\Fatboy\Desktop\restore24\plugins\smartdecimate.dll")
loadCplugin("C:\Documents and Settings\Fatboy\Desktop\restore24\plugins\ibob.dll")
# load the Video, use postprocessing for better blend-recognition on MPEG Video
mpeg2source("F:\X files stuff\XFILES_DISC2\VIDEO_TS5\x5.d2v",cpu=4,iPP=true)
#AVISource("video.avi")
# setup the correct Fieldorder, when using sources other than MPEG2.
#AssumeTFF()
#AssumeBFF()
### create the clip that is used for blend detection
a2=r24kernelbob(0) # best blend detection, slow
a0=ibob() # fastest method, maybe unprecise for detecting blends
### create the clip to be shown after the blends had been killed
b2=TDeint(mode=1,tryweave=false)# best resolution as possible gets restored, slow
b1=r24kernelbob(7) # much faster than TDeint(), but not the best resolution
b0=a0 # ultrafast, but only for speedfreaks
### call restore24 using both clips
# recommened, best, slow (a2, b2)
# standard, medium, medium: (a2, b1)
# not recommened, medium, fast: (a0, b1)
# never recommened, worst, fastest: (a0, b0)
restore24(a2, b2)
### eventually downscale it to NTSC-resolution (hides some artifacts)
# lanczosresize(width,480)
and this is the error i get:
Avisynth open failure:
Avisynth: script open failed!
cheers for ant pointers
Boulder
22nd March 2005, 20:22
Try with only b2=... and a2=... lines, leave b1=... ,b0=... and a0=... out. You could also try emptying your Avisynth plugins folder.
FatBoyGod
22nd March 2005, 21:49
Ok, did that, and it started loading the script. Now, however I get the following error:
Avisynth open failure:
MPEG2source couldn't open file
so, i comment that line out to see if anything else goes wrong and i get the following 2 errors:
Script error: invalid arguements to function "r24kernelbob"
and
Script error: invalid arguements to function "TDeint"
any ideas? I've made sure the path is correct to the d2v file, and I created it again using dgindex to be on the safe side.
scharfis_brain
22nd March 2005, 22:03
you need exactly the mpeg2dec3.dll, that was bundled with dvd2avi
but better replace it with dgdecode:
http://neuron2.net/dgmpgdec/dgmpgdec121.zip
dgindex replaces dvd2avi
dgdecode.dll replaces mpeg2dec3.dll
that should make it working
note: d2v's always need to be created new, because they are incompatible between all versions.
FatBoyGod
22nd March 2005, 23:13
Cool, ok done that, but I still have trouble loading the masktools plugin, it either responds with unrecognized exception at line 12 or refers to the plugin specifically. The path is correct, I changed it in case it's case sensitive, and it's the version from the download package.
Almost there, I can just about get my tounge tip on the taste of success :p
scharfis_brain
22nd March 2005, 23:42
you've got a P4-HT, do you?
take a look at this:
http://forum.doom9.org/showthread.php?s=&threadid=88012&highlight=restore24
FatBoyGod
22nd March 2005, 23:56
Hey hey, that did it. It never even occured to me that it would relate to the processor.
Now one final question, and quite possibly the stupidest, but what do i do now? I've got the script loaded into vdub, and I can preview it, but what do I save it as?
edit: Just to be clear, i only want to process out the blended fields, and then encode the source as i normally do, with gk or agk, right?
scharfis_brain
23rd March 2005, 00:09
no way with GK or AutoGK here!
you need to do everything manually!
- cropping
- resizing
- calculating Bitrate
- muxing and encoding audio
tec.
FatBoyGod
23rd March 2005, 00:12
Right, better get my hands dirty then. Thanks a lot for all your help, I'm off to figure out how to do all that stuff.
Cheers :)
FatBoyGod
23rd March 2005, 22:28
I'm having trouble getting vdub to batch process using this, it returns errors which never seem to be the same twice. I've followed the guide to encoding using vdub, so I'm pretty sure everything there's ok. Funny thing is I can process them one by one, but for this sort of thing you really need it to be running over night, so it would be nice if I could get the batch thing running.
I'll try going back to an earlier version of vdub (I've already tried the latest version of vdubmod) and see if that helps, but if anyone has any ideas they'd be appreciated. Cheers
scharfis_brain
24th March 2005, 00:23
oh, I forgot to mention:
- no batch processing possible with r24.
FatBoyGod
24th March 2005, 00:27
ah well. I did a manual 2 pass, and the things turned out pretty good, although I only managed to get about 2~3fps. I'll have a read, then a tinker.
Didée
24th March 2005, 11:32
Originally posted by scharfis_brain
oh, I forgot to mention:
- no batch processing possible with r24.
Halt. Batch processing is possible. It may be dangerous, probably because of the instability of the C-plugin thingie, or whyever. But impossible it is not:
Right now I've performed a 2-pass batch encoding test with R24 on a 1000frame sniplet, and both passes went through without error.
However for *en*coding, I still use VdubMod v1.4.13. VdubMod 1.5.10 is generally not recommended to use for batch encodings, instead v1.5.4 is advised. But I trust more in v1.4.13. ;)
(BTW, to be even more on the safe side, one could place a "dummy" avi file, only couple of frames in lenght, between the two passes, and let it process by whatever.)
FatBoyGod:
Let's mention once again the "trick" with first producing a lossless compressed file through ~any~ slowly running avisynth script, and then doing e.g. an XviD 2-pass encoding on that intermediate file.
Example: source is 1 hour long.
2 passes @ 2.5 fps through R24: ca. 2*10 = 20 hours processing time.
1 pass @ 2.5 fps (R24), 1 pass @ 20 fps (1st pass), 1 pass @ 8 fps (2nd pass):
10 + 1.25 + 3 = 14.25 processing time.
All numbers are very roughly over the thumb (highly dependant on PC's horse power, o'course). But in any case, the gain in overall performance is very noticeable. As long as one has enough free HD space, this is the method how those computationally expensive avisynth scripts should be processed.
demon_llama
18th April 2005, 19:48
First of all, many thanks for this, really works well
but, this may be a bit offtopic, how do you get from PAL to NTSC with the audio? I'm using WLA to do repals, so if anyone knows the cmd to use to get from pal to ntsc, pls don't be shy
again, great work
LogicDeLuxe
20th April 2005, 15:55
I tested Restore24 on Star Trek "The Cage" and it works great. Thanks a lot.
With Restore24 the frame separation I got was even better than those on some DVDs. Frames with residual blendings are very rare in contrary to Star Trek TNG on RC2 DVD (which has PAL speedup), for example.
thetrueavatar
16th May 2005, 09:00
Hello,
I'm trying to test Restore24 to encode great teacher onizuka but I have got a real problem: It's too slooooooooowwww.
When using nero recode, this one indicates me that the encoding will take 1500 minutes for only 20 minutes of video. Curiously at the beginning nero recode was indicating me that it will only take 400 minutes...
So I made some search and I found a kind of memory problem with that script.
There is a kind ok memory leak on my computer. During the encoding, the memory used by nero reach about 900mb(I suppose that's normal).
The problem is that from that point the memory taken never stop to grow mega per mega. So every 2 or 3 seconds one more mega is taken by recode. This implies that at a certain moment, my computer is starting to swapping...
I have tried with other scripts but restore24 is the only one which put me in trouble .
Is there anybody else that had the same problem?
BTW I have a question about the code:
I saw this line at the begining of restore24.avs
global work = blankclip(worki).loop().trim(1,50)+worki
I was asking me if this line is equivalent to :
global work = blankclip(worki.trim(1,50))+worki
I ask this because from what I understand with the original code, the 50 first image will be transform into a blank clip and for that I don't understand why you are using an infinite loop which will (I suppose) that more time and more memory...
In the same idea why using infinite loop with
global out = outi.trim(0,1).loop().trim(1,50)+outi
you could replace it by
global out = outi.trim(0,1).loop(50).trim(1,50)+outi
wich will be faster than infinite loop.
Am I right?
thetrueavatar
PS: sorry for my bad english
EDIT: My problem seems to be solved. I was using a beta avisynth 2.5.6 . Someone told me that restore24 didn't works well with it. Now i'm using 2.5.5 and it works fine.
MOmonster
8th June 2005, 00:13
Fantastic work, Didee.
I love the results of your great function.
The only problem is the speed and that it is sometimes not stable enough on my pc. I tried to find another alternative for your great quality function in the tdeint thread, but all my ideas get more and more complex, so that it was at last not really useful. Your idea of reckognizing blends ´through the fact that the "prominence" of edges is lower in blended fields/frames than in non-blended´ still seems to work great for detecting blends.
I tried to create a function that takes a frame and compare the two fields of this frame. This function should return a value (0 or 1) that says us what of the both fields is the blend.
It is a fact that one of this fields is a blend. It should be possible to find out what is the blend with your method.
But after taking a closer look to the masktools and than to your script I still don´t get it, how your function realize the blend detection. :confused: :confused:
Maybe you can help me to understand the way how your function works or also good to create a function like this.
(Ach.., das hätte ich ja auch im deutschen Forum fragen können. Wäre vielleicht verständlicher gewesen. Naja)
Didée
8th June 2005, 09:16
The operation melts down to
(attention - Didée's dreadful pseudo-code) ;)
; preparation
source
bob()
E = EdgeMask
; very simple:
L = AverageLuma(E)
; better: (black out static edges)
E_p = E.duplicateframe(0)
E_n = E.deleteframe(0)
E_pn= max(E_p,E_n)
E2 = E - E_pn ; ( E minus E_pn )
L2 = AverageLuma(E2)
; blend detection (simple. using L2 is better)
IS_BLEND(current_frame) = (L(current_frame) < L(previous_frame))
&& (L(current_frame) < L(next_frame))
; blend replacement
IS_BLEND(current_frame) ? replace() : NOP
; decimation
decimate(numerator,denumerator)
That's all. Bob the source, make an edgemask, get AverageLuma of the edgemask. If the edgemask of the current frame has a lower averageluma than both the preceding and the subsequent frame, it is a blend.
From the method of operation, Restore24 is a rather simple function. The only complicated thing about it is the scripting framework. ;)
There still is lots of headroom for things like pattern guidance, recomputing the blended fields instead of replacing them, etc. An endless playground. :)
MOmonster
8th June 2005, 12:27
:goodpost:
Yeah, I know what you mean with the endless playground.
A big thanks from me. I didn´t believe that the blend detection itself is that simple. You really help me to understand how it work.
MOmonster
8th June 2005, 14:50
:confused:
Hi Didee,
one more time it´s me.
I tried to create the function. I used the filters from your last r24 package and also tried to use some internals from your r24 function.
But I still don´t get it work. There are two problems.
1. Invalid arguments to function "AverageLuma". I´m not able to feed AverageLuma with the Edgemask also if I delete the chroma channels.
Have you an idea why and how it could be able.
2. There is no function named "max". I also don´t know what this function does in detail and where I get it from.
Can you help me?
Didée
8th June 2005, 16:13
Didn't you see
(attention - Didée's dreadful pseudo-code) ;) :D
Cutting R24 down to the bare bones, it gets as primitive as the following. Perhaps that is easier to follow.
#-----------------#
### MAIN SCRIPT ###
mpeg2source("path\to\source.d2v")
assumetff() # or assumebff() ...
global work = last.bob() # must be global, because it will be used within conditional functions
CheckForBlends(work)
stackvertical(last,edge_c.greyscale)
return last
### END OF MAIN SCRIPT ###
#------------------------#
#------------------------------#
### BLEND DETECTION FUNCTION ###
# (creates edgemask, initializes global variables, and performs the
# blend detection through "Conditional Filtering" (<-- hence all those global variables)
function CheckForBlends( clip clp )
{
###### BASIC EDGEMASK ######
global edge_c = yv12lutxy(clp.expand,clp.inpand,"x y - 0.75 ^ 12 *",U=-128,V=-128)
###### WEAKEN STATIC PARTS, BIAS TO MOTION ######
# one method:
# global edge_c = logic( edge_c, logic(edge_c.deleteframe(0),edge_c.duplicateframe(0),"max").invert(),"min")
# another method:
global edge_c = yv12lutxy( edge_c, logic(edge_c.deleteframe(0),edge_c.duplicateframe(0),"max"),"x y -")
###### PAST & FUTURE... ######
global edge_p2 = BlankClip(edge_c).trim(1,2)+edge_c
global edge_p1 = edge_p2.trim(1,0)
global edge_n1 = edge_c .trim(1,0)
global edge_n2 = edge_c .trim(2,0)
###### INITIALIZING MORE VARS ######
global btest_c = 0
global btest_n1 = 0
global btest_n2 = 0
global btest_p1 = 0
global btest_p2 = 0
global IsBlend_n = false
global IsBlend_c = false
global IsBlend_p1 = false
global IsBlend_p2 = false
### Conditional Function Chain, evaluated from bottom to top (!) ###
c99=scriptclip(clp, "Evaluate()")
c5=FrameEvaluate(c99, "global IsBlend_n = (btest_n1<btest_c)&&(btest_n1<btest_n2)")
c4=FrameEvaluate(c5, "global IsBlend_c = IsBlend_n")
c3=FrameEvaluate(c4, "global btest_n2 = AverageLuma(edge_n2)")
c2=FrameEvaluate(c3, "global btest_n1 = btest_n2")
c1=FrameEvaluate(c2, "global btest_c = btest_n1")
return(c1)
}
### END OF BLEND DETECTION FUNCTION ###
#-------------------------------------#
#----------------------#
### EXAMPLE FUNCTION ###
# (running inside of the Conditional Environment)
function Evaluate( )
{
IsBlend_c ? work.subtitle("detected: xx BLEND xx")
\ : work.subtitle("detected: oo CLEAN oo")
}
The reliability of blend detection most probably is somewhat worse with this cut-down version - I'm currently not in the swing of things, sorry.
MOmonster
8th June 2005, 16:41
:thanks:
Oh.. I really didn´t see it, but that is not the point. I really tried to use the code of r24, but when I cutted all what I think I don´t need, I always get the first error massage and I don´t know why. I´ll take a closer look to your code.
Thanks you really much.
MOmonster
15th June 2005, 00:30
Hi Didee,
one more time it´s me. I had some time to test your blend detection. I use some parts from restore24 and try to make it more accurate with using the test results of the frames around, but still it doesn´t detect all the blends. I think restore24 works that good because it tries to find something like a pattern guide (if we can call it so for this strange material). Or am I wrong? :confused:
Thats why I tried to realize my own idea of a blend detection (tdeint thread).
And this is the result:
function CheckForBlends(clip clp)
{
###### PREPARATION ######
global sourceclip = clp.leakkernelbob(order=1, sharp=false, twoway=false, threshold=7, map = false)
global testclip = sourceclip.ReduceBy2().duplicateframe(0)
###### FRAMES FOR BLENDPARAMETERS ######
global combing_n0 = testclip
global combing_n1 = combing_n0.trim(1,0)
###### POSSIBLE OUTPUTS ######
out = sourceclip.subtitle("blend")
out_1 = sourceclip.subtitle("clear")
###### Conditional Function Chain, evaluated from bottom to top (!) ######
c99=ConditionalFilter(sourceclip, out, out_1, "Isblend()", "==", "true")
c5=FrameEvaluate(c99, "global btest = LumaDifference(blendmade, blendpic)")
c4=FrameEvaluate(c5, "Evaluate()")
c3=FrameEvaluate(c4, "global blendl = combl_0 < combl_1 ? 0.5 * Exp(0.66 * Log(combl_0 / combl_1)) :
\ 1 - 0.5 * Exp(0.66 * Log(combl_1 / combl_0)) ")
c2=FrameEvaluate(c3, "global combl_1 = YDifferenceToNext(combing_n1)")
c1=FrameEvaluate(c2, "global combl_0 = YDifferenceToNext(combing_n0)")
return(c1)
}
# (running inside of the Conditional Environment)
function Evaluate()
{
vid = testclip
vid_1 = vid.trim(2,0)
global blendmade = MergeLuma(vid,vid_1,blendl)
global blendpic = testclip.trim(1,0)
}
function Isblend()
{
temp = (btest < (0.75 * combl_0)) && (btest < (0.75 * combl_1)) ? true : false
return(temp)
}
It is slow and the values aren´t optimal, but the blenddetection works really good. On the tdeint thread I post the version I use now, but this is better for understanding.
I´m new to this things, maybe this idea isn´t effective enough, but for me it seems to give good results.
mg262
28th June 2005, 11:39
Has anyone tried using Restore24 with AVS2AVI? I get the error message:
AVIFileGetStream failed, unable to get video stream 0 : The operation completed successfully.
Here's the minimal script:loadplugin("e:\dub\restore24\masktools.dll")
loadplugin("e:\dub\restore24\tdeint.dll")
loadplugin("e:\dub\restore24\leakkerneldeint.dll")
loadplugin("e:\dub\restore24\avisynth_c.dll")
loadcplugin("e:\dub\restore24\smartdecimate.dll")
loadCplugin("e:\dub\restore24\ibob.dll")
import("e:\dub\restore24\restore24.avs")
avisource("e:\dub\cp\bs5.avi")
a2=r24kernelbob(0)
b2=TDeint(mode=1,tryweave=false)
restore24(a2, b2)It opens fine in VDubMod 1.5.10.1.
I've tried the following :
- changing to a0, b0 (as in the example script)
- putting all the files in one directory
- not requesting any frames from restore24, i.e. ...load/import...
avisource("e:\dub\cp\bs5.avi")
o=last
a0=ibob() # fastest method...
b0=a0 # ultrafast...
restore24(a0, b0)
o - but the error still turns up. Commenting out the restore24(a0, b0) fixes things.
Any help much appreciated!
yantei
29th June 2005, 12:34
Hello,
I've been trying to restore progressive frames out of 29.970 fps material.
It doesn't work with restore24(a2, b2, 24, 60).
Should I try with anything else?
I'm sorry If I missed any posts on this kind of problem.
You can download sample of this material from http://213.17.239.190/s4/kairo/huffyuv_excerpt.avi
Yantei
MOmonster
29th June 2005, 12:58
@yantei
What do you mean, with it doesn´t work. Crashes avisynth, did you get an error message. Or does it not work with your source, I mean to many blends left, wrong framerate ouputted. :confused:
Why is your clip so big, I need so much time to download it.
mg262
29th June 2005, 12:59
@yantei:
Your clip is bit too large to download at the moment, but I believe 23.976->29.97 is usually just plain telecine (aka 'pulldown') rather than fieldblending. If it's resized after telecine you will get something that looks like fieldblending but isn't... I'm not sure but I don't think you need the power of restore24 to deal with that; it's a different but simpler problem.) Would you mind trying this:
AVISource("...")
separatefields
And telling us whether you see blending when you step through the clip frame by frame in VirtualDub?
_____
I managed to sort out some batch files for restore24-ing by using VirtualDubMod command line (starting a new VDM instance for each file to process) so the AVS2AVI thing isn't necessary any more (though it's still interesting!) I'll post the batch files in a bit, though possibly not in this thread...
Didée
29th June 2005, 13:44
mg262,
just for fun, try to bicubic(!)resize immediately after R24, and see if it works with avs2avi then.
I noticed strange things in the past, like:
- certain filter calls *after* R24 will destroy R24's functionality (some conditional variables don't get any value, but starve at zero)
- which is resolvable by putting a bicubicresize() inbetween.
Conditional Environment. hehe :confused: hoho :confused: huhu ...
yantei
29th June 2005, 14:05
my source is an original ntsc dvd
the file is big because It is has original resolution and I thought it is important to cut at least 5 seconds...
yeah, I'm sorry for writing stupid "it doesn't work" - script works, the framerate is correct, but there are many blends left; thats the problem
fields ARE blended - I always check out blending using separatefields
it is not simple pulldown
here is a xvid-compressed avi (using "interlaced" compression mode):
http://213.17.239.190/s4/kairo/xvid_excerpt.avi
(2 MB)
MOmonster
29th June 2005, 14:34
@yantai
It´s because there stands two blends together. Restore24 isn´t able to recognize them.
Maybe my function will kill some more blends (also not all) but this will result in not so smooth motion. Have a look to my "another restore function" thread and try it out. So or so, the results won´t be perfect. :mad:
scharfis_brain
29th June 2005, 15:34
@yantei: open a new theard for your problem. then I'll give you a manual approach how to make this source 23.976 fps.
I don't like discussing it in this thread.
mg262
29th June 2005, 18:36
just for fun, try to bicubic(!)resize immediately after R24, and see if it works with avs2avi then.Afraid not :(
By the way, why the (!) ? Is bicubic a bad resize method to use?
_____________
Here is the core of the VirtualDubMod method I mentioned, in case anyone needs it:
First select your codec+settings and save processing settings (control+S) as e.g. "XVID.vcf". Empty the job list. The key command is:
start /wait C:\Capture\VirtualDubMod\VirtualDubMod.exe /s"XVID.vcf" /p"_restore.avs","restored.avi" /r /x
start /wait -- you need to use this to make the command interpreter wait until one instance of VirtualDubMod has finished before starting another.
/p adds the job to the batch file
/r runs all jobs in the job list
/x exits VirtualDubMod after all the jobs are finished
I use a batch file restore.bat like this
echo import("restore24\restore24.avs")> _restore.avs
echo loadplugin("restore24\masktools.dll")>> _restore.avs
echo loadplugin("restore24\tdeint.dll")>> _restore.avs
echo loadplugin("restore24\leakkerneldeint.dll")>> _restore.avs
echo loadplugin("restore24\avisynth_c.dll")>> _restore.avs
echo loadcplugin("restore24\smartdecimate.dll")>> _restore.avs
echo loadCplugin("restore24\ibob.dll")>> _restore.avs
echo # >> _restore.avs
echo avisource("cp\bs%1.avi")>> _restore.avs
echo # >> _restore.avs
echo killaudio>> _restore.avs
echo AssumeTFF()>> _restore.avs
echo a2=r24kernelbob(0) >> _restore.avs
echo b2=TDeint(mode=1,tryweave=false) >> _restore.avs
echo restore24(a2, b2)>> _restore.avs
echo assumefps(23.976024)>> _restore.avs
start /wait C:\Capture\VirtualDubMod\VirtualDubMod.exe /s"XVID.vcf" /p"_restore.avs","%1 restored.avi" /r /x The bits in bold are the ones that might sensibly be changed.
So if I type restore 5 then the file "cp\bs 5.avi" will be run through the script created and saved to "5 restored.avi". Then another batch file like this:call restore.bat 9
call restore.bat 8
call restore.bat 7
call restore.bat 5
lets me use restore24 on multiple files.
Didée
29th June 2005, 22:35
Afraid not :(
By the way, why the (!) ? Is bicubic a bad resize method to use?
Well, pity. I emphasized 'bicubic' because in those very cases, it turned out that BicubicResize closed the magic leak, whereas LanczosResize didn't. It's still a mystery to me how something that is happening further down in the processing chain can be able to influence what is happening in a function (in this sense: a black box!) that's placed earlier in the processing chain ... this should not be.
However, an update to Restore24 is coming nearer. Chances are good that those strange technical problems will disappear.
ScottZ
8th July 2005, 13:15
I Apologize, it's late and I'm still going through this thread again.
I'm getting an "Unrecognized exception!" error when loading the masktools module.
While I'm looking at that, I have a question..
I have a fairly decent 23.976 progressive source I'm reading with DGDecode, but it does have the random frame with "blended fields".
Is using the defualt restore24.avs and r24-example.avs parameters best for this situation?
Many Thanks!
p.s. how's the update coming?
scharfis_brain
8th July 2005, 13:33
I have a fairly decent 23.976 progressive source I'm reading with DGDecode, but it does have the random frame with "blended fields".
Never heard of such weirdness before.
Please provide at least 10 seconds of a scene (unprocessed video) showing this.
ScottZ
9th July 2005, 00:12
Very much apologize, I realize now that using the term "fairly decent 23.976 progressive source" was a bit misleading.
Let me rephrase...
I'm reading a vob using a d2v generated by DGIndex (140rc6) using Force Film.
The vob (anime material) is encoded at 23.976, but is for NTSC 29.97.
It is coming up as 98% progressive film in DGIndex which I thought was fairly decent and decided to use Force Film.
I'm viewing the frames one by one using VirtualDub and a simple 2 line avs script:
LoadPlugin("DGDecode.dll")
MPEG2Source("myd2v.d2v", cpu=6)
Virtual Dub is reporting the correct 23.976 frame rate and Inverse Telecine is set to "None - Progressive". No other processing.
There are a few frames that have "blended fields" and from what I've read, this is somewhat common when DGIndex reports anything not 100% film. I would like to correct these frames and keep this at 23.976fps progressive.
Using dgparse against the d2v I can see there are a series of 2's where the "blended field" frame occurs.
Example:
DGParse 1.3.0 by Donald A. Graft
Encoded Frame: Display Frames....Flags Byte (* means in 3:2 pattern)
--------------------------------------------------------------------
[GOP START]
[CLIP IS TFF]
0: 0,0..........................2
1: 1,1..........................2 <-- Frame with blended fields
2: 2,2..........................2
3: 3,3..........................2
4: 4,4..........................2
5: 5,5,6........................3 *
6: 6,7..........................0 *
7: 7,8,8........................1 *
8: 9,9..........................2 *
9: 10,10,11.....................3 *
10: 11,12.......................0 *
11: 12,13,13....................1 *
[GOP START]
12: 14,14.......................2 *
13: 15,15,16....................3 *
14: 16,17.......................0 *
15: 17,18,18....................1 *
Is restore24 a bit overkill for this?
I'm still trying to understand what tools I "should" be using to correct this.
Do you still need footage examples?
If so, would you rather have the mpeg segments or an avi save from virtual dub?
Thanks,
-Scott
Didée
9th July 2005, 10:37
Short answer: No.
For sources where blended fields (or frames) occur only sporadically, there's nothing to do except for manually replacing them.
Our current solutions work only for sources where the blended fields follow - at least roughly - a periodic pattern.
ScottZ
9th July 2005, 10:52
Ok.. thanks.
A simple open and telecide(order=1) seems to have worked for this situation.
scharfis_brain
9th July 2005, 12:16
if force film leaves blending and combing behind, don't use it!
use fieldoperation: none instead and decimate it using triticals TFM and TDecimate.
TFM has the great ability to read the flags from the generated d2v-file, so it only needs to analy the video where no flags do a telecine.
But I am still interested in a sample video.
ScottZ
9th July 2005, 13:26
Thanks for the tip, I'll give it a shot.
Again, these aren't horrific problem frames, but bugging me enough to want to find the "right" way to "fix" them.
I'll PM you when the files are ready.
I'm trying to cut out some examples from the vob to save space.
ScottZ
10th July 2005, 04:04
scharfis_brain - I've sent you a PM with a link.
Take a look and let me know what you think.
Edit: PM'd you with a second link as well
-Scott
tritical
10th July 2005, 05:35
TFM has the great ability to read the flags from the generated d2v-file, so it only needs to analy the video where no flags do a telecine.I wish that it could/did, but atm the only thing that is used are the rff flags by tdecimate to help identify duplicate frames and hybrid sections. Eventually, there will be an option to do both field matching and decimation entirely off the flags in areas where the usual pulldown pattern (0123) occurs but it might be a while... about 99.9% of the material I process is hard telecined so it isn't a priority.
ScottZ
10th July 2005, 09:06
Sooooo... dumb question #293
Is it better to use FF from DGIndex or use tools such as tritical's in an avs to get the progressive 23.976 frames?
(with the understanding that the source may only have a few problematic frames)
scharfis_brain
10th July 2005, 09:40
use DGIndex with FieldOp-None and this script:
loadplugin("D:\x\dgdecode.dll")
loadplugin("D:\x\tivtc.dll")
mpeg2source("scott.d2v")
#tfm(d2v="scott.d2v").tdecimate()
Guest
10th July 2005, 14:06
Your tfm() call is commented out?!
If FF produces a satisfactory result, I would prefer to use it just because it is faster. You also avoid any possible false matches introduced by IVTC.
scharfis_brain
10th July 2005, 16:20
ah, this is a copy and paste mistake!
for sure, it has to be:
loadplugin("D:\x\dgdecode.dll")
loadplugin("D:\x\tivtc.dll")
mpeg2source("scott.d2v")
tfm(d2v="scott.d2v").tdecimate()
MOmonster
10th July 2005, 22:16
Short answer: No.
For sources where blended fields (or frames) occur only sporadically, there's nothing to do except for manually replacing them.
Our current solutions work only for sources where the blended fields follow - at least roughly - a periodic pattern.
@Scottz
For such sporadically occured fields (only fields, not frames) maybe my Cdeint function is worth a try. It doesn´t look for a pattern, but kills blends really good. It won´t result in the same good fluid motion like with restore24, but maybe it helps you.
Edit: If there are only less problems, don´t overdo it, just use ff.
3ngel
25th August 2005, 13:59
Hi to all, i'm trying Restore24,
In the overall it seem functioning, removing most if the blending, but i see some remaining blended field not replaced by not-blended ones.
There is a parameter i can set in order to do lower the treshold of blending discovery?
In other words to force the script to recognise more blending in the field?
As far as i've understood this is something related to blending edge-mask, but i'm not too involved in avs programming.
Anyone can help me?
Thank you
Didée
25th August 2005, 14:45
No, the blend detection does not use any thresholding, hence there is nothing to tweak.
There are several possible reasons for getting blended frames in the output:
a)
R24 simply has made an error. This happens, but should be rather seldom.
b)
Sometimers there are two consecutive blends following each other. Given by the method of blend detection R24 uses, only one of them can be detected, but *not both*. In this case, it is possible that R24 replaces the detected blend with the other one.
Note: There are converters out there (for sure the one that converts all of the Paramount Star Trek stuff) that use a strange kind of motion compensation: In scenes where this MC has kicked in, there are always two consecutive blends occuring.
In thes case, just nothing helps.
c)
You might have requested a wrong framerate (through "numr" & "deno" parameters). The original framerate can not be detected by R24. The function fully relies on the user to specify these parameters correctly.
d)
If R24 is used for other conversions than "24-out-of-50", the results will be suboptimal. The reason is known (internal pattern helper is only suited for this case, and disturbs for almost all other cases) and will be fixed in the next version. There's no quick fix to hack in the current version. (Except, perhaps, to replace "CheckPattern()" with "global in_pattern = true" within the internal function "Evaluate()" - but that could be hazard as well).
So ... how much of blended frames are you getting, is your source PAL or NTSC, and and and ... ?
As always, an unprocessed sniplet of the source would be the best help ;)
3ngel
25th August 2005, 15:20
First thanks Didee for the reply, you're as ever kind and clear in you explanation. So back to the subject:
b)
Sometimers there are two consecutive blends following each other. Given by the method of blend detection R24 uses, only one of them can be detected, but *not both*. In this case, it is possible that R24 replaces the detected blend with the other one
Yes, in my case i've noted looking at SeparateFields output, that there are sometimes two consecutive blending, so in this case i understand the reason, but there are some other cases where there are not 2 consecutive blends.
c)
You might have requested a wrong framerate
My source is an interlace PAL, so i set up with default value
restore24(a2, b2)
The result is 23.976 fps.
But i wonder: it's possible for me to obtain a 25fps pal compliant from my PAL interlaced source with Restore24?
In terms of quality, in my case, it's best to obtain a 25fps or 23.976fps?
The content of the source is a Japan Anime.
scharfis_brain
25th August 2005, 15:32
it's possible for me to obtain a 25fps pal compliant from my PAL interlaced source with Restore24?
No. Not per default.
there needs some Postprocessing to be applied.
a) Encode a m2v-video with PAL-resolution, but with 23.976 fps and a 12-Frames GOP
push this m2v through DGPulldown with a framerate-change from 23.976 to 25.000
OR
b) Speed up Video and Audio to 25 fps.
Didée
25th August 2005, 15:34
The content of the source is a Japan Anime
... of which I understand as much as of Japanese language: nothing ;)
To avoid the hassle of counting fields, also try
(a,b,numr=24,deno=50) [->24.0 fps output]
(a,b,numr=2500,deno=5994) [->25.0 fps output] (edit: <- thats nonsense here)
(a,b,numr=25,deno=50) [->25.0 fps output]
on one or more problematic scenes, and see if the result gets better.
---
proverb: "Probieren geht über Studieren" (freely: "practice disproves theory")
3ngel
25th August 2005, 15:41
@scharfis_brain
I see, but i have not the need to encode in PAL compliant, my was only an information.
Thank you anyway.
@Didée
This (a,b,numr=24,deno=50) [->24.0 fps output]
will ge me precise 24fps? Not 23.976? So it's different from default?
And, in wich way the fps can influence the quality of the result?
Btw i'll try and see
Thank you :)
scharfis_brain
25th August 2005, 15:41
(a,b,numr=2500,deno=5994) [->25.0 fps output]
This only applies, if the input framerate is NTSC (59.94 fps)
With a input of PAL-framerate (50fps) one will get 20.854 fps. Probably NOT a wished one...
(a,b,numr=25,deno=50) [->25.0 fps output with PAL input]
Didée
25th August 2005, 15:52
:eek: & /*bangs head on table*/
Yes, sure. 25,50. Mea culpa.
***
edit to below post:
No problem, MOmonster. How many times did I mention R24 in *your* threads ... ? ;)
And: strictly, this is a thread of scharfis_brain, not mine.
Finally - yes, for Anime the functions from the C_package might work better.
MOmonster
25th August 2005, 16:31
@3ngel
Could you please upload a small part of your source. For movie in general restore24 produce the better results, but for anime I´m really happy with the results of Crestore, also you have the possibility to tweak the blend detection. :D
Sorry for misusing your thread to promote my function, Didee. :(
3ngel
25th August 2005, 16:59
@Momonster
Uploading a part of source is kinda difficul for me.
But regarding your function Crestore, what's different from restore24? And where i can get it? Differential tests are always a good thing :)
MOmonster
25th August 2005, 17:23
Look here (http://forum.doom9.org/showthread.php?t=95924) ;)
3ngel
25th August 2005, 18:09
Ok, as soon as i finish test with restore24, i'll try your crestore :)
Drossel
25th September 2005, 13:27
damn this cant be!! i write since 20 minutes then the browser jumps back to the previous website and everything is gone! grrrr 2nd try, lite version >< ....
hi,
finally i got restore24 workin and the vid tuned out quite good. but i have 3 little "problems" now. i would like to crop and resize also in the avs file. the script looks like this:
setmemorymax(512)
import("D:\...\restore24.avs")
LoadPlugin("D:\...\masktools.dll")
LoadPlugin("D:\...\tdeint.dll")
LoadPlugin("D:\...\leakkerneldeint.dll")
LoadPlugin("D:\...\dgdecode.dll")
LoadPlugin("D:\...\avisynth_c.dll")
LoadCPlugin("D:\...\smartdecimate.dll")
LoadCPlugin("D:\...\ibob.dll")
mpeg2source("G:\...\test.d2v")
a2=r24kernelbob(0)
b2=TDeint(mode=1,tryweave=false)
restore24(a2, b2)
when i add a crop and resize line the output gets fucked up so i used the vdub filters for now. actually im doing this for a friend that needs help cause hes a much bigger noob than i am and i want to use the avs for crop and resize so i dont have to explain to him how he do that in vdub. it was already hard enough to explain him how to encode everything. anyway if it isnt possible with the avs then its ok. i just wanna go sure maybe there is a way.
the 3rd problem i have is the speed during the encoding. i tried the other examples that are written in the r24-example.avs file but the faster it gets the more blends are left in the video. i already saw some other methods for the a and b part but how do i come up with different ways? i dont even understand what the deint and kernelbob does. it would be nice if someone makes a detailed restore24 guide or at least post some links to one.
i sent a pm to scharfi few days ago in the hope to get some direct help (i dont like forums very much i prefere a more direct communication) but i guess if he does that everyone starts sending pms to him for help. anyway if some of you are interested, a part of the vob file is here -> http://null4.free.fr/VTS_01_1.VOB
sorry but somehow the buttons to format the text arent working (damn scriptblocking firewall ><)
im not sure if restore24 is the best way to fix that movie but its the one with the best result till now. i would be grateful if someone could take a look at it and may find a faster solution.
MOmonster
25th September 2005, 16:22
@Drossel
How good the blenddetection is depends on the a2 clip. Use the newest leakkerneldeint (no speedbug). For your anime you should set tryweave=true. I don´t know why cropping and resizing doesn´t work. You could also just crop and resize the b2 clip directly (b2=tdeint(mode=1,type=3,tryweave=true).crop(xxx).lanczosresize(xxx)).
If the current rstore24 is too slow for you, why not trying my Crestore_film (seems to catch most of the blends)? Also restore24 don´t like the mixed 12 and 24fps of such animes like yours. So or so I would set tdeint tryweave=true.
Drossel
25th September 2005, 20:15
strange... now crop and resize works fine... and i didnt change anything *sigh* i hate computers.
what is different when i set it to true and what does the type=3 do? nothing i guess the error message says it must be 0, 1 or 2 ><
where can i download the latest leakkerneldeint and the crestore_film? hmm many germans in this forum... could you pm me your icq number?
MacAddict
15th November 2005, 01:52
Lots of field blending scripts floating around the forum for years. Is it safe to say R24 is still state of the art for killing field blends like isn many Asian type films? Thx to all who contributed!
krieger2005
15th November 2005, 02:41
I think R24 and the C_Package by MOmonster is till now "state of the art". But in general all peaple say, that trying give you the better answer... If this both does not help you can try something what is not "state of the art" :)
rcjc
6th December 2005, 12:34
hi, been having trouble getting restore24 to work on my new AMD64 X2. Seems to work fine with the same settings/files on the Sempron. On the AMD64 i get "avisynth open failure" Loadplugin: unable to load masktools.dll.
any reason why this might be? I've tried avisynth 255 and 256, masktools.dll 151 and 155.
Chainmax
6th December 2005, 13:25
Didée, what's the status on the new R24?
levi
6th January 2006, 04:06
hi, been having trouble getting restore24 to work on my new AMD64 X2. Seems to work fine with the same settings/files on the Sempron. On the AMD64 i get "avisynth open failure" Loadplugin: unable to load masktools.dll.
any reason why this might be? I've tried avisynth 255 and 256, masktools.dll 151 and 155.
I had problems on 64 bit too. Mine is Intel Dual Core. Here is what I did to get it working:
Updated dlls to latest versions:
http://bengal.missouri.edu/~kes25c/TIVTCv1b7.zip
http://bengal.missouri.edu/~kes25c/TDeintv1RC2.zip
http://www.leoagricola.net:8888/~kp/AviSynth/LeakKernelDeint/LeakKernelDeint_1.5.4.zip
http://manao4.free.fr/MaskTools-v1.5.8.zip
Replace the following in restore24.avs (using avisynth 2.5.6)
####### WEAKEN STATIC PARTS, BIAS TO MOTION ######
global edge_p2_dark_n = YV12layer(edge_p2, edge_p1.invert(),"mul",chroma=false)
global edge_p1_dark_p = YV12layer(edge_p1, edge_p2.invert(),"mul",chroma=false)
with
####### WEAKEN STATIC PARTS, BIAS TO MOTION ######
global edge_p2_dark_n = YV12Lutxy(edge_p2, edge_p1.invert(),"mul")
global edge_p1_dark_p = YV12Lutxy(edge_p1, edge_p2.invert(),"mul")
nls
23rd January 2006, 11:48
I've been using restore24 for quite some time now for various anime encodes that I frequently capture from TV. It does a great job on all the bad fieldblended material I us e it on. However, I recently had to reinstall my Win XP SP2 and noticed a slowdown of about 2.
That means that the same AVS script I used to make the encode slows down from about 2 hrs to about 5h 30m, which is a lot, considering the length of the clip which is ~24 mins. [...]
EDIT: disregard the above, I've found the problem. I accidentally deleted an AssumeTFF() line, which, when put back, brought back the 'old' speed. Altough it's strange tho how this can cause such a slowdown.
Elic
23rd January 2006, 23:19
I'm sorry for possibly stupid question, but my English is not as good as I would want :) and there is so much info around... My question is: where can I get this magic restore24.avs and mini-HOWTO about it? Help!
Didée
24th January 2006, 13:12
@ nls:
Ah, good you found it. I was about to post "sorry, no clue" ... seems like one of the bobbers became much slower when fed with a clip flagged with wrong fieldorder.
@ Elic:
Oha, it seems there's some slight problem with the database of the Gleitz forum. The attachment is still listed, but I can't load it, too.
I've put up the last official version here: restore24_01102004.rar (http://home.arcor.de/dhanselmann/_stuff/restore24_01102004.rar). (the package of scharfis_brain)
A yet unfinished version of the "new" Restore24 is to find in this RAR (http://home.arcor.de/dhanselmann/_stuff/LostSwordship_test_scripts.rar).
Problems:
- the latest official version is so old that I'm not sure if it's still to recommend.
- the new one is only half-finished (or half-broken), not documented/supported, and needs some other plugins than the old version.
25i (blended) -> 24p apparently works rather nicely, any other conversions may work or may be totally broken ... I've no clue :)
***
Oh, and a serious correction of levi:
Replace the following in restore24.avs (using avisynth 2.5.6)
####### WEAKEN STATIC PARTS, BIAS TO MOTION ######
global edge_p2_dark_n = YV12layer(edge_p2, edge_p1.invert(),"mul",chroma=false)
global edge_p1_dark_p = YV12layer(edge_p1, edge_p2.invert(),"mul",chroma=false)
with
####### WEAKEN STATIC PARTS, BIAS TO MOTION ######
global edge_p2_dark_n = YV12Lutxy(edge_p2, edge_p1.invert(),"mul")
global edge_p1_dark_p = YV12Lutxy(edge_p1, edge_p2.invert(),"mul")
I hope that nobody did this! It won't throw any error, but will turn Restore24 into a fully infunctional joke! (It will output a 100% random mix of clean and blended frames!)
If at all, it has to be
####### WEAKEN STATIC PARTS, BIAS TO MOTION ######
global edge_p2_dark_n = YV12Lutxy(edge_p2, edge_p1.invert(),"x y * 255 /")
global edge_p1_dark_p = YV12Lutxy(edge_p1, edge_p2.invert(),"x y * 255 /")
bkman
24th January 2006, 14:40
I've put Didée's new version along with everything it needs in one pack here (http://members.optusnet.com.au/bdkon01/Restore24.7z).
Just extract AvsRecursion.dll to your WINDOWS\System32 dir, and use import("...\Restore24\Restore24.avs") in your scripts after extracting the rest somewhere.
There is documentation on the usage inside the .avs itself.
Note: This pack is not supported by Didée, and may not work correctly (but it works for me). ;)
Chainmax
24th January 2006, 16:37
A yet unfinished version of the "new" Restore24 is to find in this RAR (http://home.arcor.de/dhanselmann/_stuff/LostSwordship_test_scripts.rar).
...
- the new one is only half-finished (or half-broken), not documented/supported, and needs some other plugins than the old version.
Is TIVTC still not a match for SmartDecimate? If so, why?
levi
24th January 2006, 19:29
I hope that nobody did this! It won't throw any error, but will turn Restore24 into a fully infunctional joke! (It will output a 100% random mix of clean and blended frames!)
Ah, Thanks for the correction. I can confirm this is exatly what happened ;)
Didée
25th January 2006, 13:11
Is TIVTC still not a match for SmartDecimate? If so, why?
Well, TDecimate is available for usage in the new version. Currently, it's even the default Decimator. However ...
There are indeed problems, and they are tricky & not easy to resolve ... and it's a matter of the plugins, there's nothing I could do about.
The problems start with (heavily) using Avisynth's conditional environment, and are somehow related to caching ... and this is what most decimators do in one way or another.
Honestly, I don't understand the problem deep enough to really explain it ... but I can give you the *results* of what happens when the output of R24's inner core (-> the bobbed stream where all blends are replaced by non-blended duplicates) is fed into different decimators:
- FDecimate: it just doesn't work together with Restore24. Result is unusable.
- Decimate: seems to work technically, but its functionality is too restricted (only n-in-m decimation).
- TDecimate(mode=2, 1-pass): caching issues, caused by read-ahead. Results in at least one jerk every 1000 frames, often worse.
- TDecimate(mode=7): mostly works very good. BUT: if there has been a cut in the stream (i.e. commercial break, or already included in the source for some reason), there is big danger that the result from that very point on, until EOF, is fully unusable.
And, the last contestant:
- SmartDecimate: it just does the job.
The only problem with SmartDecimate is to get it working at all. It seemed like it couldn't be used at all, when recent versions of Avisynth (newer than Dec.2004 / early Jan.2005) are used. But I found that it works when [input for] and [output of] SmartDecimate are manually buffered by means of FrameCache() included in WarpSharp.dll.
What should also work is 2-pass processing with TDecimate(mode=2), preferably together with creating an intermediate lossless file. If you really want to have it like that ...
foxyshadis
25th January 2006, 13:57
2-pass does have the same issues. Tritical said he'll probably fix TDecimate for perfectly linear reads, since I pointed out its effect on conditionals as a problem.... Not sure when though. (Bug him. ;p) But hey, SD works, can't argue with that.
It's too bad you can't insert some kind of drop frame instead of a duplicate, something like colorbars, that would be entirely unambiguous to a function scanning for that frame's signature. Well, I guess you could if a filter existed to do the scanning & dropping.
Didée
25th January 2006, 14:23
The first part is no problem at all, sure. In a modified manner, I already do so ... that's what the helper trick "LL=true" does. It adds a border to the bobbed input, alternating black / white. Each time a blend is detected, the replacement frame gets a border with the current color, and the color gets switched over. (This gives a nicely working "guidance" for SmartDecimate.)
Could be easily modified to unikely replace full frames if they're judged as being a blend. It's the further handling I don't want to think about ...
Plus there's another point: in scenes with very small motion, the whole blenddetection thing becomes very unreliable, no matter how you do it. However, errors still might be easily spotted by human's eye. (Natural video is much less forgiving in this respect, compared to animation.)
For those situations, it's preferable to have the decimator working on all frames, with only a slight guidance given as done now. This way, chances are better that the decimator manages to smoothen out in those places where the blenddetection went wrong. At least these are my testing experiences so far.
tritical
25th January 2006, 22:02
The whole problem with complex conditional filtering that keeps/tracks local variables (like restore24) is that it will get screwed up if every frame is not requested in linear order. FDecimate doesn't request every frame from the input stream, so there is no way it would work with restore24 (but it could be modified to work). TDecimate() w/ m-in-n decimation (or mode=2 w/ 1 pass) requests every frame from the input stream, but it does it in cycles. So when the filter after tdecimate requests the first frame from a new cycle, tdecimate will request and process the full cycle worth of frames, then it decides which frames to drop from that cycle. When the downstream filter begins requesting the other frames, tdecimate will start re-requesting the needed frames. This method will still work with restore24 as long as every frame in the cycle remains cached (i.e. the re-requested frames don't have to be reprocessed by the filter chain before tdecimate), however if any of the frames aren't cached (due to memory restrictions or what not) then it will screw up. TDecimate(mode=2) on a second pass doesn't request every frame from the input stream, but only the ones that aren't being decimated since it calculates everything at the very beginning... so that would not work with restore24 (but it could be modified to work). Finally, TDecimate mode=7 and smartdecimate (depends on the ratio) both request every frame from the input stream and do so in a linear order. They also don't work on cycles but only a couple frames so they work nicely in the conditional environment.
@Didée
If you've got a sample (or a way to make one) that shows the problem with TDecimate's mode 7 I'd definitely take a look.
3ngel
26th January 2006, 16:28
@BkMan
I've put Didée's new version along with everything it needs in one pack here
I suggest you to include in the package even:
MSVCP71.DLL
msvcr71.dll
for those system (like mine) that doesn't have it in sys32 folder.
These two libraries are used by RemoveGrain.
And replace possibly your LoadPluginEx.dll with a newest one. The one included in the package is bugged on my side (i had to replace it).
levi
24th April 2006, 05:33
I've put Didée's new version along with everything it needs in one pack here (http://members.optusnet.com.au/bdkon01/Restore24.7z)..
Another thing I noticed is this pack does not include repair dll which can be found here (http://www.removegrain.de.tf/)
Everytime I have ugly field blended source I turn to Restore24. I have some amazing results!! (See Attached) Here is what settings I used with this latest Restore24. Restore24(numr=24,deno=60,useLL=true,r24deint=4,r24deintth=0,fra=1,frr=1,edgetype=0,r24size=.75,nr=-5,ldmp=32.0)
Honestly, I think nothing else so far can come close to this. Thanks For The Superb Script :)
Didée, is there a final in our near future?
Can someone help me, cuz I'm going absolutely nuts here. I know it's probably something very simple (like myself), but I've been trying to use Restore24, in its many guises, for the last few days and I'm getting nowhere fast...
My current script looks like:
import("...\Functions\Restore24\Restore24.avs") # v1.0 RC1
import("...\Functions\TomsBob.avs")
import("...\Functions\R24kernelbob.avs")
loadplugin("C:\Program Files\AviSynth 2.5\plugins\dgdecode.dll") # DGIndex 1.4.6
loadplugin("...\Functions\Restore24\LoadPluginEx.dll")
loadplugin("...\Functions\Restore24\removegrain.dll")
loadplugin("...\Functions\Restore24\ReduceFlicker.dll")
loadplugin("...\Functions\Restore24\WarpSharp.dll")
loadplugin("...\Functions\Restore24\LeakKernelDeint.dll") # 1.5.4.0
loadplugin("...\Functions\Restore24\MaskTools.dll") # 1.5.1.0
loadplugin("...\Functions\Restore24\avisynth_c.dll")
loadplugin("...\Functions\Restore24\tivtc.dll") # 1.0.0.0
loadplugin("...\Functions\Restore24\tdeint.dll") # 1.0.0.0 RC2
loadCplugin("...\Functions\Restore24\smartdecimate.dll")
loadCplugin("C:\Program Files\AviSynth 2.5\plugins\IBob.dll")
mpeg2source("...\Advent Children\adventchildren.d2v",cpu=4,iPP=true)
AssumeTFF()
a2=r24kernelbob(0)
a0=ibob()
b2=tdeint(mode=1,type=2,tryweave=true,full=false)
b1=r24kernelbob(7)
b0=a0
restore24(a2, b2)
I downloaded the AvsRecursion.dll and placed it in my System32 dir as suggested.
All I keep getting is...
invalid arguments to function "restore24"
... which then points to the last line of the script. If I leave out a2 and/or b2 from the last line, then the script loads, but obviously not how it's supposed to.
I've tried using Restore24 v0.4c, but I wasn't really getting anywhere fast with that either. I've actually tried so many different versions of the scripts now that I just don't know what I'm doing or what to try next...
I got the TomsBob and R24kernelbob functions from here (http://forum.doom9.org/showthread.php?p=487203#post487203)
I know I'm bound to have missed out some needed info, but my head's in a bit of a spin at the moment, so let me know if you need any more details.
edit: ...... anyone?
Alain2
4th August 2006, 01:27
Is there any reason why restore24 gives me good results with avisynth 2.5.5, but not with 2.5.6 or latest 2.5.7 ? I never understood that.. I have been with 2.5.6 for a long time now (especially for its enhanced directshowsource) but I need restore24 on a dvd z2 animation I have, and I can't make use of restore24 under 2.5.6. And all my plugins folder (especially recent / more useful ones) are not 2.5.5 friendly :(
I tried Mrestore as well but I have some strange behaviour : global variables that are also defined parameters of a function are not usable outside the conditional filter environment for some reason for me, so for instance the first line global profile = default(profile,1) is not working for me, profile becomes something that none of the is??? functions recognize; however if I do put a profile when calling the function that's ok. I modified the code accordingly so that it works for me, but i don't get as good results as with avisynth255+restore24...
foxyshadis
4th August 2006, 02:28
You can't redefine a variable as global (or at least weirdnesses happen), you have to come up with a new name for it, like global gprofile = default(profile,1), then it should work inside and out.
Are there any specific errors under avisynth 2.5.6+? Or does it just fail to give useful results?
Alain2
4th August 2006, 09:20
Well I noticed the weirdness for mrestore ; here are some tests I did:
mpeg2source("mov.d2v",idct=7)
crop(0,0,200,20)
stackvertical(test_a().addborders(0,0,0,2),
\ test_b().addborders(0,0,0,2),
\ test_c())
Function test_a(clip c, int "var"){
global var = default(var, 1)
return c.subtitle(string(isInt(var))+", -= "+string(var)+" =-")
}
Function test_b(clip c){
global var = default(var, 1)
return c.subtitle(string(isInt(var))+", -= "+string(var)+" =-")
}
Function test_c(clip c, int "var"){
var = default(var, 1)
return c.subtitle(string(isInt(var))+", -= "+string(var)+" =-")
}
and the result:http://img218.imageshack.us/img218/3415/tempci4.jpg
For restore24, it removes blends in avisynth 255 very well, whereas in 256+ it doesn't remove them / is much less efficient at it. So yes for me it fails to give useful results. I tried as well the new rc1 version on 256+ but don't get useful results either. I didn't try rc1 on 255 yet though.
Didée
6th August 2006, 20:05
The old Restore24 (the one linked in this thread) most likely will produce nothing useful under any Avisynth version newer than December 2004. For the "why", don't ask me. It might be the dreadful frame caching problem of [conditional environment] + [decimator], or it might be something other. With a debug version of R24, I once found out that, under particular circumstances, some of the internal variables just stay at "0" (zero), instead of getting the values that are calculated within the script ...
The better news is, the (inofficial & unfinished) new Restore24 should work correctly with recent versions of Avisynth. Have a look at this post (http://forum.doom9.org/showthread.php?p=774197#post774197).
canuckerfan
16th September 2006, 08:06
I'm trying to restore an old movie that I have. The source is quite bad: 29.97 fps, telecined improperly, and blended as well. I've got some samples posted on this page: http://forum.doom9.org/showthread.php?t=115044showpost=20
I was wondering what would be a good script for unblending, deinterlacing (returning as many progressive frames as possible), and restoring the frame-rate to 23.976/24? I hope that made sense, lol. Any advise is appreciated.
PS: I forgot to mention that it would be nice preserve the audio track for this, any chance it can be done w/o causing synch issues?
LogicDeLuxe
20th September 2006, 19:33
On some Neon Genesis Evangelion Platinum Episodes, the result stucks once every half second. Episode 18 is one of them. I suspect it is telicined film just blended to 50i resulting in a quite chaotic weighting of the individual frames like this: http://home.arcor.de/scharfis_brain/ExotischesInterlacing/#2.3.3
Other episodes like episode 23 seem to be blendet from real 24p material like this: http://home.arcor.de/scharfis_brain/ExotischesInterlacing/#2.2.2
They work a lot better with restore 24. Not perfect, but without annoying jerkinessat least.
This is a snippet from the orgiginal: http://rapidshare.de/files/33817788/nge18original.m2v.html
And this is what I get from restore24: http://rapidshare.de/files/33818050/nge18r24ed.m2v.html
Any chance to get this one working?
MBoufleur
17th October 2006, 22:55
Hi there,
It also took me a while reading the thread an finding out the right way to use the latest version (http://forum.doom9.org/showthread.php?p=774197#post774197) of Restore24...
The AVS file I'using right now is as below:
import("D:\Testes\Restore24\Restore24\restore24.avs")
AVISource("D:\Testes\Brice_PullDown.avi")
trim(1387,2134)
ConvertToYV12 #Only converting because of MaskTools. Original is RGB32
Restore24(r24fps=25.000,numr=2500,deno=5994,useLL=true,stringuent=false,fulltriples=false, r24deint=1,fra=1,frr=1,edgetype=0,edgemode=2,edgeeval=2,r24size=.75,r24ysize=0.75,nr=-5,ldmp=32.0,debug=0)
# crappy downsize & NR to produce a quick sample
# bicubicresize(704,384)
# yv12lutxy(last,last.clense(),"x 2 + y < x 2 + x 2 - y > x 2 - y ? ?",U=2,V=2)
# bicubicresize(640,336)
return( last )
So as you can see, the source file is NTSC, transcoded from 25fps source. I used both the first version (http://forum.doom9.org/showthread.php?p=485016#post485016) of Restore24, as well as the latest one to compare results (and it sure seems to be getting better!! :))
Unfortunatelly, the results don't seem to be perfect, and I still get some blended frames. From SeparateFields in AVISynth, I found this pattern (http://forum.doom9.org/attachment.php?attachmentid=6267&stc=1&d=1161046779), which I'm not sure if is standard transcode, but it sure does the job of getting 6 frames outta 5 (without two blended fields in the same frame).
Is there a better way to improve Field matching for Restore24 in this case, or perhaps my case is one of those nasty motion compensated softwares that did their trick in the video?
Didée
18th October 2006, 12:18
If that is the pattern, it seems pretty "regular". Exactly what is to expect in this case.
The whole matter is tricky, and (25p->30i/b)->25p in particular. Point is, the raw blend detection never is 100% reliable. For that reason, R24 uses a (simple) pattern mechanism to be more robust against false blend detection and missed blend detection. But this improves mostly the standard case (24p->30i/b)->24p, because this one shows a long, uniform pattern, with phase changing only twice per second. The pattern of the 25p case is rather short, with phase changing 10 times per second. The main problem R24 has with these short patterns, is this: with just one blended field not reckognized, the "neighborhood" of the field in question often looks the very same for both blended or not-blended fields, throwing the pattern mechanism totally off ... that's where the pattern mechanism even might be contra productive.
I tried a lot of things to get more reliability for conversions with short pattern lengths. Most of them showed potential, but none of them were really usable. (Anyone knows the english term for "Das Kind mit dem Bade ausschütten"? )
edit: seems like the same wording is used: "to throw out the baby with the bath water") ;)
In short: ;)
For the time being, I've no solution. Setting "useLL=false" *might* improve in this case, but it's not guaranteed.
You should also try MOmonster's various XY-Restore scripts, perhaps one of them deals better with the problem. :)
manono
18th October 2006, 16:21
And you can also try out that old standby, RePAL.
outsiders71
10th November 2006, 06:26
Hi there,
It also took me a while reading the thread an finding out the right way to use the latest version (http://forum.doom9.org/showthread.php?p=774197#post774197) of Restore24...
The AVS file I'using right now is as below:
import("D:\Testes\Restore24\Restore24\restore24.avs")
AVISource("D:\Testes\Brice_PullDown.avi")
trim(1387,2134)
ConvertToYV12 #Only converting because of MaskTools. Original is RGB32
Restore24(r24fps=25.000,numr=2500,deno=5994,useLL=true,stringuent=false,fulltriples=false, r24deint=1,fra=1,frr=1,edgetype=0,edgemode=2,edgeeval=2,r24size=.75,r24ysize=0.75,nr=-5,ldmp=32.0,debug=0)
# crappy downsize & NR to produce a quick sample
# bicubicresize(704,384)
# yv12lutxy(last,last.clense(),"x 2 + y < x 2 + x 2 - y > x 2 - y ? ?",U=2,V=2)
# bicubicresize(640,336)
return( last )
So as you can see, the source file is NTSC, transcoded from 25fps source. I used both the first version (http://forum.doom9.org/showthread.php?p=485016#post485016) of Restore24, as well as the latest one to compare results (and it sure seems to be getting better!! :))
Unfortunatelly, the results don't seem to be perfect, and I still get some blended frames. From SeparateFields in AVISynth, I found this pattern (http://forum.doom9.org/attachment.php?attachmentid=6267&stc=1&d=1161046779), which I'm not sure if is standard transcode, but it sure does the job of getting 6 frames outta 5 (without two blended fields in the same frame).
Is there a better way to improve Field matching for Restore24 in this case, or perhaps my case is one of those nasty motion compensated softwares that did their trick in the video?
Hi, could you please explain to me how you got those arguments? I read the avs file and have no clue how to get what I want done.
I have a SONY DV AVI Telecined to 29.97fps. I want to use Restore24 to get 24fps (FILM). What is the correct command line? Also can I use restore24 with x264?
manono
10th November 2006, 09:20
Hi-
I have a SONY DV AVI Telecined to 29.97fps. I want to use Restore24 to get 24fps (FILM).
Ordinarily you use a simple IVTC filter to restore the framerate to 23.976fps. Do you really need Restore24 for this? Do you have evidence of blended fields? If you're not sure, then maybe post a small sample with movement.
outsiders71
11th November 2006, 04:50
Not sure. The footage I have comes from multiple recording cameras (or angles if you will). There's a possibility that they are on different telecine cycles. What do you suggest? Thanks.
manono
11th November 2006, 11:22
There's also the possibility that it's pure interlace, and can be neither IVTC'd nor Restore24'd. What do I suggest? The same thing I suggested the last time. Upload a section for us to have a look. If you're not sure where, upload it to:
http://rapidshare.de/
and when done, post the link it gives you.
jmac698
16th November 2006, 07:03
I tried restore24 rc1, had a lot of problems getting it to work, I can't seem to use smartdecimate or repair, so I removed/replaced them. It still gave blurred frames and was extremely slow.
I tried loadcplugin, loadplugin, and loadpluginex on smartdecimate but it always says no function smartdecimate.
Livesms
18th November 2006, 21:44
I've got a problem.
Can you help me to solve it...
http://forum.doom9.org/showthread.php?p=901936#post901936
Didée
21st November 2006, 12:09
@ Livesms
vBulletin Message:
Livesms has chosen not to receive private messages or may not be allowed to receive private messages. Therefore you may not send your message to him/her.
PM box full, personal settings wrongly configured, or intended?
Livesms
21st November 2006, 12:39
@ Livesms
PM box full, personal settings wrongly configured, or intended?
Sorry - I've made mistake checking "Receive Private Messages only from Buddies and Moderators"
Now You can send me PM.
chipzoller
7th January 2007, 16:05
I've put up a link to a source with horrible blended fields for anyone interested in testing this script out. If this (or any script) can restore this back to original film rate then it'll work on anything:
http://www.megaupload.com/?d=VGG1CUY7
(1980's anime FILM->NTSC->blended fields down to PAL)
elguaxo
16th January 2007, 13:10
I want to use MCBob with Restore24. The description of the r24deint paramater says:
# 0 - user defined bob (must be handed over via "renderbob" clip parameter)
but I can't figure out how to do it. Could someone post a sample? Thanks!
Didée
16th January 2007, 13:27
Basically:
vid = XYZSource()
mybob = vid.WhateverBob()
Restore24(vid, r24deint=0, renderbob=mybob, [...other.parameters...] )
However, you (probably) won't have much fun with MCBob in this case:
Motion compensated bobbing is badly suited for fieldblended video.
elguaxo
16th January 2007, 13:31
The renderbob parameter is really easy. :p
Thanks for the motion compensated bobbing tip!
Warpman
12th February 2007, 00:10
i have avisynth 2.57 and i can´t get restore24 to work... i get always a
CAVIstreamsync system exeption - access violation at 0x0 ...
i have a empty plugin folder and trying the basic example script
import("restore24.avs")
loadplugin("plugins\masktools.dll")
loadplugin("plugins\tdeint.dll")
loadplugin("plugins\leakkerneldeint.dll")
loadplugin("C:\Programme\AviSynth 2.5\backup_autoload\dgdecode.dll") #or mpeg2dec3.dll
loadplugin("plugins\avisynth_c.dll")
loadCplugin("plugins\f3\smartdecimate.dll")
loadCplugin("plugins\ibob.dll")
mpeg2source("G:\VTS_01_1.d2v",cpu=4,iPP=true)
a2=r24kernelbob(0)
b2=TDeint(mode=1,tryweave=false)
restore24(a2, b2)
theinv
22nd March 2007, 22:48
i have avisynth 2.57 and i can´t get restore24 to work... i get always a
CAVIstreamsync system exeption - access violation at 0x0 ...
i have a empty plugin folder and trying the basic example script
import("restore24.avs")
loadplugin("plugins\masktools.dll")
loadplugin("plugins\tdeint.dll")
loadplugin("plugins\leakkerneldeint.dll")
loadplugin("C:\Programme\AviSynth 2.5\backup_autoload\dgdecode.dll") #or mpeg2dec3.dll
loadplugin("plugins\avisynth_c.dll")
loadCplugin("plugins\f3\smartdecimate.dll")
loadCplugin("plugins\ibob.dll")
mpeg2source("G:\VTS_01_1.d2v",cpu=4,iPP=true)
a2=r24kernelbob(0)
b2=TDeint(mode=1,tryweave=false)
restore24(a2, b2)
I got same problem.....
Pookie
22nd March 2007, 23:30
Maybe find an Avisynth 2.56 Dll and put it in the same folder as your script?
foxyshadis
23rd March 2007, 06:50
avisynth_c.dll -> bad idea. avisynth has C loaders built into loadplugin now, with bugfixes. That's probably not what's corrupting avisynth's memory though.
The avisynth.dll has to be in the same folder as the application, btw, not the script, to override the default.
ideas_man69
9th April 2007, 04:07
hey guys.. this is the first time i've used restore24 and am *almost* happy with its output. just wondering if someone here could give me some tips on how to perfect this output...
here's my untouched vob file on the left, and just de-interlaced on the right (using virtualdub just to show the problem).
http://members.optusnet.com.au/ideas_man69/mine2.JPG
this is what i've got by using this script:
import("C:\Program Files\AviSynth 2.5\restore24.avs")
loadplugin("C:\Program Files\AviSynth 2.5\plugins\dgdecode.dll")
loadplugin("C:\Program Files\AviSynth 2.5\plugins\leakkerneldeint.dll")
loadcplugin("C:\Program Files\AviSynth 2.5\plugins\smartdecimate.dll")
mpeg2source("vts_1.d2v")
a2=r24kernelbob(0)
b2=TDeint(mode=1,tryweave=false)
restore24(a2, b2)
http://members.optusnet.com.au/ideas_man69/mine3.JPG
any helps or tips would be great. not sure if there's any other filters i can use to clean up the image a bit more? when i play it in media player classic it goes *very* slow on my e6600 cpu, is this normal?
i can up a part of the original vid if it helps..
thanks in advance
Didée
9th April 2007, 15:14
The problem with that show is that these artefacts infact are part of the source, so none of the restore-from-fieldblending scripts will do that on their own.
I vaguely remember that this problem has been discussed before, and that MOmonster once had built a custom filter chain, based on his MRestore script (or a predecessor), to also clean up those artefacts.
Could've been here, or it could have been on the German Gleitz (http://forum.gleitz.info/) forum - can't remember on which one it was. Happy Searching. ;)
~bT~
23rd April 2007, 15:06
Does anyone have a direct link to the filter chain by MOmonster that Didee is talking about.
I've tried searching but to no avail.
Thanks in advance!
Warpman
24th April 2007, 20:33
avisynth_c.dll -> bad idea. avisynth has C loaders built into loadplugin now, with bugfixes. That's probably not what's corrupting avisynth's memory though.
The avisynth.dll has to be in the same folder as the application, btw, not the script, to override the default.
thx for pointing that out but
im unable to load c plugin smartdecimate.dll, regardless what i try...
someone got it to work in avisynth 2.57?
import("restore24.avs")
loadplugin("plugins\masktools.dll")
loadplugin("plugins\tdeint.dll")
loadplugin("plugins\leakkerneldeint.dll")
LoadCPlugin("SmartDecimate.dll")
LoadCPlugin("plugins\ibob.dll")
mpeg2source("G:\VIDEO_TS\epi4.d2v",cpu=4,iPP=true)
assumefps(25,1)
a2=r24kernelbob(0)
b2=TDeint(mode=1,tryweave=false)
restore24(a2, b2)
any hints? :(
Boulder
24th April 2007, 20:46
What Restore24 version do you use? Do you use the version linked by Didée in this post : http://forum.doom9.org/showthread.php?p=774148#post774148
foxyshadis
24th April 2007, 22:02
Version of smartdecimate that works in 2.57: http://forum.doom9.org/showthread.php?p=897598#post897598
We just have to get Tritical and Warpenterprises to update their respective pages. :p
allajunaki
24th April 2007, 23:08
Does anyone have a direct link to the filter chain by MOmonster that Didee is talking about.
I've tried searching but to no avail.
Thanks in advance!
i think u are asking for Mrestore.
u can find it here http://forum.doom9.org/showthread.php?t=103940&highlight=Cdeblend
~bT~
24th April 2007, 23:31
^ thanks but i think Didee is talking about some modified version.
jeffy
24th February 2008, 09:33
@scharfis_brain
hi!
just a few questions concerning the latest restore24 package (2004-jan-08):
1. why didn't you include masktools 1.5.6 instead of 1.4.16? is it buggy, or is 1.4.16 better for the purpose of restore24?
2. is it OK to replace leakkerneldeint 1.5.3 with 1.5.4 (some speed improvement) and tdeint 0.9.6 with 0.9.7?
3. a few posts above you stated, that because of a bug in smartdecimate: "trim the video down to max. 179111 Frames (nearly two hours of video)," but in the restore24's readme it's written: "you cannot process Videos longer than about 50 minutes," so which one is correct? the movie i'm trying to encode now is only about 90 minutes long, so it would be more convenient not to split it during processing;-)
thanks!
dp
1) I included the older version of masktools, because the newer ones no longer contain YV12layer()
2) it is okay
3) NO way around this misbehaviour.
you do only have the two choices which I offered in the documentation.
(cutting after 50mins, or setting decimation ratio to 24/50 instead of the default 23.976/50)
I am sorry for asking this question now, three years after your reply, but I can't find the reliable answer. When there was a new release of SmartDecimate in 2006, did tritical repair this bug or is it still limiting the length of the movie the way described above (50 minutes/179 111 frames)?
The question is for this restore24 version:
restore24_RC1_WIP.avs, located here:
http://home.arcor.de/dhanselmann/_stuff/LostSwordship_test_scripts.rar
:thanks:
ChuckUFarley
23rd April 2008, 08:18
I worked on a project using r24 to really nice results about a year ago.
Trying to use it again recently I ran into a problem with the RC1 version which I find produces better results.
Now that I suffered through it, here's what you need to get it to work:
Get the (nearly) all in one pack for the WIP/RC1 Restore24 here: http://members.optusnet.com.au/bdkon01/Restore24.7z
Get Repair here: http://home.pages.at/kassandro/RemoveGrain/RemoveGrain.zip (it also has removegrain again in the package).
For RemoveGrain and Repair make sure you have the S version as well as the one you plan to use. That is, for Repair you'll need RepairS.dll and one of the flavors of Repair.dll/RepairSSE2.dll/RepairSSE3.dll.
Make sure you put AVSRecursion.dll into your SYSTEM32 folder.
If you don't have msvcr71.dll in your System32 directory, Google it up and added it.
The new version of Restore24 works just fine as "Restore24()". I don't find much improvements making tweaks. Btw, I believe this version does not work for ANY other framerates except 25 to 23.976.
LoadPlugin("Restore24\RemoveGrain.dll")
LoadPlugin("Restore24\Repair.dll")
LoadPlugin("Restore24\reduceflicker.dll")
LoadPlugin("Restore24\MaskTools.dll")
LoadPlugin("Restore24\TDeint.dll")
LoadPlugin("Restore24\WarpSharp.dll")
LoadPlugin("Restore24\avisynth_c.dll")
LoadCPlugin("Restore24\SmartDecimate.dll")
import("Restore24\Restore24.avs")
mpeg2source("test.d2v",cpu=4,iPP=true)
restore24()
spline36resize(720,480) #Or your favorite resizer. This one is slower but produces less ringing than Lanczos4.
Improperly installed plugins will cause your system to grind to a crawl!
I wish someone was still developing this, it's really a very important filter with no real alternatives out there.
Zemph
30th April 2008, 15:58
Hey ChuckUFarley,
Registered on here to say that your above script 'Restore24' works alot more better on my sources than the original one in this thread. I got a horrible frame stutter/lagg on the original one, and your one works perfectly.
My source is a DVB-T (PDTV) PAL which was encoded from NTSC. Although there seems to be a couple niggles, say i guess its from kernelbob deinterlace within the avs.
What would you recommend for best results? I was thinking:
Deinterlace Mode = 4 (tdient)
edgetype = 2
edgemode = 2
edgeeval = 3
But i dont know much about 'Evaluation method:' tbh.
Cheers for the scripts though mate.
ChuckUFarley
1st May 2008, 15:56
It's not my script. It's their script. I just put out some easier to follow instructions.
As far as your other question... I don't know.
AnnaFan777
2nd May 2008, 16:45
Is there a way to use this plugin as to restore 25i from fieldblended 30i , such as many sports program
exported from europe to ntsc lands ?
ChuckUFarley
3rd May 2008, 06:06
You might want to try a search for rePAL.
I believe that does what you want.
hmm, how you said 'I wish someone was still developing this' how do you mean? as in is their actual improvements that could be done on this? Seems neat as is although using tdient will murder your machine to a crawl.
ChuckUFarley
7th May 2008, 09:40
Well, development only got as far as a WIP RC1.
That sounds unfinished to me.
IIRC there are still flaws that prevent it from being used for any other frame rate conversions than 25 to 23.976.
Also, I'm not 100% convinced on it's accuracy in picking clean fields over blended.
That said, it's still magical. :)
Zemph
10th May 2008, 19:44
ah true? well i still do thank you.. this filter does magic on my music videos, since ive always been trying to get it back to NTSC without re-encoding or 'do-it-yourself' avs scripts which turn out ugly.
This fixes much jurkyness & interlace artifacts than most deinterlaces i use. Good on ya for keeping it alive. Hope it does get continued, i will recommend this to other rippers :)
Cheeerz
xbox360
14th May 2008, 05:43
need help, I am getting this error: (how to fix it ?)
http://i129.photobucket.com/albums/p229/MartinJunior/restore24error.jpg
This is my script:
LoadPlugin("c:\Program Files (x86)\AviSynth 2.5\plugins\MaskTools.dll")
LoadPlugin("c:\Program Files (x86)\AviSynth 2.5\plugins\tdeint.dll")
LoadPlugin("c:\Program Files (x86)\AviSynth 2.5\plugins\leakkerneldeint.dll")
LoadPlugin("c:\Program Files (x86)\AviSynth 2.5\plugins\dgdecode.dll")
LoadPlugin("c:\Program Files (x86)\AviSynth 2.5\plugins\avisynth_c.dll")
LoadCPlugin("c:\Program Files (x86)\AviSynth 2.5\plugins\smartdecimate.dll")
LoadCPlugin("c:\Program Files (x86)\AviSynth 2.5\plugins\ibob.dll")
Import("c:\Program Files (x86)\AviSynth 2.5\plugins\restore24.avsi")
mpeg2source("D:\Encoding Stuff\4 munites - madonna feat justin timberlake.d2v",cpu=4,iPP=true)
ConvertToYV12
a2=r24kernelbob(0)
b2=TDeint(mode=1,tryweave=false)
restore24(a2, b2)
lanczosresize(720,480)
Boulder
14th May 2008, 05:59
If I remember correctly, YV12Layer is in MaskTools v1.5.x so download and install that plugin too.
http://manao4.free.fr/MaskTools.htm
xbox360
14th May 2008, 06:11
If I remember correctly, YV12Layer is in MaskTools v1.5.x so download and install that plugin too.
http://manao4.free.fr/MaskTools.htm
How do I install that plugin ? I really dont know !
Boulder
14th May 2008, 06:13
Just like any other plugin - extract the corresponding dll file from the package to your Avisynth plugins folder.
xbox360
14th May 2008, 06:16
It's not working, please someone help me !
Zemph
14th May 2008, 14:02
xbox360: The error is refering to the 'restore24.avsi' which is the one you import. not the one you posted.
xbox360
15th May 2008, 07:03
so how do I fix it ?
Didée
15th May 2008, 11:41
The version of Restore24 that uses YV12Layer is very outdated anyway. Reading through this thread, you'll find links to the RC1 version that doesn't need the (no more existing!) YV12Layer function ... you'll find it even on this very page, in post#166. :rolleyes:
Alternatively, try MRestore. It's much easier to get running.
BTW, if you're still after that TV capture with Madonna: that one is FUBAR anyway, no script in the world will help you with that.
ChuckUFarley
16th May 2008, 03:38
Mrestore? Details (and links) please.
My Google-ing turns up little more than the existence of a blend dependent avisynth script by that name. That's not very helpful.
jeffy
16th May 2008, 06:40
http://forum.doom9.org/showthread.php?t=95924&highlight=Mrestore
Its basic usage is simple (import the MRestore.avs beforehand):
MRestore()
DoctorM
29th June 2008, 22:20
Sooo. I'm trying something... different with Restore24 now.
I gave Mrestore a chance and it failed.
I have a HDTV broadcast, 720p @ 59.94fps. The source is 23.976 so every frame has 1 to 2 duplicates. The problem is after MANY of the cuts the first frame is pixellated and the second frame is clean.
A normal selectodd().decimate(5) gives 23.976 but it preferentially removes a duplicate frame, I want the crappier one removed.
And I thought pixellated=more edges=restore24's algorithm.
Finding the proper numerator and denominator was easy enough and I figure r24deint set to 0 would allow me to use a progressive source.
Error = Invalid arguments to function "duplicateframe".
Any ideas?
Mrestore was successful about 3/4 of the time and even then I had to set bf to -2 (which is suppose to try to return ALL blends).
Edit: Should this be a new thread?
Gavino
10th July 2008, 22:06
Am I right in thinking that the way Restore24 (and similar functions) works, accumulating information one frame at a time in global variables, it requires frames to be requested in linear order from start to finish?
Given the wonders it performs, then I guess that's not an unreasonable restriction (along with the obvious observation that it can only be called once per script). But what about something as simple as:
AviSource(...)
Restore24(...)
Trim(a, b) + Trim(c, d) + ...
Do the cuts upset its operation, or does it not matter?
Didée
10th July 2008, 22:34
Uh, IIIRC I never tried it that way round ... when cutting in a script with Restore24 (i.e. a capture with commercial breaks), I would cut before Restore24 is executed, not after.
Linear access is necessary, but cutting after R24 does not throw it off too seriously. What happens is that after such a cut the internal metric values (regarding the past frames) are no more valid, but they will build-up again during the first few frames after such a cut. So there might be a hickup or two during the first second after such a cut; after that, things should be in order again.
Gavino
10th July 2008, 22:57
It occurs to me you could detect a non-linear jump by keeping track of current_frame (after all, what does one more global variable matter among many ;)) and reset the metrics to their initial values on such a jump.
One other thing: have you ever considered rewriting it as a plugin? It could probably be written more cleanly that way and I'm sure it would speed it up considerably.
Didée
10th July 2008, 23:14
Detecting a jump should be possible indeed ... I'm not sure if I even was aware that something like a 'current_frame' variable existed, back at the time of writing Restore24 ...
But frankly, I like Restore24 at most when I don't have to touch it in any way. MRestore does a good job, too, and the more people bug MOmonster about something, the less they bug me. :D
Re-writing as a plugin is a possibility, but ... afaik there's not one single Avisynth plugin written by me, and there's a reason for that. Many, many years ago, I have sworn to never ever touch a compiler or use a programming language again (long story...) -- Avisynth scripting is already borderline, so let it be.
Gavino
10th July 2008, 23:32
MRestore does a good job, too, and the more people bug MOmonster about something, the less they bug me. :D
Well, my suggestion re current_frame could be applied to MRestore too. What do you think, MOmonster?
And (can't resist) you might both find something useful in my run-time plugin.
Re-writing as a plugin is a possibility, but ... Sounds like a challenge for someone with a lot of time and patience ... (not me, at the moment anyway :))
Anyway, thanks for all your great work on this and other things.
MOmonster
11th July 2008, 09:10
Not the right thread to bug me, or?:devil:
Some previous versions of mrestore had the current_frame question to detect these jumps. The last version use requestlinear to catch these cases (should be also possible with restore24). So there should be no problem with your script.
GRunT sounds really interesting. I will definetly have a look on it.
If mrestore will ever reach version 3.x, it will become a plugin. I allready promised that. But I'm really busy the most time, so I don´t know when or even if mrestore will reach this state.
hartford
1st August 2008, 03:16
You listed quite a few filters, but not the versions of them.
I've tried for 2 hours to get the right combination and I've failed.
If you would publish the versions, I'd be grateful.
jeffy
1st August 2008, 23:31
You listed quite a few filters, but not the versions of them.
I've tried for 2 hours to get the right combination and I've failed.
If you would publish the versions, I'd be grateful.
I'm sorry, but what versions? Versions of the filters (eg. with MD5 sums) for Restore24 or for MRestore? What have you tried and what version of AviSynth do you have?
hartford
27th January 2009, 05:21
Ok, from the beginning.
First version of 24Restore was published in May 2004. It has evolved to the point that I don't know what will work with updated versions of current filters.
I'm using Avisynth v2.5.7.0 dtd 30Dec06.
Original script of 24Restore gives an error when loading SmartDecimate.dll
I did try using later versions of Avisynth but it gave other problems not related.
I've had this vid for some time, looking for a solution. Guess I'll try Momonster's scripts.
I know, rather tardy, but I've been just too darn busy with real life ;)
Leinad4Mind
27th May 2009, 16:11
Hi there, I have made a script using restore24 and that works in AVSP, but when I import the avs script to megui and click on queue, it give me some error memory.
I have already try with
setmemorymax(340)
setmemorymax(512)
setmemorymax(1024)
setmemorymax(2048)
I have 4Gb (I think just 3Gbs are in used), and Windows (shit) Vista, and my machine it's a portable.
Any help?
The error says that the attempt to write/read in memory was protected... something like that
pbristow
21st November 2009, 15:23
Hi Didée et al! I'm trying to solve a specififc and fairly common problem with standards converted video. The source is a 24fps movie that was telecined to NTSC (3 fileds, 2 fields, 3 fields, 2 fields, ad infinitum), and has then been resized and/or blurred. The result is a recurring sequence of 3 pure frames from the original movie, then 2 blended frames. Trapped in these two blended frames is what I call the "unlucky" 4th frame from the original movie.
I've looked at all the so-called de-blenders I can find, and what they actually seem to do is not really de-blend, but simply throw away at least one of the blended frames. This results in a jerky effect as the unlucky frame is only ever seen blended with either the next or the previous frame. But it *is* possible to recover the "unlucky" frame from the blended pair in this specific case, by a weighted summation/averaging of the blurred pair and their neighbours, and I'm hoping to find either (a) a de-blender that already does this, or (b) one whose code is simple enough to understand that a novice such as I can hack it to do what's required. It seems to me if someone's already got a good technique for detecting blended frames, all I need to add is the following algorithm:
If current frame is blended, then:
- If next frame is also blended, then:
- - Output frame = Current + Next - ((previous + one after next) / 2 )
- Else: discard current frame
Else: output frame = Current
(For an example of successfully de-blending long sequences of 50/50 blends, see my journal entry at: http://pbristow.livejournal.com/554001.html. The case I'm addressing here - only 2 blended fields in each run - is actually much simpler and should give a very clean result.)
Looking at the options, the *old* version of restore24 is nice and easy to understand, and I reckon I could hack it OK, but of course it has problems with dependening on other, deprecated plugins. I tried to make sense of the latest restore24, but it has a bewildering number of state variables whose function isn't clear to me and probably isn't relevant to my case.
Any suggestions?
Didée
21st November 2009, 16:43
For that scenario Restore24 is not suited. Ask the crystal ball (http://forum.doom9.org/search.php) about "FixBlendIVTC". That one was made for exactly this case.
manono
21st November 2009, 16:44
SRestore and one of its predecessors, FixBlendIVTC (also included in the SRestore package), can already do what you're asking - take a telecined and blend deinterlaced 29.97fps video and unblend it to return it to 23.976fps (after you also decimate it).
I'm not sure why you call it standards converted video, as both the source and the result are NTSC.
Edit: Didée beat me to it. :)
pbristow
21st November 2009, 19:14
[SLAPS FOREHEAD] You know, I'd already downloaded and looked at that one, and somehow decided it wasn't what I needed. Perhaps it was the references to "doubleblends" in the documentation (what's the distinction between a doubleblend and singleblend, in this terminology?).
Anyway, after an "invalid mode 19" error and tracking down the right version of RemoveGrain to fix it (See
http://videoprocessing.11.forumer.com/viewtopic.php?t=97&start=0&postdays=0&postorder=asc&highlight=> )
... it works!
Thanks guys. =:o>
:)
dansrfe
30th March 2010, 05:57
I can't find an example with all the current parameters and how to use them correctly anywhere. I'm having a hard time collecting all the up-to-date filters needed to run restore24 and if the script itself has been updated.
Nightshiver
30th March 2010, 14:46
The script itself obviously hasn't, otherwise there would have been a post about it. What kind of source are you needing to use restore24 on? Srestore would probably do just as fine or better.
dansrfe
30th March 2010, 18:39
So going back to your response, is:
yadif(mode=1,order=1) #or any other smart bobber
srestore()
going to give the best result for fieldblended PAL?
2. How do I know if the Master for the disk was originally a PAL or NTSC for a PAL disk.
3. How can I properly find out if my PAL source is a clean 2:2 pulldown or fieldblended from NTSC or a fieldblend of 25->PAL?
4. (Same question as above for NTSC but 3:2 pulldown instead of 2:2 pulldown)
5. When do I use restore24 vs (somesmartbobber().srestore())
6. I have also seen that Telecide(post=0) can be used for some PAL sources where the field shifts slightly occasionally in the video.
7. What other methods exist to deinterlace/restore fieldblended NTSC or PAL sources that are the most current. What is the best mothod to remove 2:2 pulldown on PAL video assuming it is a "clean" pulldown.
8. Is whatever yadif(mode=1,order=1).srestore() outputs the "correct" framerate or is there some frame pattern I should check for to be certain that srestore is delivering the correct framerate.
Forgive me if I have improperly used any terminology. I'm still learning all of this :o
Nightshiver
31st March 2010, 01:10
For a better analysis, post a video sample.
dansrfe
31st March 2010, 02:01
Sample Link (http://www.sendspace.com/file/mb1795)
Don't know if this makes much difference but just for the heck of it i demuxed the audio of this PAL version of the movie I have and ran the audio simultaneously from a sync point with my NTSC version of this movie and it stayed in sync the whole time. So I guess that means the video of the PAL version does indeed go back to 23.976 (the NTSC source IVTC's properly) but since I only have this and another movie that I have purchased the NTSC and PAL versions, I don't think it's the most convienient method to find out lol
manono
31st March 2010, 04:05
...but since I only have this and another movie that I have purchased the NTSC and PAL versions, I don't think it's the most convienient method to find out lol
It's not, but in this case it's pretty proof positive that they used one of the several methods of converting from NTSC to PAL that keeps the length the same and the audio unchanged. And in this case:
yadif(mode=1,order=1) #or any other smart bobber
srestore()
does a decent job of it.
2. If there's something funky about it (repeated fields when the frames look interlaced, repeated frames, blended fields) then probably it was converted from NTSC in an unusual way (where the 'usual' way is by speeding it up to 25fps)
3. When the frames look interlaced, separating the fields and stepping through them is one way. Look for all clean or many blended fields.
...or a fieldblend of 25->PAL?
No such thing, as far as I know.
4. If there's 3:2 pulldown (either hard or soft), then an examination of the frames will show 3 progressive frames and 2 interlaced frames in every 5 frame sequence when looking at the interlaced 29.97fps video. If field blended PAL or Film to interlaced 29.97fps, an examination of the fields will show the blending.
5. You don't use Restore24. It was the tool several years ago but SRestore has far surpassed it. In my opinion.
6. Yes, if the video shows as interlaced but the fields are clean and duplicated, realigning the fields with a field matcher (Telecide from Decomb or TFM from TIVTC) can straighten them out again.
7. I mostly use RePAL for PAL2NTSC stuff or SRestore for all kinds of blends. Only for material that won't respond to one or the other do I use more exotic methods.
8. DVDs come in all kinds of 'base' framerates, if you include silent films. The basic 3 are 23.976 or 24.975/25 for NTSC DVDs and 23.976/24fps for PAL DVDs.
dansrfe
31st March 2010, 05:45
Perfect reply. Everything is clear now. One more question that I still have in my head: Generally speaking when using
yadif(mode=1,order=1).srestore() # for PAL sources
or
rePAL() #for NTSC sourcesDo I need to be aware of any parameters for any of the functions or is this all I will ever have to use?
Nightshiver
31st March 2010, 15:00
Don't use rePAL(). the Yadif line with Srestore is probably all you'll ever need, unless you get some whacked out DVD from hell, which has happened before. I would just recommend you buy NTSC versions of films as often as you can, it'll be less of a headache.
manono
31st March 2010, 15:08
Don't use rePAL().
Any particular reason you say that? If you say SRestore does a better unblending job, that's not been my experience in most cases.
dansrfe
31st March 2010, 23:13
I was wondering is there is any better/higher quality bobber than yadif since it tends to give a bit of an artifact prone output. Something similar in speed but if there is a range of smart bobbers quality vs. encoding time or something then a list of those would be awesome :)
Nightshiver
1st April 2010, 00:08
I said it does a better job in general. I did say that there are cases where it fails.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.