Log in

View Full Version : Detelecining an upscale


bruno321
29th January 2022, 10:25
I have this video file at 29.97fps where I think a detelecine should be performed to get this to look and play nicely. I see a standard of 3 progressive frames followed by 2 combed frames. The problem is this is an upscale to 1080p, and I'm having trouble getting the fields to match with tfm().

I tried cropping the black bars then downscaling to e.g. 720x480, then doing tfm(), but it doesn't match correctly. I've tried other heights but none of them worked.

What can I do here to get 23.976fps, smooth playback and no combing or other artifacts? I attach a sample.

https://www.mediafire.com/file/iyrcswi77q4pidm/sample.mkv/file

Boulder
29th January 2022, 12:05
To me it looks like something similar to the issue here: https://forum.doom9.org/showthread.php?t=183705

real.finder
29th January 2022, 14:19
I tried cropping the black bars then downscaling to e.g. 720x480, then doing tfm(), but it doesn't match correctly. I've tried other heights but none of them worked.

what about this https://forum.doom9.org/showthread.php?p=1823545#post1823545 idea

bruno321
29th January 2022, 22:34
Thank you both! Tried both of them. About the avs from post #2 in the link provided by Boulder: it doesn't achieve anything too good, at least with the default settings. I tried changing the values of the SelectEvery at the beginning, but it didn't help (not that I really understand what the script does, mind).

About the link by real.finder: tried this,

IResize(720,480,resifilter="resizex",res_params=""",desampling=true,kernel="Bilinear"""")

but it also doesn't give me any real improvement, unfortunately.

poisondeathray
29th January 2022, 23:52
It's the same idea as the other thread, just change the offset

The "#" denotes the "bad" frames. It's a repeating 5 frame cycle (makes sense because it was derived from telecine)

You need to specify an offset by 1 "b" frame, because you need a "good" frame to interpolate from. The current pattern starts and ends with a "bad frame" for every group of 5. So you need to include the 1st good frame from the next cycle, that's what "b1" specifies below

VPY

a = core.std.SelectEvery(clip, cycle=5, offsets=[0])#
b = core.std.SelectEvery(clip, cycle=5, offsets=[1])
c = core.std.SelectEvery(clip, cycle=5, offsets=[2])
d = core.std.SelectEvery(clip, cycle=5, offsets=[3])
e = core.std.SelectEvery(clip, cycle=5, offsets=[4])#

b1 = core.std.Trim(b, first=1) #offset b

int = core.std.Interleave(clips=[d,b1])
r24 = core.resize.Point(int, format=vs.RGBS, matrix_in_s="709")
r24 = core.rife.RIFE(r24, model=1)
r = core.std.SelectEvery(r24, cycle=4, offsets=[1])
r = core.resize.Point(r, format=vs.YUV420P8, matrix_s="709")

intf = core.std.Interleave(clips=[b,c,d,r])
intf.set_output()


You might want to apply other filters before interpolating (e.g. dotcrawl filters, antialiasing) , because artifacts will be propogated when you interpolate

EDIT: there are 2 frames where the pattern breaks after ~6sec (3 "combed" frames in a row instead of 2 in your source), by it goes back into phase after . There should be a smarter/adpative way to do this (instead of set pattern) , but normal "comb" detection filters might not detect upscaled combing properly

bruno321
30th January 2022, 05:15
Thanks! I've never used Vapoursynth, though. Trying it out now via Hybrid. But for the life of me I can't preview it.

Python exception: No attribute with the name rife exists.

I believe I have installed vsrife: pip install --upgrade vsrife says everything's up to date.

Seems to me I'm supposed to write from vsrife import RIFE in the script, before what you wrote.

But then I get

Python exception: No module named 'vsrife'

I don't have an NVIDIA card. Is that the problem?

Also, running python -m vsrife gives me :

No module named vsrife.__main__; 'vsrife' is a package and cannot be directly executed

poisondeathray
30th January 2022, 05:22
It's the same as the other thread; The vulkan version was used for that script rife.dll (so everyone can use it) . You can replace with the Cuda version if you want, it's faster than the Vulkcan version if you have relatively new Nvidia card
https://forum.doom9.org/showthread.php?p=1961320#post1961320

But the problem is there are 2 Cuda versions, the newest 4.x versions are based on Practical-RIFE (it's actually much faster, but quality lower in general than 2.3 or 2.4 models). If you want to use older models, you can copy a backup of the older version and name the folder something . So I have a vsrife folder, and a vsrife4 folder for the newer versions (there is only 4.0 so far, but newer versions will be added to this new branch) . Use a namespace to organize things (I use "RF3" for the older, and "RF4" for the newer)


from vsrife import RIFE as RF3
from vsrife4 import RIFE as RF4

#same thing using cuda version
r24 = RF3(clip, model_ver=2.4)



To get rid of the cadence break, you can interpolate over the error, but you need to manually specify frame numbers . I don't know of an easy way to auto detect / auto correct , because it's not really "combing", it's upscaled combing. Let me know if you want more info. There are interpolation functions based on Rife, similar to avisynth RX() , where you interpolate over 1,2,3,4 etc... frames. Rife is only 2x multiples currently, so secondary interpolation uses mvtools when needed for intermediate framerates

kedautinh12
30th January 2022, 05:23
If your card support vulkan. You can use it. Try update your card driver to latest ver