This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

[HELP] ReplaceSingle (to replace multi)
#14
(19.05.2025, 14:54)Selur Wrote: Do:
# replaces frame x +1 with a duplicate of x
def duplicate(clip: vs.VideoNode, x: int) -> vs.VideoNode:
    part1 = core.std.Trim(clip, 0, x)          # Frames 0 to x (inclusive)
    replacement = core.std.Trim(clip, x, x)    # Only frame x (duplicate)
    part3 = core.std.Trim(clip, x + 2, None)   # Frames x+2 to end
    return core.std.Splice([part1, replacement, part3], mismatch=True)
return duplicate(clip, 7361)
is faster and works.
If you wanted to duplicate 7361 and 7447 you would use:
# replaces frame x +1 with a duplicate of x
def duplicate(clip: vs.VideoNode, x: int) -> vs.VideoNode:
    part1 = core.std.Trim(clip, 0, x)          # Frames 0 to x (inclusive)
    replacement = core.std.Trim(clip, x, x)    # Only frame x (duplicate)
    part3 = core.std.Trim(clip, x + 2, None)   # Frames x+2 to end
    return core.std.Splice([part1, replacement, part3], mismatch=True)
clip = duplicate(clip, 7361)
clip = duplicate(clip, 7447)
return clip

Cu Selur

It works great!!!  Thank you for helping.  A useful tool, on a wish list to be part of Hybrid someday
Reply


Messages In This Thread
RE: ReplaceSingle - by Selur - 03.05.2025, 08:48
RE: ReplaceSingle (to replace multi) - by zspeciman - Yesterday, 20:13

Forum Jump:


Users browsing this thread: 1 Guest(s)