RestoreFPS

From Avisynth wiki
(Difference between revisions)
Jump to: navigation, search
(New page: {{FilterCat|External_filters|Restoration_filters|Deblenders}} {{Filter|{{Author/mg262}}|2005.07.31|[http://avisynth.org/warpenterprises/files/restorefps_25_dll_20050731.zip restorefps_25_d...)
 
m (1 revision)

Revision as of 16:02, 9 May 2013

Abstract
Author mg262
Version 2005.07.31
Download restorefps_25_dll_20050731.zip
Category Deblenders
Requirements
  • YV12
License
Discussion

RestoreFPS(clip, float fps, float phase)


Contents

Abstract

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.)

Parameters

  • It takes a YV12 clip which has an 'underlying' frame rate of fps, but a higher actual frame rate due to blending, and reverses the blending to restore the original frame rate.
  • Phase is a number between 0 and 1 which specifies the relative displacement of old and new clips (see example below).

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)
converttoyuy2
assumeFPS (24/1.001)
convertFPS (25)
converttoyv12
overlay(crop(0,0,-0, 26). 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.

External Links

Personal tools