RestoreFPS

From Avisynth wiki
Revision as of 00:07, 23 February 2015 by Reel.Deal (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Abstract
Author mg262
Version v1.0
Download Restorefps_v10.zip
Category Deblenders
License GPLv2
Discussion Doom9 Thread

Contents

Description

RestoreFPS reverses the kind of blending generated by ConvertFPS, restoring original framerate. It will work perfectly well on any regular blend pattern, including the types mentioned by scharfis_brain in this thread

The framerate to restore should be less than the current framerate, and more than half of it. (So restoring from 24 back to 25 and from 24 back to 11 are both illegal.)

Requirements

  • AviSynth 2.5.8 or later
  • Supported color formats: YV12


Syntax and Parameters

RestoreFPS (clip, float, float)


clip   =
Input clip.


float   =
FPS is the 'underlying' frame rate of the input clip (which will actually have a higher actual frame rate due to blending), RestoreFPS will try to reverse the blending and restore the original frame rate.


float   =
Phase is a number between 0 and 1 which specifies the relative displacement of old and new clips (see example below).


  • Note: all parameters are unnamed and do not have a default so they must be specified.


Examples

In order to test the filter we need to generate a clip using ConvertFPS. A script like this:

     BicubicResize(4*60,3*60)
     SelectEvery(200,0)
     AssumeFPS(24000,1001)
     ConvertFPS(25)
     Overlay([[Crop(0,0,-0, 26, true).ShowFrameNumber) 
    

will do the trick. Now running RestoreFPS(24/1.001, 0.00) produces a stream of frames. In this case, the start (in time) of the input clip corresponds exactly to the start (in time) of a frame of the original clip. That won't always be true - if we take the convertFPS clip above and trim it (say add Trim(10,0)), then we have a different situation. Dealing with this requires us to guess the amount by which the converted clip is 'slid' with respect to the original, i.e. to guess the phase parameter. I used this script to help with this:

    function phase(clip c, float phi){
    c
    RestoreFPS(24/1.001, phi) #here set appropriate frame rate
    
    #trim here if desired
    
    a=SelectEvery(6,0)
    b=SelectEvery(6,1)
    c=SelectEvery(6,2)
    d=SelectEvery(6,3)
    e=SelectEvery(6,4)
    f=SelectEvery(6,5)
    
    StackHorizontal(a,b,c,d,e,f)
    ReduceBy2()
    StackVertical(last, Trim(1,0), Trim(2,0), Trim(3,0), Trim(4,0), Trim(5,0))
    Trim(0,-1).Loop(0,1000)
    Subtitle(String(phi, "%f"))
    }
    
    #insert source clip here
    
    Animate(0,100,"phase",0.0,1.0)
    Trim(0,100)
    

Save the output of this, open it up in VirtualDub, and drag the slider around to find a phase that looks correct (you may get an unusual effect in the first few frames of the clip, because of an edge effect).

Note: If you're dealing with a clip in which fields (not full frames) are blended, separate them and process them separately; the phase parameters for the top and bottom fields will possibly differ by 0.5.

Archived Downloads

Version Download Mirror
v1.0 Restorefps_v10.zip Restorefps_v10.zip
v20050731 restorefps_25_dll_20050731.zip restorefps_25_dll_20050731.zip


External Links




Back to External Filters

Personal tools