CrendKing / avisynth_filter

DirectShow filters that put AviSynth and VapourSynth into video playing
MIT License
108 stars 8 forks source link

FrameRateConverter vapoursynth filter issue #61

Closed Usulyre closed 3 years ago

Usulyre commented 3 years ago

Environment

Sample script:

import vapoursynth as vs core = vs.get_core() clip = VpsFilterSource clip = FrameRateConverter(clip, newNum=75, newDen=1, blkSize=8, blkSizeV=8, output="flow", maskThr=100, blendOver=65, skipOver=255) clip.set_output()

Describe the bug

Can't figure out what to put for this particular filter in vapoursynth to get it to work?

clip = FrameRateConverter(clip, newNum=75, newDen=1, blkSize=8, blkSizeV=8, output="flow", maskThr=100, blendOver=65, skipOver=255)

To Reproduce

Load my sample script and play video file.

Sorry if this is filter specific, could you look over the filter site and provide a working script for this? I tried to follow their examples but it didn't work. I have the the dll and .py file in "C:\Program Files\VapourSynth\plugins"

Usulyre commented 3 years ago

2021-08-21 13_28_54-C__Users_Trsula_Firefox And Internet Explorer Downloads_test1_smoothmotion_MPC-B

CrendKing commented 3 years ago

Your script never imported FrameRateConverter.py or the dll. Just follow some basic Python tutorials for how it works. You also needs all its dependencies available in PYTHONPATH.

However, since it relies on mvTools, and we have https://github.com/dubhater/vapoursynth-mvtools/issues/52, it won't work on VPSF atm. VapourSynth needs to release their new API and mvTools needs to update on top of it.

Usulyre commented 3 years ago

Vapoursynth R55 has been released, any updates to get this to work? I've updated to that version. Also, any vapoursynth script i have seems to crash mpc-be x64 now right away.

Usulyre commented 3 years ago

Tried this for fun, but it crashed too.

https://github.com/HomeOfVapourSynthEvolution/VapourSynth-RIFE-ncnn-Vulkan/files/7203043/RIFE-r2-test.zip

CrendKing commented 3 years ago

I have a local version for Vapoursynth R55, which is under test. However, as you can see from https://github.com/dubhater/vapoursynth-mvtools/issues/52, the new API does not introduce anything to help mvtools, so I guess you have to stay on AviSynth version of mvtools, until something is changed.

As for RIFE, do you mean it crashes VPSF? If so I can take a look. Before I tried RIFE on mpv (even the "new and better" https://github.com/HolyWu/vs-rife), which works but still extremely slow (I have RTX 2070 Super) comparing to mvtools/SVP, and not suitable for realtime 1080p use cases. So even if I can fix the potential bug, I heavily doubt you can actually use it.

Of course, if you plan to do transcoding with RIFE, that's totally reasonable, but then this project has nothing to do with that use case.

Usulyre commented 3 years ago

RIFE did work at first:

https://github.com/CrendKing/avisynth_filter/issues/52

But just crashing player and VPSF too probably, won't even load the file.

I have 480p source I'm working with for realtime playback, capture card.

Usulyre commented 3 years ago

SVP has already implemented some version of RIFE too, but I don't actually have the paid version, so I don't know how it works there.

CrendKing commented 3 years ago

480p will probably work at realtime. My card can't handle size above that. If you have 3090, you can probably do 720p.

I'll take a look.

CrendKing commented 3 years ago

Just tested the r2-test RIFE.dll with the internal API R4 VPSF and everything works. Wait for me to release and let me know if problem persists for you.

Usulyre commented 3 years ago

Works using vapoursynth R56, but i thought about using below

Just tried to use this:

https://github.com/HolyWu/vs-rife

Installed via:

pip install --upgrade vsrife python -m vsrife

I'm not understanding quite what to use for the script: Do you mind correcting it?

Imports

import vapoursynth as vs from vsrife import RIFE

core = vs.core ret = VpsFilterSource ret = core.resize.Bicubic(clip=ret, format=vs.RGBS, matrix_in_s="470bg", range_s="full")

ret = RIFE(clip=ret, model_ver=1.8, scale=0.5, device_type='cpu', device_index=0)

output_ret = core.resize.Bicubic(clip=ret, format=vs.YUV420P8, matrix_s="709")

ret.set_output()

CrendKing commented 3 years ago

ret = RIFE(clip=ret, model_ver=1.8, scale=0.5, device_type='cpu', device_index=0)

This is using CPU to do the interpolation, which is extremely inefficient and defeats the purpose of using the approach. You should definitely switch to cuda.

Note that the PyTorch installed with pip install vsrife does not come with CUDA support. This page shows you the right command to use. For example, pip install --force-reinstall --pre torch -f "https://download.pytorch.org/whl/nightly/cu111/torch_nightly.html" installs the nightly version with CUDA 11.1 support.

ret.set_output() should be output_ret.set_output()

Usulyre commented 2 years ago

Hi, doies R57 of vapoursynth work with FrameRateConverter now? FrameRateConverter has incorporated some Rife functions, wanted to try it out using VPSF

CrendKing commented 2 years ago

AFAIK, nothing has changed since my reply.

Usulyre commented 2 years ago

There is a new version of:

https://github.com/HolyWu/vs-rife

I'm on R57 of vapoursynth and the lastet version of VPSF.

Opening a video in mpc-be (same version as above)

Nothing happening in video player just "opening"

Can you test this?

Script is this:

Imports

import vapoursynth as vs from vsrife import RIFE

core = vs.core ret = VpsFilterSource ret = core.resize.Bicubic(clip=ret, format=vs.RGBS, matrix_in_s="470bg", range_s="full")

ret = RIFE(clip=ret, multi=2, scale=2.0, device_type='cuda', device_index=0, fp16=true)

output_ret = core.resize.Bicubic(clip=ret, format=vs.YUV420P8, matrix_s="709")

output_ret.set_output()

Usulyre commented 2 years ago

Sorry never mind it's working on other video files

import vapoursynth as vs from vsrife import RIFE

core = vs.core ret = VpsFilterSource ret = core.resize.Bicubic(clip=ret, format=vs.RGBS, matrix_in_s="470bg", range_s="full")

ret = RIFE(clip=ret, multi=4, scale=2.0, device_type='cuda', device_index=0, fp16="true")

output_ret = core.resize.Bicubic(clip=ret, format=vs.YUV420P8, matrix_s="709")

output_ret.set_output()

CrendKing commented 2 years ago

fp16 is bool, so I think you can use True. Other than that, you script is fine. Enjoy.