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 3rd September 2021, 05:41   #101  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 4,740
Quote:
Originally Posted by Myrsloik View Post
Yes, now alt_output is an optional argument to set_output(). Makes more sense that way.
It "works" , but same problems as last version ie. wrong fourcc for UYVY, avfs crashes

Quote:
Originally Posted by poisondeathray View Post

But with Core R55, ffmpeg still reports Y42B, yuv422p for the yuv422 alt2 script .

Also, avfs now crashes when file is accessed, even a plain BlankClip script (without alt_output options) . It "mounts", but as soon as you touch or access the fake avi, it crashes no helpful error message

Calling old avfs with same plain BlankClip script does not crash
poisondeathray is offline   Reply With Quote
Old 4th September 2021, 12:12   #102  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,419
RC3 posted. Fixes the reported deadlock and avfs crashes on vpy script access (really tested this time).
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 4th September 2021, 18:47   #103  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 4,740
Quote:
Originally Posted by Myrsloik View Post
RC3 posted. Fixes the reported deadlock and avfs crashes on vpy script access (really tested this time).
avfs and alt_output issues fixed, thanks

Question about vspipe and alt_output - Does the alt_output fourcc emulation only work with avfs ? ffmpeg reports different fourcc with vspipe input using y4m headers (-c y4m), using same script that worked with avfs.

eg.
vspipe -c y4m yuv422_alt2.vpy - | ffmpeg -f yuv4mpegpipe -i - -an -f null NUL
reports Y42B, yuv422p instead of the expected UYVY, uyvy422

But,
avfs yuv422_alt2.vpy
reports the expected UYVY (and it works ok in programs like Premiere, gets YUV treatment, passthough)

(I don't think it matters that much, the alt_output /fourcc probably only be used for avfs - it's just a curiosity question)
poisondeathray is offline   Reply With Quote
Old 4th September 2021, 18:59   #104  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,419
Quote:
Originally Posted by poisondeathray View Post
avfs and alt_output issues fixed, thanks

Question about vspipe and alt_output - Does the alt_output fourcc emulation only work with avfs ? ffmpeg reports different fourcc with vspipe input using y4m headers (-c y4m), using same script that worked with avfs.

eg.
vspipe -c y4m yuv422_alt2.vpy - | ffmpeg -f yuv4mpegpipe -i - -an -f null NUL
reports Y42B, yuv422p instead of the expected UYVY, uyvy422

But,
avfs yuv422_alt2.vpy
reports the expected UYVY (and it works ok in programs like Premiere, gets YUV treatment, passthough)

(I don't think it matters that much, the alt_output /fourcc probably only be used for avfs - it's just a curiosity question)
You're probably a bit format confused. Y4M is a super basic "container" that only allows planar yuv. Nothing else. It doesn't have the concept of fourcc or packed formats. That's why alt_output does nothing outside of avfs and vfw.

BUT for some reason FFmpeg decides to print out Y42B since that fourcc is effectively the same storage format as Y4M with the supplied headers. Pure coincidence.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 4th September 2021, 19:10   #105  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 4,740
Quote:
Originally Posted by Myrsloik View Post
You're probably a bit format confused. Y4M is a super basic "container" that only allows planar yuv. Nothing else. It doesn't have the concept of fourcc or packed formats. That's why alt_output does nothing outside of avfs and vfw.
So vspipe rawvideo would not act any differently either ?
poisondeathray is offline   Reply With Quote
Old 4th September 2021, 19:11   #106  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,419
Quote:
Originally Posted by poisondeathray View Post
So vspipe rawvideo would not act any differently either ?
Correct, there's no reason to. Everything that supports pipe input can accept pure planar nowadays.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 4th September 2021, 19:13   #107  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 4,740
Quote:
Originally Posted by Myrsloik View Post
Correct, there's no reason to. Everything that supports pipe input can accept pure planar nowadays.
Thanks
poisondeathray is offline   Reply With Quote
Old 6th September 2021, 01:04   #108  |  Link
Yomiko
Registered User
 
Join Date: Aug 2021
Posts: 39
It seems the VideoOutputTuple confuses existing python scripts that read vpy using runpy. For a video clip, in script.vpy
Code:
clip.set_output(2)
In python that handles both old and new api
Code:
runpy.run_path(script.vpy, dict(), '__vapoursynth__')
try:
    clip = vs.get_output(2)[0]
except TypeError:
    clip = vs.get_output(2)
vspreview may be modified to treat it as a tuple. Meanwhile in vseditor I don't see anything different from before.

May I know whether there will be further changes for this, like, backward compatibility for python or more breaking changes for vsscript?

Last edited by Yomiko; 6th September 2021 at 01:09.
Yomiko is offline   Reply With Quote
Old 6th September 2021, 09:08   #109  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,419
Quote:
Originally Posted by Yomiko View Post
It seems the VideoOutputTuple confuses existing python scripts that read vpy using runpy. For a video clip, in script.vpy
Code:
clip.set_output(2)
In python that handles both old and new api
Code:
runpy.run_path(script.vpy, dict(), '__vapoursynth__')
try:
    clip = vs.get_output(2)[0]
except TypeError:
    clip = vs.get_output(2)
vspreview may be modified to treat it as a tuple. Meanwhile in vseditor I don't see anything different from before.

May I know whether there will be further changes for this, like, backward compatibility for python or more breaking changes for vsscript?
I think I'm done with all breaking changes now unless someone discovers something really broken.

I thought about adding an AudioOutputTuple but couldn't think of any additional information that'd be useful.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet

Last edited by Myrsloik; 6th September 2021 at 09:14.
Myrsloik is offline   Reply With Quote
Old 7th September 2021, 05:32   #110  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Finland
Posts: 5,189
Was the support for this old non-recommended style now removed? There are several utility scripts and tools like muvsfunc, mvsfunc and Zopti which use that and need some fixing.

import vapoursynth as vs
core = vs.core
__________________
And if the band you're in starts playing different tunes
I'll see you on the dark side of the Moon...
Boulder is offline   Reply With Quote
Old 7th September 2021, 08:52   #111  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,419
Quote:
Originally Posted by Boulder View Post
Was the support for this old non-recommended style now removed? There are several utility scripts and tools like muvsfunc, mvsfunc and Zopti which use that and need some fixing.

import vapoursynth as vs
core = vs.core
Uh no? core=vs.core should work

I only removed vs.get_core()
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 7th September 2021, 09:12   #112  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Finland
Posts: 5,189
Quote:
Originally Posted by Myrsloik View Post
Uh no? core=vs.core should work

I only removed vs.get_core()
Ah, I prolly looked too quickly and confused the two. The latter one is most likely still in use in a lot of older scripts but fortunately trivial to fix.
__________________
And if the band you're in starts playing different tunes
I'll see you on the dark side of the Moon...
Boulder is offline   Reply With Quote
Old 8th September 2021, 04:59   #113  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,492
I ran into problem calling freeScript() in vsedit2. It kept crashing the program. Then I make a simple test with one button calling createScript() and one button calling freeScript():

Code:
VSScript * testVSScriptEnv;

void testCreateScript()
{
    if(testVSScriptEnv == nullptr)
        testVSScriptEnv = VSScriptAPI->createScript(nullptr);
}

void testFreeScript()
{
    if (testVSScriptEnv) {
        VSScriptAPI->freeScript(testVSScriptEnv);
    }
}
If I go createScript -> freeScript -> createScript -> freeScript, the program will crash.

Last edited by lansing; 8th September 2021 at 12:37. Reason: typo
lansing is online now   Reply With Quote
Old 8th September 2021, 12:35   #114  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,419
Quote:
Originally Posted by lansing View Post
I ran into problem calling freeScript() in vsedit2. It kept crashing the program. Then I make a simple test with one button calling createScript() and one button calling freeScript():

Code:
VSScript * testVSScriptEnv;

void testCreateScript()
{
    if(testVSScriptEnv == nullptr)
        VSScriptAPI->createScript(nullptr);
}

void testFreeScript()
{
    if (testVSScriptEnv) {
        VSScriptAPI->freeScript(testVSScriptEnv);
    }
}
If I go createScript -> freeScript -> createScript -> freeScript, the program will crash.
Can't reproduce
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 8th September 2021, 12:41   #115  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,492
Quote:
Originally Posted by Myrsloik View Post
Can't reproduce
I forgot the "testVSScriptEnv =" line in the above post, can you test again?
lansing is online now   Reply With Quote
Old 8th September 2021, 12:45   #116  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,419
Quote:
Originally Posted by lansing View Post
I forgot the "testVSScriptEnv =" line in the above post, can you test again?
Obviously I adjusted it for those things. Still worked.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 9th September 2021, 00:35   #117  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,492
Quote:
Originally Posted by Myrsloik View Post
Obviously I adjusted it for those things. Still worked.
I found my problem. I was trying to reuse the temporary node reference. I passed it into a function, and then freed the node inside the function. And then when I free the environment, it will crash.

Code:
VSNode * pProcessingNode = m_cpVSAPI->addNodeRef(pOutputNode);
pProcessingNode = resizePlugin(pProcessingNode);
pProcessingNode = otherPlugin(pProcessingNode);

VSNode * resizePlugin (VSNode * a_pVideoNode) {
    m_cpVSAPI->mapSetNode(pArgumentMap, "clip", a_pVideoNode, maReplace);
    VSMap * pResultMap = m_cpVSAPI->invoke(pResizePlugin, "Point", pArgumentMap);
    VSNode * pResultNode = m_cpVSAPI->mapGetNode(pResultMap, "clip", 0, nullptr);

    m_cpVSAPI->freeNode(a_pVideoNode);
    return pResultNode;
}
What is the correct way to do this?
lansing is online now   Reply With Quote
Old 9th September 2021, 09:51   #118  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,419
Code:
VSNode * pProcessingNode = m_cpVSAPI->addNodeRef(pOutputNode);
pProcessingNode = resizePlugin(pProcessingNode);
pProcessingNode = otherPlugin(pProcessingNode);

VSNode * resizePlugin (VSNode * a_pVideoNode) {
    VSMap *pArgumentMap = m_cpVSAPI->createMap();
    m_cpVSAPI->mapConsumeNode(pArgumentMap, "clip", a_pVideoNode, maReplace);
    VSMap * pResultMap = m_cpVSAPI->invoke(pResizePlugin, "Point", pArgumentMap);
    m_cpVSAPI->freeMap(pArgumentMap);
    // use mapGetError(pResultMap) here if you need to check for errors
    VSNode * pResultNode = m_cpVSAPI->mapGetNode(pResultMap, "clip", 0, nullptr);
    m_cpVSAPI->freeMap(pResultMap);
    return pResultNode;
}
At the end you have pProcessingNode and pOutputNode that needs to be freed.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 9th September 2021, 15:49   #119  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,492
Quote:
Originally Posted by Myrsloik View Post
At the end you have pProcessingNode and pOutputNode that needs to be freed.
Thanks I got it working.
lansing is online now   Reply With Quote
Old 10th September 2021, 00:29   #120  |  Link
_Al_
Registered User
 
Join Date: May 2011
Posts: 218
All working here so far, this is nice.
Also attempt to drag audio along with video, here in vapoursynth attaching audio to video frames using props.
But the code below does not work because ModifyFrame does not work with anode. vnode only. ModifyFrame (or FrameEval) is planned in future or is it a bad idea?

oh I see, n is not the same for vnode as is for anode, this could not work, only if bunch of anode frames (perhaps list) is attached to vnode and then reconstructed again, no idea how anisynth does it,

also deleting previous code to not confuse anyone

Last edited by _Al_; 10th September 2021 at 00:49.
_Al_ is offline   Reply With Quote
Reply

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 23:54.


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