Avisynth FrameRateConverter

From wiki.selur.net
Jump to navigation Jump to search

FrameRateConverter raises the frame rate with motion-compensated interpolation and then hides the places where the interpolation went wrong. It is a script by Etienne Charland (MysteryX) built on MVTools.

Filtering → Avisynth → Frame → Interpolation

FrameRateConverter controls in Hybrid
FrameRateConverter controls in Hybrid

The interpolation filters share one FPS adjust: check box and a method list (InterFrame, MVToolsFPS, FrameRateConverter). Choose FrameRateConverter in the list to see these controls.

What it does

New frames are made from motion vectors. The script then looks for bad blocks, occlusions and stripe patterns in the result. In those places it falls back to blending neighbouring frames or to a plain frame copy. This gives fewer visible artifacts than plain motion interpolation, but difficult scenes can look a bit blended.

Typical use: 25/30 fps material to 50/60 fps, or any other higher target rate.

Requirements

CPU only. The script needs the plugins MVTools2 (pinterf), MaskTools2 and RemoveGrain, plus FFTW; Hybrid ships them.

Settings

Control Parameter Range Hybrid default Meaning
Double frame rate FrameDouble on/off on On: output rate is twice the input rate and the original frames are kept. Off: the target rate below is used.
Frame rate (num/den) NewNum / NewDen 1–100000 each 60 / 1 Target rate as a fraction. Only used when Double frame rate is off.
Preset Preset slowest, slower, slow, normal, fast, faster, anime normal Speed/quality trade-off. faster is basic interpolation; fast adds a second vector pass (MRecalculate); normal uses it with DCT 4; slow repeats the analysis as well; slower and slowest compute two variants and take the better one per area; anime is slow with adapted fallback limits.
Blocksize BlkSize auto, 8, 16, 24, 32, 48, 64 auto Block width for the motion search. Auto picks it from the frame size (8 for small, up to 32 for large frames).
Blocksize V BlkSizeV same list auto Block height. Auto uses the same value as Blocksize.
Output mode Output auto, flow, over, raw, mask, skip, diff, stripe auto What the filter returns. The modes other than auto show intermediate results for tuning. diff only works with the presets slower and slowest.
Stripes Stp on/off on Detect and blend stripe and repeating patterns.
Debug – on/off off Shows the average luma values of the masks.
DCT Dct Normal, Slow, Slowest Normal Overrides the DCT setting of the motion analysis. Slow = 4, Slowest = 1.
DCTRe DctRe Fast, Slow, Slowest Fast Same for the recalculation pass. Slow = 4, Slowest = 1.
Mask threshold MaskThr 0–255 120 Sensitivity of the artifact mask; smaller means stronger masking. 0 turns artifact masking off.
Occ Mask threshold MaskOcc 0–255 105 Same for occlusions. 0 turns it off.
Skip threshold SkipThr 0–255 55 Threshold for skipping blocks; must be smaller than Mask threshold.
BlendOver BlendOver 0–255 70 If artifacts cover more than this, the script tries another block size and, if that fails, blends frames. 0 disables.
SkipOver SkipOver 0–255 210 If artifacts cover more than this, the whole frame is not interpolated. 0 disables. Must be greater than BlendOver unless one of them is 0.
Blend ratio BlendRatio 0–100 40 In artifact zones: 0 = frame copy, 100 = full blend.

Example

Default settings on a 10-bit YUV 4:2:0 source. Hybrid converts to 8 bit and back:

# Converting from 10 to 8bit for FrameRateConverter
ConvertBits(8)
FrameRateConverter()
# Converting from 8 to 10bit for encoder
ConvertBits(10)

How Hybrid calls it

  • Hybrid loads FrameRateConverter.avsi and its helper DLL together with MVTools2, MaskTools2, GRunT, RemoveGrain, FFTW and a few helper scripts.
  • The filter needs 8-bit YV12, YV24 or Y8 and progressive input; Hybrid adds the conversions.
  • Only values that differ from the defaults are written. Preset and Output mode are written as quoted strings. FrameDouble is written only when switched off, NewNum/NewDen only then.
  • The target rate is twice the rate at the filter's position with Double frame rate, otherwise Frame rate. If the target equals the rate at that point, the filter is skipped and a message goes to the log.
  • After the filter Hybrid uses the new rate for all later steps.
  • FrameRateConverter also offers the common options and can be added to the filter queue several times.

Background

FrameRateConverter 2.0 (2021) by Etienne Charland (MysteryX) builds on Oleg Yushko's YFRC artifact masking, interpolation code by johnmeyer and weak-mask and output options by raffriff42. pinterf did most of the work on the underlying libraries. The helper DLL provides the stripe and mask functions. Hybrid does not offer the FullRange and Prefilter parameters. DCT=1 may hang in multithreaded setups, and anime content usually works best with the slow preset.

See also: InterFrame, MVToolsFPS

Sources