Git Product home page Git Product logo

node-gstreamer-superficial's Introduction

gstreamer-superficial

Superficial GStreamer binding

What?

This is a superficial binding of GStreamer to Node.js. It does not attempt at being a complete binding, and will hopefully one day be replaced by (or implemented with) node-gir.

How?

const gstreamer = require('gstreamer-superficial');
const pipeline = new gstreamer.Pipeline(`videotestsrc ! textoverlay name=text
	! autovideosink`);
	
pipeline.play();

Then, you can find an element within the pipeline, and set its properties:

const target = pipeline.findChild('text');

target.text = 'Hello';
Object.assign(target.text, {
	text: 'Hello', 
	'font-desc': 'Helvetica 32',
})

(see also examples/basic-pipeline.js)

Pipeline also knows .stop(), .pause() and .pollBus(), the elements returned by .findChild() getting and setting all properties the real GObjects do, appsinks also support .pull() (see below).

Polling the GStreamer Pipeline Bus

You can asynchronously handle bus messages using Pipeline.pollBus(callback):

pipeline.pollBus(msg => {
	console.log(msg);
});

(see also examples/bus.js)

Handling binary data

You can feast off GStreamer's appsink to handle binary data. .pull starts a background work queue and calls your callback whenever a buffer is (or caps are) available:

const appsink = pipeline.findChild('sink');

function onData(buf, caps) {
	if (caps) {
		console.log('CAPS', caps);
	}
	if (buf) {
		console.log('BUFFER size', buf.length);
		appsink.pull(onData);
	}

	// !buf probably means EOS
}

appsink.pull(onData);

(see examples/appsink.js)

A simple Ogg/Theora streaming server

should be working as implemented in examples/streaming/
run server.js (requires express) and point your browser to http://localhost:8001. (Tested only with Chromium). This handles retaining the streamheader to feed first to every newly connected client.

Who?

gstreamer-superficial was originally written by Daniel Turing, and has received contributions from various individuals as seen on github and in package.json.

Requisites

  • libgstreamer-plugins-base1.0-dev
  • libgstreamer1.0-dev
  • nan

node-gstreamer-superficial's People

Contributors

chromakode avatar dfischer23 avatar dturing avatar jbendes avatar linux4kix avatar lleon95 avatar macdudeuk avatar maruware avatar skaughtx0r avatar skyrising avatar zubnix avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.