Frame doubling interpolation for 1080p x264 mkv's for superfluid 48 fps

Discussion in 'The HTPC, HDTV & Ultra High Definition section' started by nzweers, Feb 15, 2009.

  1. Kriomag

    Kriomag New Member

    Messages:
    4
    Likes Received:
    0
    GPU:
    GF9800GT 1GB

    i've been trying to do this for a while and yes, it's possible :) I have converted many of my old videos from Canon A60 recorded in VGA@15fps to VGA@60fps (its awesome! totally smooth videos!) :D
    its very simple, just create .avs script file for video file you want to edit in VD and paste in to this file any of above scripts (x2 or 60fps) - remove line with "ffdshow" - then open this script file in VD :D.
    sorry for my english.

    PS. You may add after file path this line:
    ConverttoYV12()

    To the author: can you make script for superb zero-artifacts (it may be very slow, i dont need realtime processing)? when i save videos permanently in VD i would like top quality :) its very good now but always could be better ;) sometimes there are artifacts... i've tried to set 8x8 or even 4x4 blocks but it does not help :/
     
    Last edited: Apr 2, 2010
  2. Zer0K3wL

    Zer0K3wL Banned

    Messages:
    3,073
    Likes Received:
    0
    GPU:
    gtx 480 850/1700/2000 h2o
    uhm always worked for windows 7.
     
  3. signex

    signex Ancient Guru

    Messages:
    8,754
    Likes Received:
    147
    GPU:
    AMD FirePro M6100
    Weird, on first page it said that it doesn't work yet for Windows 7, thanks for the headsup ^^ 24fps is hurting my eyes

    EDIT: thanks it works now on my Windows 7 wooh ^^ but it looks like it's speeded up slightly is this normal?
     
    Last edited: Apr 2, 2010
  4. Zer0K3wL

    Zer0K3wL Banned

    Messages:
    3,073
    Likes Received:
    0
    GPU:
    gtx 480 850/1700/2000 h2o
    thats probaly cous its much smoother just test it out on everything and focus on checking if its out of sync or not.
     

  5. Kriomag

    Kriomag New Member

    Messages:
    4
    Likes Received:
    0
    GPU:
    GF9800GT 1GB
    its normal, first impression, seems to fast, but after few movies it will be natural and without this script every movie will look like slideshow :D
     
  6. DiEgO

    DiEgO Member Guru

    Messages:
    155
    Likes Received:
    1
    GPU:
    MSI GTX570 Twin Frozr II
    Thanks Kriomag, I will try that :)
     
  7. signex

    signex Ancient Guru

    Messages:
    8,754
    Likes Received:
    147
    GPU:
    AMD FirePro M6100
    Yeah you are right :D watched all the Pacific episodes over, it's like im in War myself :p
     
  8. Kriomag

    Kriomag New Member

    Messages:
    4
    Likes Received:
    0
    GPU:
    GF9800GT 1GB
    here is an example, i used this script to convert my favourite "lost" episode to 60fps ( .avs -> VD ), best quality, almost without artifacts (but you cant use it on the fly to watch videos- its too slow):

    DirectShowSource("Lost - Ab Aeterno.mkv")
    ConverttoYV12()
    fps=60
    block=8
    super=MSuper(pel=2)
    backward_vec=MAnalyse(super, blksize=block, isb=true, search=3, truemotion=true)
    forward_vec=MAnalyse(super, blksize=block, isb=false, search=3, truemotion=true)
    MFlowFps(super, backward_vec, forward_vec, num=2*FramerateNumerator(last), den=FramerateDenominator(last))
    last.CombineFPS(fps, last.MotionFPS(fps, warp, warp), last.MotionFPS(fps, source=next, warp, warp))
     
    Last edited: Apr 8, 2010
  9. widezu69

    widezu69 Member

    Messages:
    40
    Likes Received:
    0
    GPU:
    GTX 780m 4GB
    The Definitive Guide

    Hello everyone, sorry I've not been around for a while, been quite busy with Uni work etc. Anyways during the times I have been free I have been trying to optimise a script that works well.

    Here goes. This guide is for playback only. I'm sure other gurus here can alter this guide for VirtualDub and MeGUI etc, but not me. I recommend that you start with a clean palate. Uninstall all your codecs and players etc. and follow this guide.
    A great site is afterdawn.com it has all the latest and greatest that we need for this to work.

    For those who wish to dish a few bucks and have a nVidia card. Go out and buy CoreAVC and enable cuda in the settings. This will basically allow your GPU to do the x264/h.264/AVC decoding. Install it with the Haali options for the file types you wish to play.

    Download K-Lite Mega Codec pack and install ONLY Media Player Classic Regular NOTHING ELSE. This player gives me the least headaches when trying to get everything to work. Enable the internal subtitle renderer, all other options are optional for your liking but the subtitle renderer is required as the ffdshow subtitle renderer sometimes messes up everything whilst doing Avisynth operations. Also Make MPC the default player for all video types, reason being that the codec pack has some nice bonuses with file type icons that look pretty sweet. Once installed, open up MPC and enter the options window. Select your renderer as the Haali Renderer, then click the internal filters tab and uncheck everything in both columns. Apply and exit the player, don't attempt to play anything yet unless you've installed CoreAVC.

    (CoreAVC users) Play a h.264 encoded video. Hopefully your tray should have a green CoreAVC icon indicating cuda is in use. Start Task Manager and check, your CPU usage, it should be hovering at a very low usage indicating your GPU is doing all the work.

    Download and install Avisynth FIRST...

    THEN Download and install the newest ffdshow, during the installation, uncheck VFW and check all the Avisynth options. Install ffdshow with your required codecs. Launch ffdshow after the installation and do the audio settings for your speaker configuration. Disable the DXVA codec (its useless really as all other filters are then disabled including Avisynth. Make sure you enable all your needed codecs in the codecs tab.

    CoreAVC users must select the h.264 option in ffdshow as disabled and then enable RAW video to all supported. Then start MPC, options and click on external filters and add ffdshow as 'preferred'. This allows CoreAVC to do the decoding with the GPU, then passing the video to ffdshow for filtering using the CPU.

    Everyone should be able to play a video now. And onto customising we go. The ffdshow tabs on the left hand side also dictate the order the filters are applied to the video. If using interlaced video, arrange Deinterlacing furthest up, use Yadif without doubling framerate, next comes picture properties for altering colour etc. Then Avisynth. All other filters go underneath. Especially Resize, we don't want to waste CPU power by processing a large upscaled video when we can process a smaller video and then upscale it afterwards. In the Output tab check high quality conversion, in the rgb conversion tab, check the same and uncheck Dithering. Now we should have ffdshow configured apart from the Avisynth tab.

    To set up Avisynth, download:

    Working stable MT for mutithreading here: http://www.mediafire.com/file/nnbngf...isynth258MT.7z
    Put the avisynth.dll in your system32 folder or SysWOW64 (if using 64 bit) if you aren't prompted to replace the original your putting it in the worng place, put the other dlls in your plugins folder in the Avisynth directory replacing the originals.

    System dlls to stop ffdshow crashing here:
    http://www.megaupload.com/?d=SP5FE2KG
    Place them in your system32 or SysWOW64 folder. For some reason, without these, Avisynth+ffdshow=crash.

    Framedoubling plugin here:
    http://avisynth.org.ru/mvtools/mvtools2.html
    The link is at the bottom of the page. put it in your Avisynth plugins directory.

    Everything is in place, hopefully. Open up ffdshow and check the Avisynth tab. Uncheck add ffdshow video source, check YV12 only. Buffer back ahead varies with different people, best to keep this checked and start with 0/10 but experiment with 10/10 or 0/24 or whatever suits you.

    Now add this script to the box:

    SetMemoryMax(1280)
    SetMTMode(5,4)
    ffdShow_source()
    SetMTMode(2)
    super=MSuper(pel=1, hpad=8, vpad=4)
    backward_1=MAnalyse(super, chroma=false, isb=true, blksize=16, blksizev=16, searchparam=2, plevel=0, search=3, badrange=(-24))
    forward_1=MAnalyse(super, chroma=false, isb=false, blksize=16, blksizev=16, searchparam=2, plevel=0, search=3, badrange=(-24))
    backward_2 = MRecalculate(super, chroma=false, backward_1, blksize=16, blksizev=8, searchparam=0, search=3)
    forward_2 = MRecalculate(super, chroma=false, forward_1, blksize=16, blksizev=8, searchparam=0, search=3)
    backward_3 = MRecalculate(super, chroma=false, backward_2, blksize=8, blksizev=8, searchparam=0, search=3)
    forward_3 = MRecalculate(super, chroma=false, forward_2, blksize=8, blksizev=8, searchparam=0, search=3)
    MBlockFps(super, backward_3, forward_3, num=FramerateNumerator(last)*2, den=FramerateDenominator(last)*1, mode=0)
    SetMTMode(1)
    GetMTMode(false) > 0 ? distributor() : last

    For 60fps, change:
    MBlockFps(super, backward_2, forward_2, num=FramerateNumerator(last)*2, den=FramerateDenominator(last)*1, mode=0)
    to
    MBlockFps(super, backward_2, forward_2, num=60, den=1, mode=0)

    For Quad-Core users, change SetMTMode(5,4) to SetMTMode(5,8)

    Changing mode=0 to mode=2 will reduce artefacts but to me its not perfectly smooth and it sucks cpu, I keep it on 0.

    Now for changing it for your liking, the lower the searchparam number, the less the artifacts but less smooth. You only need to change the first pair, as you can see, the second 2 searchparam's are 0 and they can stay like that. Also the plevel=0 can be changed up to plevel=2 for minimal artifacts but less smooth movement. If you think you still have enough cpu power, change pel=1 to pel=2 for better motion accuracy (this eats cpu like the effing cookie monster!).

    For the best enjoyment:artifact ratio, best keep the script as it is unless you have more power and you can apply the alternatives.

    I hope this helps. If you are kind enough, make me a small donation? Just PM me
     
    Last edited: Apr 24, 2010
  10. soulburner

    soulburner Member

    Messages:
    12
    Likes Received:
    0
    GPU:
    Asus R9 290 DirectCU II
    Thank you for all your work widezu69!

    It works perfectly on my quad machine, but I use my mediapc to watch films (low power consumption, silent and it the right room ;))... but it is just not enough, even with CUDA (8800GT). Typical frame doubling seems to work okay, but is stuttering. I guess it may have something to do with 48fps not fitting perfectly to 60Hz refresh rate of the TV. Any tips for that?

    60fps would be the best thing to do, but the Athlon 4850e (2500MHz stock, overclocked a bit to 2800) is simply not capable of anything - the video starts playing at 5 frames per second instead, with CPU useage between 80-90% and memory usage usally below a gigabyte (something like 800 megs tops).

    Questions:
    - is my htpc processor really so weak or is there something else I should look into? Already reinstalled Windows and there was no improvement at all :(
    - is anyone working on a full CUDA-based implementation of this, skipping avisynth?
    - is anyone else working on sth similar at all?
    - could someone with an Athlon II X2 240 or similar AMD processor say how well is this interpolation thing performing there? Maybe it's time to upgrade and the 235e/240e CPUs seem pretty nice (TDP45).
     
    Last edited: Apr 17, 2010

  11. widezu69

    widezu69 Member

    Messages:
    40
    Likes Received:
    0
    GPU:
    GTX 780m 4GB
    Hey there, glad it works for you...ish. Now you could increase the blksize's from 16/16 to 32/32 and 8/8 to 16/16 this would increase the estimation sizes for motion detection but things would be less accurate and would make things less smooth, on 1080p stuff things should be alright maybe bump the first pair of searchparam=2 up to searchparam=3 or 4. On 720p stuff, because of the lower resolution, bigger blocks have a bigger effect on motion and searchparam must be at least 5 for decent motion using my script.

    Now I dunno about your amd, but this script is optimized for Intels especially i7's if you upgrade your 240 to something around 3Ghz then you'll be totally fine playing 720p @60fps, (I do and I'm on a laptop C2D @2.93 and it works quite well)

    There are bunch of developers working on a working solution here: http://www.mirillis.com/splash.html check out their Motion2 system, they're releasing some demo's next week so we'll have to see. They have a proprietary algorithm with GPU acceleration so should be good.

    BTW on your quad, change pel=1 to pel=2 and mode=0 to mode=2. Gives better accuracy at minimal loss to motion.
     
    Last edited: Apr 17, 2010
  12. soulburner

    soulburner Member

    Messages:
    12
    Likes Received:
    0
    GPU:
    Asus R9 290 DirectCU II
    I have managed to achieve near smooth 48Hz playback by changing the renderer in MPC-HC to VMR9 Renderless instead of Haali. Had to change output levels to 0-255 in CoreAVC to get the right color depth. It works great, but... I have only 1GB of RAM :D

    On "full screen" 720p movies (1280x720), the video sometimes stutters due to paging. On a widescreen video, it's fine 90% of the time. There is some slight stuttering, though. I get a similar thing on my quad + monitor, only 60fps is perfectly smooth.

    CPU usage dropped a bit after changing the renderer - it used to be 80-96%, now it's below 90%, sometimes dropping to around 70, around 80% on average. Memory usage is at ~900MB :)

    I don't think I will be experimenting with the script on my quad (Q8300 @ 3.30 - cpu usage is below 30% on 720p sources) as I rarely watch any videos there. My monitor is only 19" ;)

    I will experiment a bit on my HTPC tomorrow, but I don't want to make things less smooth - I'd like to make it even smoother ;)

    Are you playing 720p @ 60fps on your C2D laptop with or without the assistance of CUDA?
     
    Last edited: Apr 18, 2010
  13. neograniceni

    neograniceni Member

    Messages:
    28
    Likes Received:
    0
    GPU:
    Nvidia 9400GT 1GB
    Works fine with Core i5@default 2,66GHz with both 720p and 1080p MKV-s. Also tested on hyper-threading enabled quad core Intel Xeon (equivalent to i7 920) and enabling HT seems to makes a huge difference. With HT disabled there was around 30% CPU load increase compared to HT enabled mode. I am going to sell my i5 for i7 860 without any doubt.
     
  14. widezu69

    widezu69 Member

    Messages:
    40
    Likes Received:
    0
    GPU:
    GTX 780m 4GB
    Yes with cuda acceleration. Frees up some cpu so I can squeeze every last bit of interpolation. BTW you can get rid of rfilter=4 in your script. After hours of testing, I've come to the conclusion that it does squat.

    BTW @neograniceni what is this "HT" you talk about?
     
    Last edited: Apr 18, 2010
  15. soulburner

    soulburner Member

    Messages:
    12
    Likes Received:
    0
    GPU:
    Asus R9 290 DirectCU II

  16. Sever

    Sever Ancient Guru

    Messages:
    4,826
    Likes Received:
    0
    GPU:
    Galaxy 3GB 660TI
    probably an extremely noob question here.

    but if it can be made to run with nvidia cuda, is there a way to make it run with ati stream?
     
  17. Redemption80

    Redemption80 Ancient Guru

    Messages:
    18,529
    Likes Received:
    265
    GPU:
    GALAX 970/ASUS 970
    It can be made to run with Cuda because CoreAVC has Cuda support, don't think there are any H264 decoders that have stream support at the moment.

    Splash Player which is out soon will have though.
     
  18. widezu69

    widezu69 Member

    Messages:
    40
    Likes Received:
    0
    GPU:
    GTX 780m 4GB
    Hi there, latest version of my script:

    SetMemoryMax(1280)
    SetMTMode(5,4)
    ffdShow_source()
    SetMTMode(2)
    super=MSuper(pel=1, hpad=8, vpad=4)
    backward_1=MAnalyse(super, chroma=false, isb=true, blksize=32, blksizev=16, searchparam=2, plevel=0, search=3, badrange=(-24))
    forward_1=MAnalyse(super, chroma=false, isb=false, blksize=32, blksizev=16, searchparam=2, plevel=0, search=3, badrange=(-24))
    backward_2 = MRecalculate(super, chroma=false, backward_1, blksize=16, blksizev=8, searchparam=0, search=3)
    forward_2 = MRecalculate(super, chroma=false, forward_1, blksize=16, blksizev=8, searchparam=0, search=3)
    MBlockFps(super, backward_2, forward_2, num=FramerateNumerator(last)*2, den=FramerateDenominator(last)*1, mode=2)
    SetMTMode(1)
    GetMTMode(false) > 0 ? distributor() : last

    Again, other optional changes still apply from my last post such as 60fps and pel=2.

    Updates:
    SetMTMode has been changed to (5,4) and gives better performance (for me anyways).
    Block sizes are now 32x16 and 16x8 but you can experiment yourself. Smaller blocks means smoother motion.
    Mode is now 2 instead of 0, a new ways of processing frames that reduces visual artefacts. Change this back to 0 if your experiencing slow downs etc.

    This script is the tiniest bit less smooth than the last one but has far better artefact masking.
    This could be a placebo effect but after the word "last" in the script there should be a space, without it things are slow...maybe.
     
    Last edited: Apr 19, 2010
  19. neograniceni

    neograniceni Member

    Messages:
    28
    Likes Received:
    0
    GPU:
    Nvidia 9400GT 1GB
    I was experimenting different search and framerate options yesterday and found that working with larger framerates than refresh rates produce very nice judder while keeping enough smoothness not to produce typical judder headache effect of unprocessed 24p. Artefacts are also reduced while movies look way less soap-like than just doubleframed. Well, yes, You need some fast quad core CPU for this, but nothing that quad core i5/i7 (especially HT enabled i7 !) can't cope with. 75fps under 50Hz display, or 90fps under 60Hz display introduce slight motion judder 'coz some frames won't be displayed, and the effect is just amazing on my Toshiba Regza 37" LCD. That also work excellent with 22" LCD monitors fixed at 60Hz (I am testing all that stuff right now on 22" LCD monitor with res. of 1680x1050). Talking about search/searchparam, I keep them at 0 in all places.
     
  20. widezu69

    widezu69 Member

    Messages:
    40
    Likes Received:
    0
    GPU:
    GTX 780m 4GB
    Keeping searchparam on 0 is ok but the result is less artefacts but also less smooth motion. Putting search on 0 is a very bad idea as it reduces the effeciency of the search method. Search=3 is an exhaustive search that covers the whole frame/motion and is the best, search=0 is a onetimesearch which is actually quite bad. So its best keeping search=3 if not then search=5 but NEVER 0 unless you want to degrade your video. Remember your badrange has to be a minus number for it to work, use badrange=(-24). And rendering more frames than your monitor can show?! That is overkill I'm sorry.

    If you want the best artefact free motion with no soap-like visuals, this is the best script:

    SetMemoryMax(1280)
    SetMTMode(5,8)
    ffdShow_source()
    SetMTMode(2)
    super=MSuper(pel=2, hpad=4, vpad=4)
    backward_1=MAnalyse(super, chroma=false, isb=true, blksize=16, blksizev=16, searchparam=0, plevel=2, search=3, badrange=(-24))
    forward_1=MAnalyse(super, chroma=false, isb=false, blksize=16, blksizev=16, searchparam=0, plevel=2, 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=0)
    SetMTMode(1)
    GetMTMode(false) > 0 ? distributor() : last

    As you can see, searchparam is 0 and plevel is 2. All this creates a small amount of judder under a 60fps movie with virtually no artefacts. And is still super smooth. I am assuming you have a very capable computer ie quad etc. If this script is too slow, then change pel=2 to pel=1
     
    Last edited: Apr 20, 2010

Share This Page