https://github.com/webini/node-gstreamer-launch
gst-launch-1.0 helper for node
https://github.com/webini/node-gstreamer-launch
gstreamer launch node pipeline transcoding
Last synced: 10 months ago
JSON representation
gst-launch-1.0 helper for node
- Host: GitHub
- URL: https://github.com/webini/node-gstreamer-launch
- Owner: Webini
- Created: 2020-01-04T23:42:09.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-07T04:29:00.000Z (about 3 years ago)
- Last Synced: 2025-04-20T13:39:34.979Z (10 months ago)
- Topics: gstreamer, launch, node, pipeline, transcoding
- Language: JavaScript
- Size: 954 KB
- Stars: 6
- Watchers: 1
- Forks: 1
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Installation
You must have `gst-launch-1.0` installed on your system (in package `gstreamer1.0-tools` for debian based distributions)
`npm i node-gstreamer-launch`
## About
This package is a simple utiliy helping you to build gstreamer pipelines.
## Linear pipeline example
```js
const gst = require('node-gstreamer-launch');
const gstProcess = gst
.pipeline(gst.element('fakesrc', { 'num-buffers': 10 }))
.next(gst.caps('video/x-raw', { width: [640, 'int'], height: 220 }))
.next(gst.element('fakesink'))
.execute({ debug: true });
// execute return https://nodejs.org/api/child_process.html#child_process_class_childprocess
// debug: true will display the command line with parameters executed
// it will execute
// gst-launch-1.0 -e fakesrc num-buffers=10 ! video/x-raw,width=(int)640,height=220 ! fakesink
```
## Forked pipeline example
```js
const gst = require('node-gstreamer-launch');
const entryPipe = gst
.pipeline(gst.element('fakesrc', { 'num-buffers': 10 }))
.next(gst.element('progressreport', { name: 'myProgress', 'update-freq': 1 }))
.next(gst.element('tee', { name: 'buffers' }));
// fork parameter is the first pipe item, empty parameters is allowed
const output0 = entryPipe.fork(
entryPipe.element('fakesink', { name: 'output0' }),
);
const output1 = entryPipe.fork(gst.element('fakesink', { name: 'output1' }));
entryPipe
.fork(entryPipe.link('buffers'))
.next(gst.element('queue'))
.next(output0.link('output0'));
entryPipe
.fork(entryPipe.link('buffers'))
.next(gst.element('queue'))
.next(output1.link('output1'));
// always execute from the pipe who's forked
entryPipe.execute({ debug: true });
// it will execute
// gst-launch-1.0 -e fakesrc num-buffers=10 ! progressreport name=myProgress update-freq=1 ! tee name=buffers \
// fakesink name=output0 \
// fakesink name=output1 \
// buffers. ! queue ! output0. \
// buffers. ! queue ! output1.
```