Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 1st May 2004, 20:33   #1  |  Link
scharfis_brain
brainless
 
scharfis_brain's Avatar
 
Join Date: Mar 2003
Location: Germany
Posts: 3,653
Restore24 revisited.

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....chmentid=70159

( http://forum.gleitz.info/showthread....d=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

__________________
Don't forget the 'c'!

Don't PM me for technical support, please.

Last edited by scharfis_brain; 12th January 2005 at 19:17.
scharfis_brain is offline   Reply With Quote
Old 2nd May 2004, 12:37   #2  |  Link
pogo stick
I have sawdust in my head
 
pogo stick's Avatar
 
Join Date: Aug 2003
Location: Russia
Posts: 305
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.
pogo stick is offline   Reply With Quote
Old 2nd May 2004, 12:45   #3  |  Link
Mug Funky
interlace this!
 
Mug Funky's Avatar
 
Join Date: Jun 2003
Location: i'm in ur transfers, addin noise
Posts: 4,555
hmm... how about:

Code:
separatefields().selecteven().bicubicresize(384,288,0,.5)

unblend()

YourFilterHere(blah=10)
this should run fast as hell.
__________________
sucking the life out of your videos since 2004
Mug Funky is offline   Reply With Quote
Old 2nd May 2004, 13:31   #4  |  Link
pogo stick
I have sawdust in my head
 
pogo stick's Avatar
 
Join Date: Aug 2003
Location: Russia
Posts: 305
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 at the same time.
pogo stick is offline   Reply With Quote
Old 2nd May 2004, 14:03   #5  |  Link
scharfis_brain
brainless
 
scharfis_brain's Avatar
 
Join Date: Mar 2003
Location: Germany
Posts: 3,653
Code:
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:

Code:
source()
kernelbob()
unblend()
smartdecimate(24,100)
but restore24 will produce much better pans and lesser yerk.

restore24 can be sped up further using this:

Code:
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.
__________________
Don't forget the 'c'!

Don't PM me for technical support, please.
scharfis_brain is offline   Reply With Quote
Old 2nd May 2004, 14:15   #6  |  Link
vispgraedde
Registered User
 
Join Date: Oct 2002
Posts: 74
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 =)
vispgraedde is offline   Reply With Quote
Old 2nd May 2004, 14:37   #7  |  Link
scharfis_brain
brainless
 
scharfis_brain's Avatar
 
Join Date: Mar 2003
Location: Germany
Posts: 3,653
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.
__________________
Don't forget the 'c'!

Don't PM me for technical support, please.
scharfis_brain is offline   Reply With Quote
Old 2nd May 2004, 15:58   #8  |  Link
vispgraedde
Registered User
 
Join Date: Oct 2002
Posts: 74
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.
vispgraedde is offline   Reply With Quote
Old 2nd May 2004, 16:21   #9  |  Link
Mug Funky
interlace this!
 
Mug Funky's Avatar
 
Join Date: Jun 2003
Location: i'm in ur transfers, addin noise
Posts: 4,555
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.
__________________
sucking the life out of your videos since 2004
Mug Funky is offline   Reply With Quote
Old 2nd May 2004, 19:35   #10  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,389
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
__________________
- We´re at the beginning of the end of mankind´s childhood -

My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!)
Didée is offline   Reply With Quote
Old 3rd May 2004, 02:56   #11  |  Link
vispgraedde
Registered User
 
Join Date: Oct 2002
Posts: 74
Quote:
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
vispgraedde is offline   Reply With Quote
Old 3rd May 2004, 14:35   #12  |  Link
pogo stick
I have sawdust in my head
 
pogo stick's Avatar
 
Join Date: Aug 2003
Location: Russia
Posts: 305
Quote:
Originally posted by scharfis_brain
restore24 can be sped up further using this:
Code:
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?
pogo stick is offline   Reply With Quote
Old 3rd May 2004, 23:15   #13  |  Link
scharfis_brain
brainless
 
scharfis_brain's Avatar
 
Join Date: Mar 2003
Location: Germany
Posts: 3,653
@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!)
__________________
Don't forget the 'c'!

Don't PM me for technical support, please.
scharfis_brain is offline   Reply With Quote
Old 14th May 2004, 04:16   #14  |  Link
nanga parbat
Registered User
 
nanga parbat's Avatar
 
Join Date: Nov 2002
Location: where there are too much media and a people that believe them an councellors that think they must please them, must be everybodys darling, a doomed country, discussing every shit from soccer to haircolours but carefully avoiding the dire necessities.
Posts: 34
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...

Last edited by nanga parbat; 14th May 2004 at 04:50.
nanga parbat is offline   Reply With Quote
Old 14th May 2004, 08:01   #15  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,389
@ 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
__________________
- We´re at the beginning of the end of mankind´s childhood -

My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!)
Didée is offline   Reply With Quote
Old 14th May 2004, 15:21   #16  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Finland
Posts: 5,717
Problem with CCE/TMPGEnc

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

http://www.saunalahti.fi/sam08/kane.rar (~5.5MB)
__________________
And if the band you're in starts playing different tunes
I'll see you on the dark side of the Moon...
Boulder is offline   Reply With Quote
Old 14th May 2004, 22:05   #17  |  Link
nanga parbat
Registered User
 
nanga parbat's Avatar
 
Join Date: Nov 2002
Location: where there are too much media and a people that believe them an councellors that think they must please them, must be everybodys darling, a doomed country, discussing every shit from soccer to haircolours but carefully avoiding the dire necessities.
Posts: 34
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 is offline   Reply With Quote
Old 16th May 2004, 07:29   #18  |  Link
nanga parbat
Registered User
 
nanga parbat's Avatar
 
Join Date: Nov 2002
Location: where there are too much media and a people that believe them an councellors that think they must please them, must be everybodys darling, a doomed country, discussing every shit from soccer to haircolours but carefully avoiding the dire necessities.
Posts: 34
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
nanga parbat is offline   Reply With Quote
Old 16th May 2004, 10:11   #19  |  Link
Leak
ffdshow/AviSynth wrangler
 
Leak's Avatar
 
Join Date: Feb 2003
Location: Austria
Posts: 2,441
Quote:
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)
Leak is offline   Reply With Quote
Old 16th May 2004, 10:34   #20  |  Link
nanga parbat
Registered User
 
nanga parbat's Avatar
 
Join Date: Nov 2002
Location: where there are too much media and a people that believe them an councellors that think they must please them, must be everybodys darling, a doomed country, discussing every shit from soccer to haircolours but carefully avoiding the dire necessities.
Posts: 34
Quote:
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.
nanga parbat is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:30.


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