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 24th October 2020, 01:07   #4081  |  Link
_Al_
Registered User
 
Join Date: May 2011
Posts: 321
It does not work. I guess frame number in must be total out, its how it works.
Or maybe is there a way how to manipulate that n using lambda somehow?
Code:
clip2 = clip.std.FrameEval(lambda n: deint(n, clip=clip))
To do something with that n to force FrameEval pass more frames out than in?
_Al_ is offline   Reply With Quote
Old 26th October 2020, 04:13   #4082  |  Link
_Al_
Registered User
 
Join Date: May 2011
Posts: 321
Just tried it again, yes it works with that placeholder with doubled fps and doubled lenght,
not sure what went wrong yesterday, it seams to return clip correctly from FrameEval().
It works with both, partial and lambda function as well.
_Al_ is offline   Reply With Quote
Old 26th October 2020, 13:27   #4083  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
are clips with varying format no longer supported in API v4?
I notice that "format" is no longer a pointer in the "info" struct.
feisty2 is offline   Reply With Quote
Old 26th October 2020, 13:35   #4084  |  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
are clips with varying format no longer supported in API v4?
I notice that "format" is no longer a pointer in the "info" struct.
Nope, still supported. It's when the format is pfNone (0).
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 27th October 2020, 18:48   #4085  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
is it possible for a filter to return multiple nodes, and some of them are vnodes while others are anodes?
feisty2 is offline   Reply With Quote
Old 27th October 2020, 19:23   #4086  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
also, the documentation on calling python functions is a bit unclear, like it was not documented that the return value binds to the "val" key, if the function has multiple return values, will they all bind to "val"?

Last edited by feisty2; 27th October 2020 at 19:26.
feisty2 is offline   Reply With Quote
Old 27th October 2020, 22:49   #4087  |  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
is it possible for a filter to return multiple nodes, and some of them are vnodes while others are anodes?
Filters can't but functions can. A single VSMap key can only hold anodes or vnodes.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 28th October 2020, 11:05   #4088  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
Quote:
Filters can't but functions can.
okay, then how do I retrieve the return values from such function in a C++ plugin? I know the first return value binds to "val", what about other return values?
feisty2 is offline   Reply With Quote
Old 29th October 2020, 19:33   #4089  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
I played with some pretty ugly hacks

Code:
// C++ plugin
auto ret = VSFuncRef_stuff();
auto msg = ""s;
auto m = ret.map_pointer;

for (auto x : Range{ vsapi->propNumKeys(m) }) {
    msg += vsapi->propGetKey(m, x);
    msg += "\n";
}

throw msg;

# Python tests
def f():
    return 'aaa', 'bbb'

def g():
    return 'aaa', 123

core.???.Test(f) # okay, error message says "val"
core.???.Test(g) # error message says "not all values are of the same type in val"
and observed from the error log of vsedit that:
1) it is allowed to call a python function with multiple return values of the same type
2) all return values bind to the same key called "val"
3) it is not allowed to call a python function with multiple return values of different types because of 2)

@Myrsloik
technical details like this should really be documented rather than leave us wild guessing and poking around.
feisty2 is offline   Reply With Quote
Old 31st October 2020, 09:45   #4090  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
is paTouch removed from api v4?
feisty2 is offline   Reply With Quote
Old 31st October 2020, 12:31   #4091  |  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
is paTouch removed from api v4?
Yes, there's the mapSetEmpty() instead.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 5th November 2020, 21:08   #4092  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
is there an example for createFunc(), it seems like a way to call arbitrary C++ functions in py scripts?
feisty2 is offline   Reply With Quote
Old 5th November 2020, 23:17   #4093  |  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
is there an example for createFunc(), it seems like a way to call arbitrary C++ functions in py scripts?
I think it's only used in python code (see vapoursynth.pyx for c-ish code) and then lut/lut2 for a callFunc() example.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 8th November 2020, 12:39   #4094  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,259
Is there some known issue with fmtc and R52?
using:
Code:
# Imports
import vapoursynth as vs
core = vs.get_core()
# Loading Plugins
core.std.LoadPlugin(path="I:/workspace/Hybrid/debug/64bit/vsfilters/Support/fmtconv.dll")
core.std.LoadPlugin(path="I:/workspace/Hybrid/debug/64bit/vsfilters/SourceFilter/FFMS2/ffms2.dll")
# source: 'F:\TestClips&Co\files\test.avi'
# current color space: YUV420P8, bit depth: 8, resolution: 640x352, fps: 25, color matrix: 470bg, yuv luminance scale: limited, scanorder: progressive
# Loading source using FFMS2
clip = core.ffms2.Source(source="F:/TestClips&Co/files/test.avi",cachefile="E:/Temp/avi_078c37f69bb356e7b5fa040c71584c40_853323747.ffindex",format=vs.YUV420P8,alpha=False)
# making sure input color matrix is set as 470bg
clip = core.resize.Point(clip, matrix_in_s="470bg",range_s="limited")
# making sure frame rate is set to 25
clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
# Setting color range to TV (limited) range.
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
original = clip
clip = core.fmtc.resample(clip=clip, kernel="gaussian", w=1280, h=704, interlaced=False, interlacedd=False)
original = core.fmtc.resample(clip=original, kernel="bicubic", w=1280, h=704, interlaced=False, interlacedd=False)
# adjusting output color from: YUV420P16 to YUV420P8 for FFvHuffModel (i420@8)
clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P8, range_s="limited")
# adjusting for FilterView
if (original.format.id != clip.format.id):
  if (original.format.color_family == vs.RGB and clip.format.color_family != vs.RGB):
    original = core.resize.Bicubic(clip=original, format=clip.format.id, matrix_s="470bg", range_s="limited")
  elif (original.format.color_family == clip.format.color_family):
    original = core.resize.Bicubic(clip=original, format=clip.format.id, range_s="limited")
  else:
    original = core.resize.Bicubic(clip=original, format=clip.format.id, matrix_in_s="470bg", range_s="limited")
stacked = core.std.StackHorizontal([original,clip])
# set output frame rate to 25.000fps
stacked = core.std.AssumeFPS(clip=stacked, fpsnum=25, fpsden=1)
# Output
stacked.set_output()
both Vapoursynth Editor and vspipe both sometimes crash without an error, while other times vspipe crashes after a few hundred frames and then both run fine.

Cu Selur
__________________
Hybrid here in the forum, homepage
Selur is offline   Reply With Quote
Old 8th November 2020, 15:11   #4095  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
is copyFrameProps removed from API v4?
feisty2 is offline   Reply With Quote
Old 8th November 2020, 16:41   #4096  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,548
Quote:
Originally Posted by Selur View Post
Is there some known issue with fmtc and R52?
using:
...
both Vapoursynth Editor and vspipe both sometimes crash without an error, while other times vspipe crashes after a few hundred frames and then both run fine.

Cu Selur
Hard to tell what causes it without some kind of crash dump for debugging. I haven't seen any reported issues and nothing has changed in VS in frame/filter handling.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 8th November 2020, 16:42   #4097  |  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
is copyFrameProps removed from API v4?
I think I did. It was replaced with a map copy functions so you have to go the long way around and use that instead.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 8th November 2020, 21:20   #4098  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
there's no preset for audio formats?
feisty2 is offline   Reply With Quote
Old 10th November 2020, 19:30   #4099  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
is it possible to change the API for releaseFrameEarly to void(const VSFrameRef*, VSFrameContext*) (release directly from a frame object rather than from a node object)?
the current API kind of breaks RAII for C++, a frame object always keeps the ownership of its underlying frame reference, if a frame reference is released from a node, there's no way to inform the frame object who's keeping the ownership of the reference that the reference has expired, and there will be a "double free" error after getFrame() returns.
feisty2 is offline   Reply With Quote
Old 10th November 2020, 19:47   #4100  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
or maybe releaseFrameEarly() could set a frame to a "zombie" mode, the most memory consuming part (the image content of the frame) is instantly released after calling this function, but the frame header, particularly the part that's keeping the reference count is still alive in the memory, so there won't be a "double free" error when any frame object goes out of scope.
feisty2 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 00:36.


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