Log in

View Full Version : Mask/Overlay a video to "undo rsmb/interp smearing"


Couleur
6th May 2022, 16:45
Hey, I'm using mv.Flowblur (thanks poisondeathray) to replicate RSMB and it does a lot of smearing on my gameplay footage's GUI (e.g health bar).

That made me think; why not make some sort of make which replaces parts of the video by it's original one, via the use of a mask

Example for Apex Legends:

Mask (made it in literally 3 minutes, just to show what i mean):
https://i.imgur.com/uOaEoad.png
GUI looks like this:
https://i.imgur.com/jj0WG3P.png

process I could imagine it going through:

clip = ffms2.Source("video.mp4")
mask = getimage("apexlegends.png")
original = clip
clip = blur (clip)
clip = merge(clip, mask, original)
clip .set_output()


Any knowledgeable fellas know plugins or scripts that would be capable to do this sort of masking/overlay?

_Al_
6th May 2022, 20:29
Masks are handy if using black and white , not green and white in avs, vs, so you can change that mask from green to black changing greens to shade of grays instead , then cranking contrast to push black to zero but leave whites.

import vapoursynth as vs
from vapoursynth import core
import havsfunc
clip = core.lsmas.LibavSMASHSource('video.mp4')
filtered = clip.std.Expr(expr=['x 100 -','','']) #your filter here instead
GW = core.ffms2.Source('uOaEoad.png'])
BW = GW.resize.Bicubic(clip.width,clip.height, matrix_s='709',format=vs.GRAY8)
BW = BW.std.Levels( min_in=0, max_in=235, gamma =0.05, min_out=0, max_out=255)
clip = havsfunc.Overlay(clip, filtered, mask=BW)
clip.set_output()