Log in

View Full Version : ProPainter...


Frank62
28th May 2024, 10:55
Hi, dear people!

This fantastic demonstration:
https://forum.doom9.org/showthread.php?p=1992324#post1992324
really impressed me, so I try it with a private project to remove vertical scratches.
ProPainter works fantastic, although I have some problems in detecting a really good mask, but that's ok.
The real problem:
The script does not work with more than a few thousand frames, because the mask can only be given in pngs, not as a video file, and ProPainter opens all these pictures at one time, which leads to a windows error "too many files opened".
I tried to change the script so that it accepts a video as mask, but it only works to a certain point, and Python is pain in the a** for me... :scared:

So the question:
Did anyone port ProPainter meanwhile to Vapoursynth? Or to something else, that is more usable? :thanks:

Selur
28th May 2024, 12:23
Did anyone port ProPainter meanwhile to Vapoursynth?
Dan64 is working on it, but stuck atm., see: https://forum.selur.net/thread-3720.html

Frank62
28th May 2024, 13:32
"The specified thread does not exist."
I also registered, but still the same. :confused:

Selur
28th May 2024, 13:54
fixed the link, accidentally deleted the original (3717 thread).

Frank62
28th May 2024, 14:42
Thanks, Selur.

poisondeathray
28th May 2024, 16:25
Thanks to Dan64 and Selur .

vspropainter-1.0.0_RC1 using cuda seems to work ok for me with device_index=0 . Much faster and GPU-z reports it working

I used Selur's BGR workaround in the script


clip = core.std.ShufflePlanes(clips=clip,planes=[2,1,0], colorfamily=vs.RGB)


I don't have hybrid ; I have it installed "normally"

Selur
28th May 2024, 16:34
@poisondeathray: adding 'enable_fp16=True' might also speed up things.

poisondeathray
28th May 2024, 16:38
@poisondeathray: adding 'enable_fp16=True' might also speed up things.

Yes I had that set - I always use that setting with propainter - there is virtually NIL difference in quality and significant memory usage reduction

Frank62
28th May 2024, 16:40
I tried every proposal of the readme that would make it faster, but everything you do in this case reduces quality a lot.
Edit: Wow. We seem to have very different experiences?
My concept for more speed is to spread the frames in 15 slices (HD) put it through ProPainter and then stack all together.


vspropainter-1.0.0_RC1 using cuda seems to work ok for me with device_index=0
The I have to postpone it, or is there a way to edit the numbers in windows somehow, so that my NVidia becomes device 0 (now 1)?

poisondeathray
28th May 2024, 16:47
I tried every proposal of the readme that would make it faster, but everything you do in this case reduces quality a lot.
Edit: Wow. We seem to have very different experiences?


FP16 makes little quality difference in my tests .

Being smart with the selection makes a bigger difference - eg. scene splits . More usable frames of similar content makes bigger difference . Contamination of "wrong" frames lowers the quality of the patch



The I have to postpone it, or is there a way to edit the numbers in windows somehow, so that my NVidia becomes device 0 (now 1)?

You can set device_index=0 in the vapoursynth script

There are adjustable parameters in the propainter call in the vpy script . Open __init__.py in text editor to see the options - the options are the same as the propainter project

Frank62
28th May 2024, 16:58
Ah, ok. I thought it would work only if the GPU to use had the ID 0, because you pointed it out.
Can someone post a working VS-Script for a Still-VS-Beginner, please? :script:

poisondeathray
28th May 2024, 17:36
Can someone post a working VS-Script for a Still-VS-Beginner, please? :script:
There is an example script and test video/mask download in selur's forum . It uses a static mask, but you can replace it with animated mask image sequence or video using the mask_path parameter

A simplified version might look like this (you might have to convert pixel formats / ranges differently depending on your inputs)


import vapoursynth as vs
import vspropainter
core = vs.core

clip = core.lsmas.LWLibavSource(r'PATH\input.mp4')
clip = core.resize.Bicubic(clip, format=vs.RGB24, matrix_in_s="709", range_s="full")

msk = core.lsmas.LWLibavSource(r'PATH\mask.mp4')

clip = propainter(clip, length=25, mask_path=msk, device_index=0, enable_fp16=True)

clip = core.std.ShufflePlanes(clips=clip,planes=[2,1,0], colorfamily=vs.RGB)

clip.set_output()

Frank62
28th May 2024, 18:20
Will try! Thanks a lot!

Selur
28th May 2024, 18:35
btw. if one of the Vapoursynth plugin developers has hints for Dan64 how to speed things up. he probably would be happy to get some pointers. :)
Using larger length values does seem to speed things up.