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 10th September 2016, 02:57   #1  |  Link
mikewando
Registered User
 
Join Date: Nov 2010
Posts: 11
vsjs - VapourSynth bindings for node.js

https://github.com/mgroshans/vsjs

I made some node bindings for VapourSynth. I don't have a lot of experience with gyp or distributing native modules for node so it probably doesn't build out-of-the-box on OSX or Linux and I don't know if it will build on anyone else's Windows box. But I wanted to post it here just to get the word out. I think this allows for some pretty neat things given the large and active javascript ecosystem.
mikewando is offline   Reply With Quote
Old 10th September 2016, 03:11   #2  |  Link
mikewando
Registered User
 
Join Date: Nov 2010
Posts: 11
https://github.com/mgroshans/gulp-vs2yuv is actually how the project started, allowing you to render vapoursynth scripts in a gulp pipeline, but it never really turned out to be particularly cool because most of the time you just spawn an x264 process and at that point you might as well have spawned a vspipe process too.

But a more exciting application is electron apps see http://i.imgur.com/2ahQlmk.jpg for an example. This has already been really useful to me building one-off tools. Specifically I wanted a tool that could display two scripts at once and without clicking around or alt-tabbing I wanted to go frame-by-frame in one script, or the other, or both. Starting from the basic one video electron app it only took me a couple minutes to get what I needed. Having the chrome development tools available is really powerful. I'm planning to release at least a really basic app too, but I need to clean it up some and there's a couple not-so-great bits that maybe people here have ideas to improve.

I'm using a canvas to display the image, but that takes packed RGBA. The closest I can get out of vapoursynth is (for example)
Code:
.resize.Point(format=vs.RGB24, matrix_in_s="170m")
.std.FlipVertical()
.std.ShufflePlanes(planes=[2, 1, 0], colorfamily=vs.RGB)
.resize.Point(format=vs.COMPATBGR32)
.set_output()
but that seems to put alpha to 0 so I still have to do something like
Code:
for (let i = 3; i < frameBuffer.length; i += 4) {
    frameBuffer[i] = 255;
}
before I can put the image on the canvas.

If anyone has alternative suggestions for how to prepare the video from the vapoursynth side or a better way to blit it on the web side I'm all ears. And of course I can add something to vsjs if need be, I just wanted to start with something as simple as possible.
mikewando is offline   Reply With Quote
Old 23rd September 2016, 15:52   #3  |  Link
AndrewUnmuted
Registered User
 
Join Date: Apr 2016
Posts: 1
This could not have come at a better time for me, personally! I was just about to embark upon the exact same task myself, so I am very thankful for your efforts on this front.

Since you've already done the heavy lifting, I will be empowered to develop an application I've had in mind for some time now. Watch out for a message on GitHub from me, as I will be sending you my code once I am done!
AndrewUnmuted is offline   Reply With Quote
Old 23rd September 2016, 15:59   #4  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,473
Quote:
Originally Posted by mikewando View Post
https://github.com/mgroshans/gulp-vs2yuv is actually how the project started, allowing you to render vapoursynth scripts in a gulp pipeline, but it never really turned out to be particularly cool because most of the time you just spawn an x264 process and at that point you might as well have spawned a vspipe process too.

But a more exciting application is electron apps see http://i.imgur.com/2ahQlmk.jpg for an example. This has already been really useful to me building one-off tools. Specifically I wanted a tool that could display two scripts at once and without clicking around or alt-tabbing I wanted to go frame-by-frame in one script, or the other, or both. Starting from the basic one video electron app it only took me a couple minutes to get what I needed. Having the chrome development tools available is really powerful. I'm planning to release at least a really basic app too, but I need to clean it up some and there's a couple not-so-great bits that maybe people here have ideas to improve.

I'm using a canvas to display the image, but that takes packed RGBA. The closest I can get out of vapoursynth is (for example)
Code:
.resize.Point(format=vs.RGB24, matrix_in_s="170m")
.std.FlipVertical()
.std.ShufflePlanes(planes=[2, 1, 0], colorfamily=vs.RGB)
.resize.Point(format=vs.COMPATBGR32)
.set_output()
but that seems to put alpha to 0 so I still have to do something like
Code:
for (let i = 3; i < frameBuffer.length; i += 4) {
    frameBuffer[i] = 255;
}
before I can put the image on the canvas.

If anyone has alternative suggestions for how to prepare the video from the vapoursynth side or a better way to blit it on the web side I'm all ears. And of course I can add something to vsjs if need be, I just wanted to start with something as simple as possible.
We actually had a discussion about the alpha bit. The format is RGBX where it's simply a 0 byte used as padding and not actual alpha for simplicity.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik 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 16:05.


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