Skip to content

Instantly share code, notes, and snippets.

@edjdavid
Created August 13, 2020 12:39
Show Gist options
  • Star 43 You must be signed in to star a gist
  • Fork 8 You must be signed in to fork a gist
  • Save edjdavid/8ad0445042c4ca4fa66e4055f2cbfc3b to your computer and use it in GitHub Desktop.
Save edjdavid/8ad0445042c4ca4fa66e4055f2cbfc3b to your computer and use it in GitHub Desktop.
PotPlayer Motion Interpolation

Motion Interpolation

Interpolate 24fps videos to 60fps in PotPlayer

Download and install the latest AviSynth+ (with vcredist)
https://github.com/AviSynth/AviSynthPlus/releases

Download the latest MvTools
https://github.com/pinterf/mvtools/releases

Extract x64 from the archive (DePan.dll, DePanEstimate.dll, mvtools2.dll) to C:\Program Files (x86)\AviSynth+\plugins64\ (adjust the avs script if avisynth is not installed in this directory)

In PotPlayer:

Preferences
  -> Filter Control
    -> Video Decoder
      -> Built-in Video Codec/DXVA Settings
        -> Use DXVA
          -> Checked
        -> DXVA2 Copy-Back
          -> Select D311 with the GPU
  -> Avisynth
    -> Enable AviSynth processing
      -> Checked
    -> Add "potplayer_source()"
      -> Checked
    -> Leave other checkboxes on default
    -> Load Script
      -> Select or copy the avs script below

avisynthplus_motion_interp.avs

SetMemoryMax(512)
SetFilterMTMode("DEFAULT_MT_MODE", 2)
SetFilterMTMode("FFVideoSource", 3)
potplayer_source()
LoadPlugin("C:\Program Files (x86)\AviSynth+\plugins64\mvtools2.dll")
super=MSuper(pel=1, hpad=0, vpad=0)
backward_1=MAnalyse(super, chroma=false, isb=true, blksize=32, blksizev=32, searchparam=3, plevel=0, search=3, badrange=(-24))
forward_1=MAnalyse(super, chroma=false, isb=false, blksize=32, blksizev=32, searchparam=3, plevel=0, search=3, badrange=(-24))
backward_2 = MRecalculate(super, chroma=false, backward_1, blksize=8, blksizev=8, searchparam=0, search=3)
forward_2 = MRecalculate(super, chroma=false, forward_1, blksize=8, blksizev=8, searchparam=0, search=3)
MBlockFps(super, backward_2, forward_2, num=60, den=1, mode=2)
Prefetch(4)
@HarikrishnanRK
Copy link

Why is 4k gets stuck at 0fps after 2 seconds of playback? How do I fix that? Using 1060 6GB

@edjdavid
Copy link
Author

Try increasing SetMemoryMax. Though 4k videos might perform badly on these settings as I'm using these for watching 480p-1080p videos on a low end system.

@HarikrishnanRK
Copy link

HarikrishnanRK commented Jul 21, 2022

Now it changed from 2 seconds to 14 seconds when I changed it to 4096 instead of default 512 in SetMemoryMax. Is there any way to stop interpolation if its a 60 fps video ? I think 60 fps videos gets again processed to 60 fps. I mean do nothing for 60fps video should be great. Thanks for the reply.

@jasperltz93
Copy link

I'm having problem on moving the seeker, the player just closed suddenly, is it because of the GPU? I'm using 1050Ti

@RunAwayFromTheSun
Copy link

@edjdavid I wanted to thank you for sharing your research and discovery of using this technique within PotPlayer to do frame motion interpolation. I was searching the internet, far and wide, for a free technique to actually do this within a media player. Literally every other solution I found is either not free, or requires a video card from a specific manufacturer, or does not work in real time and must be transcoded. Your solution literally seems to be the only way to do it for free with no other major requirements. Again, I am very grateful for your work and time investment to share this with us.

@calilsolis
Copy link

Mirillis' Splash Player has this natively.

@ThreeDeeJay
Copy link

I'm having problem on moving the seeker, the player just closed suddenly, is it because of the GPU? I'm using 1050Ti

Can confirm, especially if I spam left or right arrows to seek back and forth, but it even happens if I just try rewinding back once sometimes.
Perhaps the player/filter doesn't like processing a new part of the video when a previous one hasn't finished processing or something 🤔

@edjdavid I wanted to thank you for sharing your research and discovery of using this technique within PotPlayer to do frame motion interpolation. I was searching the internet, far and wide, for a free technique to actually do this within a media player. Literally every other solution I found is either not free, or requires a video card from a specific manufacturer, or does not work in real time and must be transcoded. Your solution literally seems to be the only way to do it for free with no other major requirements. Again, I am very grateful for your work and time investment to share this with us.

There's also SVP 3.1.7 (last free version) which can be GPU-accelerated but you can disable it to use the CPU. I made this script a while ago that sets it up with MPC-HC and Kodi with just a few clicks.
I haven't added PotPlayer yet but you can follow this guide to set it up with ffdshow, or the newer one that uses AviSynth (last time I tried it didn't work so I just used ffdshow).

@captain-k4
Copy link

this actually work in 2022

@DarkKingTNi
Copy link

hi
how do i have more than 60fps with this script without any issue???
im have a 165hz monitor with nvidia 3070ti , 16gb ram , cpu 12400f
im change num=60 to num=165 but voice not sync with image!!!
pls help me, tnx a lot

@captain-k4
Copy link

try my working script:

AddAutoloadDir("#SCRIPTDIR/plugins")
SetFilterMTMode("DEFAULT_MT_MODE", 2)
SetMemoryMax(1024)

super=MSuper(pel=1, hpad=0, vpad=0, chroma=true, sharp=0, rfilter=0)
backward=MAnalyse(super, chroma=false, isb=true, search=2, searchparam=0, pelsearch=0, truemotion=true, blksize=16, blksizev=16)
forward=MAnalyse(super, chroma=false, isb=false, search=2, searchparam=0, pelsearch=0, truemotion=true, blksize=16, blksizev=16)
MBlockFps(super, backward, forward, num=FramerateNumerator(last)*2, den=FramerateDenominator(last)*1)

Prefetch(#CPUS)

hi how do i have more than 60fps with this script without any issue??? im have a 165hz monitor with nvidia 3070ti , 16gb ram , cpu 12400f im change num=60 to num=165 but voice not sync with image!!! pls help me, tnx a lot

@DarkKingTNi
Copy link

try my working script:

AddAutoloadDir("#SCRIPTDIR/plugins") SetFilterMTMode("DEFAULT_MT_MODE", 2) SetMemoryMax(1024)

super=MSuper(pel=1, hpad=0, vpad=0, chroma=true, sharp=0, rfilter=0) backward=MAnalyse(super, chroma=false, isb=true, search=2, searchparam=0, pelsearch=0, truemotion=true, blksize=16, blksizev=16) forward=MAnalyse(super, chroma=false, isb=false, search=2, searchparam=0, pelsearch=0, truemotion=true, blksize=16, blksizev=16) MBlockFps(super, backward, forward, num=FramerateNumerator(last)*2, den=FramerateDenominator(last)*1)

Prefetch(#CPUS)

hi how do i have more than 60fps with this script without any issue??? im have a 165hz monitor with nvidia 3070ti , 16gb ram , cpu 12400f im change num=60 to num=165 but voice not sync with image!!! pls help me, tnx a lot

tnx bro , but not work , all movies 1080 , 4k , and etc cap between 30 - 50 fps !!!

@DarkKingTNi
Copy link

any change for 120fps and above???!!! pls help me
update script for 120fps and above tnx a lot

@ranvotu
Copy link

ranvotu commented Jan 11, 2023

How can I use this with LAV Video Decoder instead

@captain-k4
Copy link

I think for the above script, It only doubles th file source fps. that's the best you can get after I test it.

@sdanielch
Copy link

Hey! you are the best, im testing this metod in 2023 with RTX3060, all right! of course this run very well in Windows (i was config your script for sync with my screen 144fps), maybe in some videos audio de-sync but in potplayer you can "resync" on the fly and voila!, great tutorial!

Do you know a similar method for Linux? Thanks!!

@DarkKingTNi
Copy link

this work good for highend pc in 4k
but not work so well in loptop with intel gpu in 4k video
even with increasing the ram to 10240 mb
any solution for me??
my spec lop top : intel i7 1165g7 - intel iris xe share to 8gb - 16gb ram
pls help me tnx

@bryannetrunner
Copy link

Hi edjdavid, I've just configured this with PotPlayer and the result is shockingly good.

I have a question: I often watch videos at 1.25 or 1.5 speed, so for example 24fps becomes 36fps at 1.5X. The script does not know the playback speed and hence the video becomes 75fps (see attached screenshot). Is it possible to take the current playback speed into account to maintain 60fps even if the playback speed changes?

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment