Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > VapourSynth

Reply
 
Thread Tools Search this Thread Display Modes
Old 18th February 2021, 03:02   #4221  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,657
What is the correct scenario for use of setting max cache size? I have a 1080i source with QTGMC(Preset='Medium'), setting max cache size to 4000 MB will give me a "script exceeded memory limit" warning, raising it to 12,000 MB will clear the warning, but there is no difference in speed on benchmark at 41 fps.
lansing is offline   Reply With Quote
Old 23rd February 2021, 12:29   #4222  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
Quote:
Originally Posted by lansing View Post
I got the dummy filter printing messages now, but for some reason the logging module is not catching warnings on evaluation

The same codes worked on PyCharm, but in vseditor, I'm getting error about the WarningMessages list still being empty. It will print if I passed in a list core.vsedit.Logger(["message1", "message2"])

Update: I think the reason for this is because vs disabled the warnings so they aren't even logged.
add these 2 lines
Code:
import logging
import warnings

class MessageAbsorber(logging.Handler):
    def __init__(self, MessageContainer):
        logging.Handler.__init__(self)
        self.MessageContainer = MessageContainer
    def emit(self, MessageRecord):
        self.MessageContainer += [MessageRecord.getMessage()]

WarningMessages = []
warnings.simplefilter('always')
logging.captureWarnings(True)
logging.getLogger('py.warnings').addHandler(MessageAbsorber(WarningMessages))

# user script goes here

core.vsedit.PrintWarnings(WarningMessages)
feisty2 is offline   Reply With Quote
Old 28th February 2021, 17:44   #4223  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
@Myrsloik
could you add
Code:
const char* getPluginName(VSPlugin*);
const char* getPluginNamespace(VSPlugin*);
const char* getPluginIdentifier(VSPlugin*);
const char* getPluginFunctionArguments(VSPlugin*, const char* functionName);
to APIv3? so the instantiation of a single plugin object or plugin func object can get rid of the super expensive getPlugins() or getFunctions()
feisty2 is offline   Reply With Quote
Old 8th March 2021, 20:44   #4224  |  Link
Jukus
Registered User
 
Join Date: Jul 2019
Location: Russia
Posts: 87
I got some strange BD with almost 100 m2ts files and they are not in chronological order.
Is there any way to parse such a disc for VS?
Jukus is offline   Reply With Quote
Old 8th March 2021, 21:47   #4225  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 1,795
Maybe this mpls reader can help https://github.com/HomeOfVapourSynth...Synth-ReadMpls
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth
VapourSynth Portable FATPACK || VapourSynth Database
ChaosKing is offline   Reply With Quote
Old 8th March 2021, 22:10   #4226  |  Link
videoh
Useful n00b
 
Join Date: Jul 2014
Posts: 1,667
Quote:
Originally Posted by Jukus View Post
I got some strange BD with almost 100 m2ts files and they are not in chronological order.
Is there any way to parse such a disc for VS?
One option: DGDecNV.

BTW, that's not so strange. It's quite common. For example, MONSTERS_UNIVERSITY has 154 M2TS files.
videoh is offline   Reply With Quote
Old 11th March 2021, 11:56   #4227  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
it seems that nfNoCache is now the only node flag in API v4, has nfMakeLinear been replaced by std.Cache(make_linear = True)?
are fmFrameState (API v4) and fmSerial (API v3) the same thing?
feisty2 is offline   Reply With Quote
Old 11th March 2021, 12:47   #4228  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,548
Quote:
Originally Posted by feisty2 View Post
it seems that nfNoCache is now the only node flag in API v4, has nfMakeLinear been replaced by std.Cache(make_linear = True)?
are fmFrameState (API v4) and fmSerial (API v3) the same thing?
Yes, you have to add a cache with std.Cache(make_linear = True) yourself. Preferably inside the filter constructor that needs it.

fmFrameState and fmSerial are still separate things.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 11th March 2021, 13:07   #4229  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
Quote:
Originally Posted by Myrsloik View Post

fmFrameState and fmSerial are still separate things.
so fmSerial has been removed in API v4, could you elaborate on how they are different?
feisty2 is offline   Reply With Quote
Old 11th March 2021, 13:36   #4230  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,548
Quote:
Originally Posted by feisty2 View Post
so fmSerial has been removed in API v4, could you elaborate on how they are different?
Never mind, fmFrameState = fmSerial. I renamed it so people won't think it makes frame accesses more linear which is a common confusion.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 13th March 2021, 00:53   #4231  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,259
Got a question:
In case it use SelectEvery to split a clip into two clips:
Code:
clipA = core.std.SelectEvery(clip=clip, cycle=5, offsets=[0 3 4])
clipB = core.std.SelectEvery(clip=clip, cycle=5, offsets=[1 2])
(no frames get lost or are present in both clips)
and apply some additional filters to those clips, how can I weave those two clips properly together again?
Is there some sort of advanced Interleave which I could use with the offsets I used before.

Alternatively: How can I apply a filter only to specific frames which follow a pattern (given by cycle and offsets)?

Cu Selur

Ps.: may be using https://github.com/Irrational-Encodi...th-RemapFrames ?
__________________
Hybrid here in the forum, homepage

Last edited by Selur; 13th March 2021 at 00:56.
Selur is offline   Reply With Quote
Old 13th March 2021, 02:09   #4232  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,346
Quote:
Originally Posted by Selur View Post
Got a question:
In case it use SelectEvery to split a clip into two clips:
Code:
clipA = core.std.SelectEvery(clip=clip, cycle=5, offsets=[0 3 4])
clipB = core.std.SelectEvery(clip=clip, cycle=5, offsets=[1 2])
(no frames get lost or are present in both clips)
and apply some additional filters to those clips, how can I weave those two clips properly together again?
Is there some sort of advanced Interleave which I could use with the offsets I used before.

Alternatively: How can I apply a filter only to specific frames which follow a pattern (given by cycle and offsets)?

Cu Selur

Ps.: may be using https://github.com/Irrational-Encodi...th-RemapFrames ?


Or ugly "old fashioned" way

Code:
clipA = core.std.SelectEvery(clip, cycle=5, offsets=[0, 3, 4])
clipB = core.std.SelectEvery(clip, cycle=5, offsets=[1, 2])

clipA0 = core.std.SelectEvery(clipA, cycle=3, offsets=[0])
clipA3 = core.std.SelectEvery(clipA, cycle=3, offsets=[1])
clipA4 = core.std.SelectEvery(clipA, cycle=3, offsets=[2])

clipB1 = core.std.SelectEvery(clipB, cycle=2, offsets=[0])
clipB2 = core.std.SelectEvery(clipB, cycle=2, offsets=[1])

int = core.std.Interleave(clips=[clipA0,clipB1,clipB2,clipA3,clipA4])
poisondeathray is offline   Reply With Quote
Old 13th March 2021, 10:23   #4233  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,259
Quote:
Or ugly "old fashioned" way
What's the other alternative? I don't see how I could use RemapFrames for this,...

Cu Selur
__________________
Hybrid here in the forum, homepage
Selur is offline   Reply With Quote
Old 13th March 2021, 17:08   #4234  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
for any m < n, is it guaranteed that VS will only call getFrame(n, arAllFramesReady) after getFrame(m, arAllFramesReady) has completed for fmParallelRequests, fmUnordered and fmSerial?
feisty2 is offline   Reply With Quote
Old 13th March 2021, 23:53   #4235  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,548
Quote:
Originally Posted by feisty2 View Post
for any m < n, is it guaranteed that VS will only call getFrame(n, arAllFramesReady) after getFrame(m, arAllFramesReady) has completed for fmParallelRequests, fmUnordered and fmSerial?
Nope. There's no api guarantee at all for order. There is however an internal tag that keeps track of the request number and takes it into consideration when scheduling things so most of the time things will be kinda in order.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 14th March 2021, 02:30   #4236  |  Link
_Al_
Registered User
 
Join Date: May 2011
Posts: 321
Quote:
How can I apply a filter only to specific frames which follow a pattern (given by cycle and offsets)?
what comes to mind is to use Python, same as if you'd code something, as if coding in Python
Code:
import vapoursynth as vs
from vapoursynth import core
clip = core.std.BlankClip(format=vs.YUV420P8, color =(100,128,128))

def bright(clip):
    return clip.std.Expr(["x 40 +","",""])

def dark(clip):
    return clip.std.Expr(["x 40 -","",""])

DISTRIBUTE_FILTER = {
                      0: bright,
                      1: dark,
                      2: dark,
                      3: bright,
                      4: bright,
                    }

clip_out = clip.std.FrameEval(lambda n: DISTRIBUTE_FILTER[n % len(DISTRIBUTE_FILTER)](clip))
clip_out.set_output()
to use lambda could be overwhelming so to call a function from FrameEval():
Code:
import functools
def distribute_filter(n,clip=clip):
    return DISTRIBUTE_FILTER[n % len(DISTRIBUTE_FILTER)](clip)
clip_out = core.std.FrameEval(clip, functools.partial(distribute_filter,clip=clip))

Last edited by _Al_; 14th March 2021 at 02:40.
_Al_ is offline   Reply With Quote
Old 15th March 2021, 01:46   #4237  |  Link
AOmundson
Registered User
 
Join Date: Dec 2017
Posts: 15
I'm attempting to decomb a video clip using TDeintMod, but it keeps outputting an error that I have no idea how to solve.

Script:
Code:
import vapoursynth as vs
core = vs.get_core()
core.max_cache_size = 32768

clip = r'D:\Video\1.mkv' #replace with your video file

def conditionalDeint(n, f, orig, deint):
    if f.props['_Combed']:
        return deint
    else:
        return orig

deint = core.tdm.TDeintMod(clip, order=1, edeint=core.nnedi3.nnedi3(clip, field=1))
combProps = core.tdm.IsCombed(clip)
clip = core.std.FrameEval(clip, functools.partial(conditionalDeint, orig=clip, deint=deint), combProps)

clip.set_output()
Error Message:
Code:
2021-03-14 19:43:13.737
Failed to evaluate the script:
Python exception: nnedi3: argument clip was passed an unsupported type (expected clip compatible type but got str)

Traceback (most recent call last):
File "src\cython\vapoursynth.pyx", line 2244, in vapoursynth.vpy_evaluateScript
File "src\cython\vapoursynth.pyx", line 2245, in vapoursynth.vpy_evaluateScript
File "E:\VapourSynthEditor\Decomb.vpy", line 13, in 
deint = core.tdm.TDeintMod(clip, order=1, edeint=core.nnedi3.nnedi3(clip, field=1))
File "src\cython\vapoursynth.pyx", line 2056, in vapoursynth.Function.__call__
vapoursynth.Error: nnedi3: argument clip was passed an unsupported type (expected clip compatible type but got str)
AOmundson is offline   Reply With Quote
Old 15th March 2021, 02:13   #4238  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,346
Quote:
Originally Posted by AOmundson View Post
I'm attempting to decomb a video clip using TDeintMod, but it keeps outputting an error that I have no idea how to solve.

Script:
Code:
import vapoursynth as vs
core = vs.get_core()
core.max_cache_size = 32768

clip = r'D:\Video\1.mkv' #replace with your video file

def conditionalDeint(n, f, orig, deint):
    if f.props['_Combed']:
        return deint
    else:
        return orig

deint = core.tdm.TDeintMod(clip, order=1, edeint=core.nnedi3.nnedi3(clip, field=1))
combProps = core.tdm.IsCombed(clip)
clip = core.std.FrameEval(clip, functools.partial(conditionalDeint, orig=clip, deint=deint), combProps)

clip.set_output()
Error Message:
Code:
2021-03-14 19:43:13.737
Failed to evaluate the script:
Python exception: nnedi3: argument clip was passed an unsupported type (expected clip compatible type but got str)

Traceback (most recent call last):
File "src\cython\vapoursynth.pyx", line 2244, in vapoursynth.vpy_evaluateScript
File "src\cython\vapoursynth.pyx", line 2245, in vapoursynth.vpy_evaluateScript
File "E:\VapourSynthEditor\Decomb.vpy", line 13, in 
deint = core.tdm.TDeintMod(clip, order=1, edeint=core.nnedi3.nnedi3(clip, field=1))
File "src\cython\vapoursynth.pyx", line 2056, in vapoursynth.Function.__call__
vapoursynth.Error: nnedi3: argument clip was passed an unsupported type (expected clip compatible type but got str)

Did you load the video with a source filter?

Code:
clip = r'D:\Video\1.mkv' #replace with your video file
should be something like this
Code:
clip = core.lsmas.LWLibavSource(r'D:\Video\1.mkv')
poisondeathray is offline   Reply With Quote
Old 15th March 2021, 03:13   #4239  |  Link
AOmundson
Registered User
 
Join Date: Dec 2017
Posts: 15
Quote:
Originally Posted by poisondeathray View Post
Did you load the video with a source filter?

Code:
clip = r'D:\Video\1.mkv' #replace with your video file
should be something like this
Code:
clip = core.lsmas.LWLibavSource(r'D:\Video\1.mkv')
Thanks, that fixed that error, but I'm currently suffering another one.
Code:
2021-03-14 21:12:32.715
Failed to evaluate the script:
Python exception: lsmas: failed to construct index.

Traceback (most recent call last):
File "src\cython\vapoursynth.pyx", line 2244, in vapoursynth.vpy_evaluateScript
File "src\cython\vapoursynth.pyx", line 2245, in vapoursynth.vpy_evaluateScript
File "E:\VapourSynthEditor\Decomb.vpy", line 6, in 
clip = core.lsmas.LWLibavSource(clip)
File "src\cython\vapoursynth.pyx", line 2069, in vapoursynth.Function.__call__
vapoursynth.Error: lsmas: failed to construct index.
On that note, would you recommend FFmpeg or LSMASH for de-combing cartoons/anime without creating new combing lines?

Last edited by AOmundson; 15th March 2021 at 03:16.
AOmundson is offline   Reply With Quote
Old 15th March 2021, 03:32   #4240  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,346
Quote:
Originally Posted by AOmundson View Post
Thanks, that fixed that error, but I'm currently suffering another one.
Code:
2021-03-14 21:12:32.715
Failed to evaluate the script:
Python exception: lsmas: failed to construct index.

Traceback (most recent call last):
File "src\cython\vapoursynth.pyx", line 2244, in vapoursynth.vpy_evaluateScript
File "src\cython\vapoursynth.pyx", line 2245, in vapoursynth.vpy_evaluateScript
File "E:\VapourSynthEditor\Decomb.vpy", line 6, in 
clip = core.lsmas.LWLibavSource(clip)
File "src\cython\vapoursynth.pyx", line 2069, in vapoursynth.Function.__call__
vapoursynth.Error: lsmas: failed to construct index.
On that note, would you recommend FFmpeg or LSMASH for de-combing cartoons/anime without creating new combing lines?

Did you get the path correct ?

Are you using recent LSmash version ?

Personally, I would use neither for a DVD source. DGSource if you have a Nvidia card and license, or DGDecode / d2v.Source are more reliable
poisondeathray is offline   Reply With Quote
Reply

Tags
speed, vaporware, vapoursynth

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 16:10.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.