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 21st September 2012, 10:05   #1  |  Link
Chikuzen
typo lover
 
Chikuzen's Avatar
 
Join Date: May 2009
Posts: 595
vsavsreader -- AviSynth script reader for VapourSynth

I wrote a VapourSynth plugin a few days ago.

This plugin works as a source filter on VapourSynth.
you will be able to use avisynth filters which does not exist yet for VS(e.g. DirectShowSource) and has some compatibility issue like ColorMatrix() with this plugin.

vsavsreader-1.0.0.zip

requirement:
VapourSynth-r30 or later
AviSYnth2.6/avisynth+
Microsoft Visual C++ 2015 Redistributable Packages
__________________
my repositories

Last edited by Chikuzen; 10th May 2016 at 12:49.
Chikuzen is offline   Reply With Quote
Old 23rd September 2012, 10:41   #2  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,890
I get this error when load the plugin:

Quote:
Traceback (most recent call last):
File "Version.py", line 6, in <module>
c.avs.LoadPlugin(path=r'C:\Temp\Python\plugins\vsavsreader.dll')
File "vapoursynth.pyx", line 741, in vapoursynth.Function.__call__ (src/cython\vapoursynth.c:10611)
vapoursynth.Error: 'Avisynth Loader: no entry point found'
Same error with vsavsreader.dll in same folder and:
c.avs.LoadPlugin('vsavsreader.dll')

VS r8
AviSynth 2.6.0a3
XP SP3
__________________
BeHappy, AviSynth audio transcoder.
tebasuna51 is offline   Reply With Quote
Old 23rd September 2012, 18:09   #3  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,890
Thanks. My mistake.
I copied other LoadPlugin without see the Readme.txt.
__________________
BeHappy, AviSynth audio transcoder.
tebasuna51 is offline   Reply With Quote
Old 27th September 2012, 13:41   #4  |  Link
Chikuzen
typo lover
 
Chikuzen's Avatar
 
Join Date: May 2009
Posts: 595
updated for VS-r9
see first post.
__________________
my repositories
Chikuzen is offline   Reply With Quote
Old 28th September 2012, 01:09   #5  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,548
I looked at the source and spotted this small problem:
****vsapi->propSetInt(props, "_DurationNum", ah->avs_vi->fps_denominator * n, 0);
Should be
****vsapi->propSetInt(props, "_DurationNum", ah->avs_vi->fps_denominator, 0);
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 28th September 2012, 07:20   #6  |  Link
Chikuzen
typo lover
 
Chikuzen's Avatar
 
Join Date: May 2009
Posts: 595
fixed.
__________________
my repositories
Chikuzen is offline   Reply With Quote
Old 1st October 2012, 12:24   #7  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,664
Hi Chikuzen, thanks for this usefull plugin.
Since there are some plugins/scripts that can work with dither's lsb in/out.
I was wondering if would it be possible to add a function that can merge msb/lsb into a compatible YUVxxxP16 format?
Reel.Deel is offline   Reply With Quote
Old 1st October 2012, 12:44   #8  |  Link
Chikuzen
typo lover
 
Chikuzen's Avatar
 
Join Date: May 2009
Posts: 595
Quote:
Originally Posted by Reel.Deel View Post
Hi Chikuzen, thanks for this usefull plugin.
Since there are some plugins/scripts that can work with dither's lsb in/out.
I was wondering if would it be possible to add a function that can merge msb/lsb into a compatible YUVxxxP16 format?
use dither interleaved format.
stacked format is not supported.
Code:
clip = core.avsr.Import('foo.avs', bitdepth=16)
__________________
my repositories

Last edited by Chikuzen; 1st October 2012 at 12:47.
Chikuzen is offline   Reply With Quote
Old 1st October 2012, 13:21   #9  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,664
Quote:
Originally Posted by Chikuzen View Post
use dither interleaved format.
stacked format is not supported.
Code:
clip = core.avsr.Import('foo.avs', bitdepth=16)
Did not know I could do that. Thanks Chikuzen.

* Edit *

Maybe it's not such a bad idea to add that information to the readme.

Last edited by Reel.Deel; 1st October 2012 at 15:46. Reason: added suggestion
Reel.Deel is offline   Reply With Quote
Old 1st October 2012, 17:43   #10  |  Link
Chikuzen
typo lover
 
Chikuzen's Avatar
 
Join Date: May 2009
Posts: 595
Quote:
Originally Posted by Reel.Deel View Post
Maybe it's not such a bad idea to add that information to the readme.
I'm not good at english to write such complicated descriptions.
If you write them, I'll add them into the readme.
__________________
my repositories
Chikuzen is offline   Reply With Quote
Old 2nd October 2012, 13:05   #11  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,664
Quote:
Originally Posted by Chikuzen View Post
I'm not good at english to write such complicated descriptions.
If you write them, I'll add them into the readme.
Sounds like a deal. I'll put something together in the next couple of days.

I wish my Japanese were half as good as your English.

* Edit *

Here's the description I wrote on how to import Dither's msb/lsb format into Vapoursynth.
I'm not an expert so I hope it makes sense.

Code:
VsAvsReader is able to convert Dither's interleaved MSB/LSB format into a compatible Vapoursynth YUV4xxP9/10/16 format.
Dither's MSB/LSB must be interleaved, stacked format is not supported.
Only YUV planar formats are allowed.

example 1: Use VsAvsReader's Import function to load external Avisynth script.

Vapoursynth script

	# Core
	import vapoursynth as vs
	core = vs.Core(accept_lowercase=True)

	# Import plugins
	core.std.LoadPlugin('C:/vsavsreader.dll')

	# Use "Import" to load interleaved MSB/LSB Avisynth script.
	clip = core.avsr.Import('C:/script.avs', bitdepth=16)

External Avsiynth script being imported.

        # script.avs
	LoadPlugin("C:/plugins/DGDecode.dll")
	LoadPlugin("C:/plugins/Dither.dll")
	Import("C:/scriptss/Dither.avsi")
	MPEG2Source("D:/source.d2v")
	Dither_convert_8_to_16()
	Dither_resize16(1280, 720)
	Dither_convey_yuv4xxp16_on_yvxx()

_____________________________________________________________________


Example 2: Use VsAvsReader's Eval function to create Avisynth script inside a Vapoursynth script.

Vapoursynth script

	# Core
	import vapoursynth as vs
	core = vs.Core(accept_lowercase=True)

	# Import plugins
	core.std.LoadPlugin('C:/vsavsreader.dll')

	# Use "Eval" to create interleaved MSB/LSB Avisynth script.
	lines = '''
	LoadPlugin("C:/plugins/DGDecode.dll")
	LoadPlugin("C:/plugins/Dither.dll")
	Import("C:/scriptss/Dither.avsi")
	MPEG2Source("D:/source.d2v")
	Dither_convert_8_to_16()
	Dither_resize16(1280, 720)
	Dither_convey_yuv4xxp16_on_yvxx()
	'''

	video = core.avsr.Eval(lines=lines, bitdepth=16)

Last edited by Reel.Deel; 6th October 2012 at 13:44.
Reel.Deel is offline   Reply With Quote
Old 1st October 2012, 13:13   #12  |  Link
Chikuzen
typo lover
 
Chikuzen's Avatar
 
Join Date: May 2009
Posts: 595
ok, I understood.
Since this plugin was written when the source code had not been opened yet, I was not using vsapi in the place which needs it.
__________________
my repositories

Last edited by Chikuzen; 1st October 2012 at 13:17.
Chikuzen is offline   Reply With Quote
Old 1st October 2012, 14:10   #13  |  Link
Chikuzen
typo lover
 
Chikuzen's Avatar
 
Join Date: May 2009
Posts: 595
fixed Splice issue.
please download fixed version from the link of first post.

I appreciate advice of Myrsloik.
__________________
my repositories
Chikuzen is offline   Reply With Quote
Old 5th October 2012, 05:58   #14  |  Link
Chikuzen
typo lover
 
Chikuzen's Avatar
 
Join Date: May 2009
Posts: 595
@Reel.Deel
added
__________________
my repositories
Chikuzen is offline   Reply With Quote
Old 6th October 2012, 13:21   #15  |  Link
Chikuzen
typo lover
 
Chikuzen's Avatar
 
Join Date: May 2009
Posts: 595
update
vsavsreader-d219012.7z

* change RGB plane order from G->B->R to R->G->B.
__________________
my repositories
Chikuzen is offline   Reply With Quote
Old 16th November 2012, 02:30   #16  |  Link
Chikuzen
typo lover
 
Chikuzen's Avatar
 
Join Date: May 2009
Posts: 595
update
download it from the link of first post.

* support alpha channel

If input avs is RGB32, alpha will be stored in "_Alpha" prop.
__________________
my repositories
Chikuzen is offline   Reply With Quote
Old 16th November 2012, 02:36   #17  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,548
Quote:
Originally Posted by Chikuzen View Post
update
download it from the link of first post.

* support alpha channel

If input avs is RGB32, alpha will be stored in "_Alpha" prop.
Actually the more proper way to do it to return two clips from the filter. See the avisource code for an example. The basic idea is that you call setvideoinfo(array of two videinfo, 2, core)

And then in the filter's getframe function you call getOutputIndex () to know which of the two clips you should output a frame for. Slightly more complicated to implement but it makes more sense. Or so I think.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 11th January 2013, 17:45   #18  |  Link
Chikuzen
typo lover
 
Chikuzen's Avatar
 
Join Date: May 2009
Posts: 595
updated to vsavsreader-0.1.0

* add new option 'alpha'
* change alpha channel support method.
__________________
my repositories
Chikuzen is offline   Reply With Quote
Old 15th October 2013, 12:21   #19  |  Link
RTW47
Rome Total War
 
RTW47's Avatar
 
Join Date: Mar 2013
Location: C:\Python33
Posts: 39
then I use Eval() function:
Code:
import vapoursynth as vs
core = vs.get_core()
core.std.LoadPlugin(r'C:\Program Files\VapourSynth\filters\vsavsreader.dll')
avs = """
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\LSMASHSource.dll")
LWLibavVideoSource("D:\amv\10bit.mp4", format="YUV420P8")
#ConvertToRGB24(matrix = "Rec709")
"""
video = core.avsr.Eval(lines = avs)
video.set_output()
In Python shell I get this:
Code:
Python 3.3.2 (v3.3.2:d047928ae3f6, May 16 2013, 00:03:43) [MSC v.1600 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> ================================ RESTART ================================
>>> 
Traceback (most recent call last):
  File "C:\Users\Edgaras\Desktop\py\1_vsavsreader # 'Eval' Libav FAIL.py", line 9, in <module>
    video = core.avsr.Eval(lines = avs)
  File "vapoursynth.pyx", line 983, in vapoursynth.Function.__call__ (src\cython\vapoursynth.c:15542)
vapoursynth.Error: 'Eval: 
failed to invoke \nLoadPlugin("C:\\Program Files\\AviSynth 2.5\\plugins\\LSMASHSource.dll")
\nLWLibavVideoSource("D:\x07mv\x08bit.mp4", format="YUV420P8")\n#ConvertToRGB24(matrix = "Rec709")\n'
>>>
then importing same .avs script(s) using vsavsreader's Import() function, then there's no error.

-vapoursynth r20 RC3
-avisynth 2.6 alpha 5
-vsavsreader 0.1.0
__________________
GOTO:EOF

Last edited by RTW47; 15th October 2013 at 15:46. Reason: help ^^"
RTW47 is offline   Reply With Quote
Old 14th December 2014, 23:00   #20  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,664
Dumb question:

If there was a 64-bit version of this plugin could it be used to load 32-bit AviSynth scripts in a 64-bit VapourSynth? I know piping allows using applications interchangeably but that may be something completely different.
Reel.Deel 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 06:08.


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