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 27th December 2017, 23:07   #1  |  Link
Stephen R. Savage
Registered User
 
Stephen R. Savage's Avatar
 
Join Date: Nov 2009
Posts: 337
How to run Avisynth scripts within VapourSynth

README:
Quote:
Embed 32-bit Avisynth 2.6 or Avisynth+ environment within 64-bit VapourSynth.

Code:
avsw.Eval(string script, clip[] "clips", string[] "clip_names", string "avisynth", string "slave", string "slave_log")
script - Avisynth script fragment
clips - VapourSynth clips ("nodes") to inject into Avisynth environment
clip_names - Avisynth variable name corresponding to injected clip
avisynth - Path to Avisynth DLL. The default uses the process DLL search path.
slave - Path to avshost_native.exe slave procecss. The plugin path is searched by default.
slave_log - Log file for slave process.

The function returns the result of the Avisynth script, which may be an integer, float, string, or clip. If the result is a clip, the name of the return value is "clip", otherwise it is "result".
Example:
Code:
import vapoursynth as vs

core = vs.get_core()

red = core.std.BlankClip(color=[255, 0, 0])
green = core.std.BlankClip(color=[0, 255, 0])
# Before executing the Avisynth script, "r" and "g" are set to the bound clips.
c = core.avsw.Eval("Merge(r, g)", clips=[red, green], clip_names=["r", "g"])
c.set_output()
Link.

Last edited by Stephen R. Savage; 13th January 2018 at 18:48.
Stephen R. Savage is offline   Reply With Quote
Old 28th December 2017, 01:53   #2  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 488
NICE!!

Code:
c = core.std.BlankClip(color=[255, 0, 0])
c = core.avsw.eval('AddAutoloadDir("D:\\AvisynthRepository\\SCRIPTS") mpeg2source("D:\\01.d2v") AnimeIVTC(mode=1)', clips=[c], clip_names=["last"])
clip=c

This avs script crashed via Avisource and with avfs.exe, but avsproxy is stable.

Two questions:
- Is it possible to use avisynth x64 with this filter?
- Would be a "portable" avisynth possible as long as avisynth.dll is in the same folder? (or via path parameter in avsw)
__________________
Search and denoise

Last edited by ChaosKing; 28th December 2017 at 01:56.
ChaosKing is offline   Reply With Quote
Old 28th December 2017, 02:15   #3  |  Link
Stephen R. Savage
Registered User
 
Stephen R. Savage's Avatar
 
Join Date: Nov 2009
Posts: 337
Quote:
Originally Posted by ChaosKing View Post
Two questions:
- Is it possible to use avisynth x64 with this filter?
You can load 64-bit plugins directly. It looks like your script does not need the clip binding feature, so you should be able to use VFW.
Quote:
- Would be a "portable" avisynth possible as long as avisynth.dll is in the same folder? (or via path parameter in avsw)
You can provide the Avisynth library path via "avisynth" argument (link in original post updated).

Last edited by Stephen R. Savage; 28th December 2017 at 02:18.
Stephen R. Savage is offline   Reply With Quote
Old 28th December 2017, 16:53   #4  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 488
Quote:
Originally Posted by Stephen R. Savage View Post
You can load 64-bit plugins directly. It looks like your script does not need the clip binding feature, so you should be able to use VFW.
But I can't load avs scripts directly ( AnimeIVTC is a script )
And loading my sample script via VFW aka Avisource is not possible -> instant crash in VS ( No problems in Virtualdub-64). That's why I asked if x64 would possible.
__________________
Search and denoise
ChaosKing is offline   Reply With Quote
Old 28th December 2017, 18:36   #5  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Ikea Chair
Posts: 1,876
Quote:
Originally Posted by ChaosKing View Post
But I can't load avs scripts directly ( AnimeIVTC is a script )
And loading my sample script via VFW aka Avisource is not possible -> instant crash in VS ( No problems in Virtualdub-64). That's why I asked if x64 would possible.
Instant crash? Does it output any error like bad mmx state if you try to output it with vspipe?
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 21st May 2018, 00:28   #6  |  Link
MysteryX
Soul Architect
 
MysteryX's Avatar
 
Join Date: Apr 2014
Posts: 2,130
Quote:
Originally Posted by Stephen R. Savage View Post
You can load 64-bit plugins directly.
AFAIK loading through AviSource doesn't allow passing clips and thus can only be used at the beginning of a script, while your script can be used anywhere in the script, so that's a big difference.
MysteryX is offline   Reply With Quote
Old 21st May 2018, 18:05   #7  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 3,582
Quote:
Originally Posted by MysteryX View Post
AFAIK loading through AviSource doesn't allow passing clips and thus can only be used at the beginning of a script, while your script can be used anywhere in the script, so that's a big difference.
Is that what you meant to say ?

Actually, AVISource only allows passing clips (including avs scripts), and you can call the clip anywhere in the script


Plugins are loaded either through this avsproxy plugin, or through avs.LoadPlugin through the compatibility wrapper
http://www.vapoursynth.com/doc/funct...pluginavs.html
poisondeathray is offline   Reply With Quote
Old 23rd May 2018, 18:27   #8  |  Link
MysteryX
Soul Architect
 
MysteryX's Avatar
 
Join Date: Apr 2014
Posts: 2,130
Quote:
Originally Posted by poisondeathray View Post
Is that what you meant to say ?

Actually, AVISource only allows passing clips (including avs scripts), and you can call the clip anywhere in the script.

Plugins are loaded either through this avsproxy plugin, or through avs.LoadPlugin through the compatibility wrapper
http://www.vapoursynth.com/doc/funct...pluginavs.html
http://www.vapoursynth.com/doc/plugins/avisource.html

I mean AviSource cannot be inserted in the middle of a VapourSynth task because it cannot take any clip to feed into the Avisynth script.

If I want to run Denoise in VapourSynth, Deshaker in Avisynth, and frame interpolation in VapourSynth, this can only be done using this avsproxy, not AviSource.

Quote:
Note that if you are really insane you can load Avisynth’s VirtualDub plugin loader and use VirtualDub plugins as well.
Saw this in the documentation. Was considering switching to VapourSynth and using the compatibility wrapper for Deshaker which is for VirtualDub. Does this work fine? I'm not crazy; on good days.

Last edited by MysteryX; 23rd May 2018 at 18:30.
MysteryX is offline   Reply With Quote
Old 28th December 2017, 14:46   #9  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Hollola, Finland
Posts: 4,452
Holy smoke, thank you very much! I've been waiting to get my hands on SmoothD2 in 64-bit Vapoursynth since we are still waiting for a proper port, and with this tool, it's possible
__________________
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 28th December 2017, 19:44   #10  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 488
No output. Tested like this with R41-test4

Code:
.\VSPipe.exe -i 'D:\Test.vpy' .
My vs script
Code:
clip = core.avisource.AVISource(r'D:\ivtc.avs')
clip.set_output()
But it works without tfm or animeivtc.
Code:
AddAutoloadDir("D:\AvisynthRepository\SCRIPTS")
mpeg2source("D:\01\VTS_01_CHAPTER_03_1.d2v")
tfm(mode=6, PP=5,  slow =2, d2v="D:\01\VTS_01_CHAPTER_03_1.d2v") <- bad boy

But this forced me to switch to vivtc, and after some conditionalDeintStillCombed magic I got similar/better results.
__________________
Search and denoise

Last edited by ChaosKing; 28th December 2017 at 19:47.
ChaosKing is offline   Reply With Quote
Old 28th December 2017, 20:27   #11  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Ikea Chair
Posts: 1,876
Quote:
Originally Posted by ChaosKing View Post
No output. Tested like this with R41-test4

Code:
.\VSPipe.exe -i 'D:\Test.vpy' .
My vs script
Code:
clip = core.avisource.AVISource(r'D:\ivtc.avs')
clip.set_output()
But it works without tfm or animeivtc.
Code:
AddAutoloadDir("D:\AvisynthRepository\SCRIPTS")
mpeg2source("D:\01\VTS_01_CHAPTER_03_1.d2v")
tfm(mode=6, PP=5,  slow =2, d2v="D:\01\VTS_01_CHAPTER_03_1.d2v") <- bad boy

But this forced me to switch to vivtc, and after some conditionalDeintStillCombed magic I got similar/better results.
Can you put all the scripts and a sample script and the plugins into an archive? That way I can test with the same versions as you and don't need to go on a treasure hunt. And reveal your avisynth version too while you're at it. I'd really like to get to the bottom of this...
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 28th December 2017, 22:26   #12  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 488
Here is my x64 r2544 avs folder (plugins, scripts & sample script)
LINK

//EDIT
Same crash with r2580
__________________
Search and denoise

Last edited by ChaosKing; 28th December 2017 at 22:34.
ChaosKing is offline   Reply With Quote
Old 29th December 2017, 17:47   #13  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Ikea Chair
Posts: 1,876
Quote:
Originally Posted by ChaosKing View Post
Here is my x64 r2544 avs folder (plugins, scripts & sample script)
LINK

//EDIT
Same crash with r2580
I found one crash in avisource. Try it again when I release the next R41 build.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 30th December 2017, 19:49   #14  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Ikea Chair
Posts: 1,876
Quote:
Originally Posted by ChaosKing View Post
Here is my x64 r2544 avs folder (plugins, scripts & sample script)
LINK

//EDIT
Same crash with r2580
Try again with R41-RC1
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 30th December 2017, 20:22   #15  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 488
Quote:
Originally Posted by Myrsloik View Post
Try again with R41-RC1
Code:
vapoursynth.Error: Avisynth read error:
CAVIStreamSynth: System exception - Access Violation at 0x000001D41A5DB6D0
2017-12-30 20:16:58.862
Core freed but 460800 bytes still allocated in framebuffers
Core freed but 460800 bytes still allocated in framebuffers
2017-12-30 20:17:05.392
Bad MMX state detected when creating new core
same error in vspipe and vs editor, only that the mmx line is only shown in the vs editor. Tested with colorbars() + tfm(mode=6)
__________________
Search and denoise
ChaosKing is offline   Reply With Quote
Old 30th December 2017, 20:29   #16  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Ikea Chair
Posts: 1,876
Quote:
Originally Posted by ChaosKing View Post
Code:
vapoursynth.Error: Avisynth read error:
CAVIStreamSynth: System exception - Access Violation at 0x000001D41A5DB6D0
2017-12-30 20:16:58.862
Core freed but 460800 bytes still allocated in framebuffers
Core freed but 460800 bytes still allocated in framebuffers
2017-12-30 20:17:05.392
Bad MMX state detected when creating new core
same error in vspipe and vs editor, only that the mmx line is only shown in the vs editor. Tested with colorbars() + tfm(mode=6)
At least we're making progress. It happens because of a bug in one of the avisynth plugins. Comment out the script gradually and locate which one it is. Someone forgot to use the emms instruction. Find the plugin author and shame them, or update to the latest version of whatever plugin it is.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 29th December 2017, 00:01   #17  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 488
Thx, woking now. Loading an external avisynth.dll too!
__________________
Search and denoise
ChaosKing is offline   Reply With Quote
Old 30th December 2017, 20:37   #18  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 488
Working now. I had an old x64 TIVTC.dll from 2010, don't know why :-/
No problems with: https://github.com/pinterf/TIVTC/releases

EDIT: I guess I took it from this (outdated) list http://avisynth.nl/index.php/AviSynth%2B_x64_plugins

EDIT2: But it's still interessting that it only crashes in VS and not in VdubMod
__________________
Search and denoise

Last edited by ChaosKing; 30th December 2017 at 20:48.
ChaosKing is offline   Reply With Quote
Old 7th January 2018, 11:07   #19  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 488
I should be able to pass a VS clip to Avisynth, right?

Because this works

Code:
c = core.avsw.eval('blankclip() Subtitle("Hello world!") ')
but not this
Code:
c = core.std.BlankClip(color=[255, 0, 0])
c = core.avsw.eval('Subtitle("Hello world!") ', clips=[c], clip_names=["last"])
vapoursynth.Error: Avisynth 32-bit proxy: command failed
__________________
Search and denoise
ChaosKing is offline   Reply With Quote
Old 8th January 2018, 01:27   #20  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 488
The original from Soureforge works, also 2.6 (MT) from here https://forum.doom9.org/showthread.php?t=148782

But the colors are shifted https://www.dropbox.com/s/7lft4ek963...color.PNG?dl=0

AVS+ would be nice for 16bit support (if possible)
__________________
Search and denoise

Last edited by ChaosKing; 8th January 2018 at 01:29.
ChaosKing 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 09:52.


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