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 27th December 2011, 16:52   #1  |  Link
Emulgator
Big Bit Savings Now !
 
Emulgator's Avatar
 
Join Date: Feb 2007
Location: close to the wall
Posts: 986
Unipolator - an universal frame interpolator script

And here is my Unipolator.
I decided to release it into the wild today, Santa was close and 2011 ran as hell.


Unipolator is an universal frame interpolator script to be run under Avisynth, based on MFlowInter from MVTools2 plugin.

To ease restoration of film scans Unipolator performs motion-based interpolation
of up to seven consequent missing frames in up to 52 places at one call.
Especially designed for in-place repair of heavily damaged frames and/or recalculation and reinsertion of missing frames.

A walkthrough-documentation is part of the script,
which helps with tailored assertions to check against certain parameter violations.

Unipolator has a nice switchable and resolution and widescreen-dependent info overlay
which fits into bigger scripts that evaluate source and final video parameters.

I guess the conditional splicer could be straightened out and forged into a function,
the whole beast could be a function as well (a Gavino case?), but my time is too limited right now.

Suggestions and Improvements welcome.
--------------
Oops.
Quote:
The text that you have entered is too long (157793 characters). Please shorten it to 16000 characters long.
A .7z is coming soonish...
Attached Files
File Type: 7z Unipolator115.7z (12.6 KB, 249 views)
__________________
"To bypass shortcuts and find suffering...is called QUALity" (Die toten Augen von Friedrichshain)
"Data reduction ? Yep, Sir. We're working on that issue. Synce invntoin uf lingöage..."

Last edited by Emulgator; 27th December 2011 at 16:54.
Emulgator is offline   Reply With Quote
Old 28th December 2011, 08:52   #2  |  Link
Jenyok
Warm and fuzzy
 
Join Date: Apr 2010
Location: Moscow, Russia
Posts: 201
Unfortunately,
*.7z attachment is not supported (not approval for long, long time) here in site...
Please, attach *.zip or *.rar normal file...
Jenyok is offline   Reply With Quote
Old 28th December 2011, 15:28   #3  |  Link
Guest
Guest
 
Join Date: Jan 2002
Posts: 21,922
[bump after attachment approval -- no problem with 7z files]
Guest is offline   Reply With Quote
Old 3rd January 2012, 15:14   #4  |  Link
Mounir
Registered User
 
Join Date: Nov 2006
Posts: 742
I don't freaking understand the syntax; can you give us an example:
For instance:
- frame 1500 is damaged
- frame 1700 to 1704 are damaged

Thanks for your help
Mounir is offline   Reply With Quote
Old 3rd January 2012, 20:30   #5  |  Link
Emulgator
Big Bit Savings Now !
 
Emulgator's Avatar
 
Join Date: Feb 2007
Location: close to the wall
Posts: 986
Frame 1500:

Code:
insertbeforeAA=1500    insertlengthAA=-1
Frames 1700 to 1704: 5 damaged Frames in a row.
This is not implemented directly as Replace, here up to 3 in a row are possible.

But using pure Frame Insertion in Unipolator up to seven missing frames are implemented.

No sweat here:
First Trim() away the defect frames, then apply Unipolator for Frame Insertion:

Code:
Trim(0,1699) ++ Trim(1705,0)
What was frame 1705 now becomes frame 1700.

Then call Unipolator again

Code:
insertbeforeAA=1700    insertlengthAA=5
and the motion gap between 1699 and 1700 ( the old 1705) should be populated by 5 freshly interpolated frames becoming the new 1700, 1701, 1702, 1703, 1704.
__________________
"To bypass shortcuts and find suffering...is called QUALity" (Die toten Augen von Friedrichshain)
"Data reduction ? Yep, Sir. We're working on that issue. Synce invntoin uf lingöage..."

Last edited by Emulgator; 3rd January 2012 at 21:04.
Emulgator is offline   Reply With Quote
Old 3rd January 2012, 21:02   #6  |  Link
Emulgator
Big Bit Savings Now !
 
Emulgator's Avatar
 
Join Date: Feb 2007
Location: close to the wall
Posts: 986
I will give some little helpers here to everyone to find your way through the interpolated frames, where they are and where the frame bilance actually ends up:

Put your sourcefilter here...

Code:
..source("X:\path\file")
Then control the Overlays here:
(you only use 0 to mute any overlays, 1 to see input framenumbers only and 5 to see input and output frame numbers.

The other controls are only useful in my bergwerk script;-)

Code:
FrameCounterOverlay=0     ## 0: FrameCounterOverlay OFF  |  1: Source only  |  2: Source+PostTrim  |  3: Source+PostTrim+PostDec
                                    ##  4: Source+PostTrim+PostDec+PostDeRoll  | 5: Source+SourceTrim+PostDec+PostDeRoll+PostInterpolator
                                    ##  6: All (Source+SourceTrim+PostDec+PostDeRoll+PostInterpolator+Final)
Give Overlay-Fontsizes here:

Code:
ResizerWide= false
ResizerHD= false
OverlayFontWidth= ResizerWide==true ? 3.75 : 4.0
OverlayFontSize= ResizerHD==true ? 12 : 10
Then evaluate the framecount before Unipolator as follows:

Code:
#[*#.....................................................................................Print Source-Framenumber Top/Bottom.....................................................................................................
function PrintSourceFrameNumberATop(clip a) {
  ScriptClip(a, """Subtitle("Source Frame "+string(current_frame), size=overlayfontsize+2, align=5, x=(width*1/8)+12, y=overlayfontsize+10, font_width=OverlayFontWidth, text_color=$00AAAAFF)""")
}
function PrintSourceFrameNumberABottom(clip a) {
  ScriptClip(a, """Subtitle("Source Frame "+string(current_frame), size=overlayfontsize+2, align=5, x=(width*1/8)+12, y=height-12, font_width=OverlayFontWidth, text_color=$00AAAAFF)""")
}
FrameCounterOverlay>=1 ? PrintSourceFrameNumberATop(last) : NOP
FrameCounterOverlay>=1 ? PrintSourceFrameNumberABottom(last) : NOP
#*]#.........................................................................................End of Source-Framenumber Top/Bottom..............................................................................................
Put Unipolator code here...

Code:
[*################    Start of Emulgator's Universal Motion Based Frame Interpolator    #######################
.....
*]############    End of Emulgator's Universal Motion Based Frame Interpolator Unipolator 1.15    ###################
Then evaluate the framecount after Unipolator as follows:

Code:
#[*#...........................................................................Print PostInsert-Framenumber Top/Bottom.......................................................................................................
function PrintPostInsertFrameNumberETop(clip e) {
  ScriptClip(e, """Subtitle("PostInterpol Frame "+string(current_frame), size=overlayfontsize+2, align=5, x=(width*6/8)-24, y=overlayfontsize+10, font_width=OverlayFontWidth, text_color=$00EEEEEE)""")
}
function PrintPostInsertFrameNumberEBottom(clip e) {
  ScriptClip(e, """Subtitle("PostInterpol Frame "+string(current_frame), size=overlayfontsize+2, align=5, x=(width*6/8)-24, y=height-12, font_width=OverlayFontWidth, text_color=$00EEEEEE)""")
}
FrameCounterOverlay>=5 ? PrintPostInsertFrameNumberETop(last) : NOP
FrameCounterOverlay>=5 ? PrintPostInsertFrameNumberEBottom(last) : NOP
#*]#..........................................................................End of PostInsert-Framenumber Top/Bottom......................................................................................................
Now one should be able to see what he is doing framecountwise...
__________________
"To bypass shortcuts and find suffering...is called QUALity" (Die toten Augen von Friedrichshain)
"Data reduction ? Yep, Sir. We're working on that issue. Synce invntoin uf lingöage..."
Emulgator is offline   Reply With Quote
Old 3rd January 2012, 23:55   #7  |  Link
Emulgator
Big Bit Savings Now !
 
Emulgator's Avatar
 
Join Date: Feb 2007
Location: close to the wall
Posts: 986
To illustrate cases where linear motion interpolation between two frames might not succeed
(jiggling motion, to and fro, colliding objects...), I'd like to quote from PM:

Quote:
Mounir, your sample has 13 defective frames in row.
It looks like heavy encoding artifacts to me (moving white blocks).

While these 13 defective frames pass
the original motion of the running men (bouncing of body and limbs)
stretches over more than a half oscillation period.

Interpolated motion will only look convincing if less than half of an oscillation period has to be interpolated.
because linear interpolation can not know about the number of oscillations in between.

Only if all motion parts and their expected oscillations could be modeled from more previous and following frames this would be feasible.
But this is outside of the scope of MVTools at the moment, I guess.

The result will be morphing of the last good frame of the starting part into the first good frame of the ending part
and so unfortunately not resemble a running crowd.
__________________
"To bypass shortcuts and find suffering...is called QUALity" (Die toten Augen von Friedrichshain)
"Data reduction ? Yep, Sir. We're working on that issue. Synce invntoin uf lingöage..."
Emulgator is offline   Reply With Quote
Old 4th March 2012, 09:52   #8  |  Link
Lyris
Registered User
 
Join Date: Sep 2007
Location: Europe
Posts: 600
Sorry, but can you explain how to use this?

Let's say I have a file and I want to replace one damaged frame, say, frame 51186, using data from frames 51185 and 51187. How do I do this with your script?

I've tried changing the values inside the .AVS file, for example:

insertbeforeAA=51186 insertlengthAA=-1

But it just throws the error, "Evaluate: Unrecognized exception".
Lyris is offline   Reply With Quote
Old 4th March 2012, 10:20   #9  |  Link
Emulgator
Big Bit Savings Now !
 
Emulgator's Avatar
 
Join Date: Feb 2007
Location: close to the wall
Posts: 986
Lyris, your syntax is correct.
Hm. I could not repeat this fault. I just opened an .avi source, total length 5750 frames,
Code:
 insertbeforeAA=5118    insertlengthAA=-1
threw the script on VirtualDub 1.10.0, Goto frame 5118 and got a properly interpolated and replaced frame
(source was interlaced, so horizontally scrolling credits are a bit skewed.)

Maybe a dependency on MVTools versions ?
At my editing system (WinXP32 SP3 T7600G, 4GB RAM, 9x500GB HDD), Unipolator calls mvtools2 version 2.5.11.6 at the moment.
As the shape of the frame number renderings up to 4th position suggest,
the resulting frame 5118 is indeed an interpolation of the former adjacent frames 5117 and 5119.
If you had seen the first frame version before 10:34 GMT+1, please refresh your browser,
I had my new version of filldrops3 still activated in the chain while screenshooting...
__________________
"To bypass shortcuts and find suffering...is called QUALity" (Die toten Augen von Friedrichshain)
"Data reduction ? Yep, Sir. We're working on that issue. Synce invntoin uf lingöage..."

Last edited by Emulgator; 4th March 2012 at 10:51.
Emulgator is offline   Reply With Quote
Old 22nd April 2012, 21:53   #10  |  Link
lisztfr9
Registered User
 
Join Date: Apr 2010
Posts: 175
Hi,

I would need such a script for about 15 frames, for the sudden bursts of noise on my old VHS-TV records.

L
lisztfr9 is offline   Reply With Quote
Old 24th April 2012, 12:13   #11  |  Link
Revgen
Registered User
 
Join Date: Sep 2004
Location: Near LA, California, USA
Posts: 1,545
This filter does a great job at SD resolutions. I use it to repair damaged frames from TV broadcasts.


Unfortunately I can't get it to work at HD resolutions. Nothing in the instruction manual mentions high definition sources being restricted.
__________________
Pirate: Now how would you like to die? Would you like to have your head chopped off or be burned at the stake?

Curly: Burned at the stake!

Moe: Why?

Curly: A hot steak is always better than a cold chop.
Revgen is offline   Reply With Quote
Old 25th April 2012, 21:41   #12  |  Link
Emulgator
Big Bit Savings Now !
 
Emulgator's Avatar
 
Join Date: Feb 2007
Location: close to the wall
Posts: 986
Yes, confirmed. I developed Unipolator for SD restoration and was happy with it.

Now that I have some HD footage to restore myself I will have to make it work for HD too...
On a WinXP32 SP3 here Unipolator eats up 2GB rapidly when loading HD.
When reaching the first frame to be interpolated and MVtools kick in,
Memory use gets even higher and voila: access violation.

Will see how it behaves on a Win7U64 sooner or later, but no time for now.
__________________
"To bypass shortcuts and find suffering...is called QUALity" (Die toten Augen von Friedrichshain)
"Data reduction ? Yep, Sir. We're working on that issue. Synce invntoin uf lingöage..."
Emulgator 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 04:31.


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