Woobi Media Streams
EPG ui, LAN media server, IPTV broadcaster, and media converter.
- Stream the same media to multiple locations at once using multicast or unicast/http.
- Stream your desktop to gaming/live servers.
- Use a tv tuner to stream tv to all connected devices.
- EPG with DVR controls via adapter.
Contents
Pre-Requisites
Installation
Usage
Woobi UI
Configuration
Screen Shots
Contributing
License
Pre-Requisites
You need ffmpeg and node >= v4.
Installation
yarn install woobi
Usage
var Woobi = require('woobi');
Woobi.init( {
channelPort: 13000,
host: 'studio',
loadSaved: false,
proxy: {
port: 2777,
nodeadmin: false,
host: '0.0.0.0',
},
adapters: [
/* the included media adapter is for a mysql database setup */
{
name: 'media',
adapter: 'media',
config: {
user: 'MYSQLUSER',
pass: 'MYSQLPASS',
host: 'MYSQLHOST',
database: 'MYSQLDB'
},
},
/* custom adapters can be added. use the included adapters as a template */
{
name: 'livetv',
adapter: function ( Woobi ) {
var MyAdapter = function ( opts, callback ) {
if ( !( this instanceof MyAdapter ) ) return new MyAdapter( opts, callback );
}
/* Add any function available in /lib/core/apapters.js */
MyAdapter.prototype.getGuideData = function ( channels, start, end ) {
}
return MyAdapter;
},
config: {
}
},
/* The included live tv adapter uses a mix of mysql databases and direct tcp connections */
{
name: 'livetv',
adapter: 'livetv',
config: {
epg: {
user: 'MYSQLUSER',
pass: 'MYSQLPASS',
host: 'MYSQLHOST',
database: 'MYSQLDB'
},
tv: {
user: 'MYSQLUSER',
pass: 'MYSQLPASS',
host: 'MYSQLHOST',
database: 'MYSQLDB'
},
socket: {
host: 'anna',
port: '9080',
hostname: 'studio',
agent: 'Woobi'
},
}
},
]
});
Woobi UI
http://localhost:7001
If you set the proxy option you can use the Woobi UI.
- Live Tv EPG and DVR Manager (ui only)
- Create Channels
- View Channels
- Save / Manage Channels
- View local library
Configuration
Woobi.init(options, callback)
@param - options - Object
@param - callback - Function
return Promise
option type info host String Host to use to access Woobi UI and api routes. proxy false|Object Optional server for api routes and Woobi UI. adapters Object|Array Adapters can convert your info to the correct format. loadSaved Boolean Load saved channels on boot that are set to autostart. channelPort Number If you do not supply a port when streaming a channel, the port will be assigned starting at this number. mediaPath String Full path to store saved HLS files. Defaults to /module_path/media media passthrough route String Api route to direct access media. media passthrough path String Replace the path above with the actual server path. video passthrough route String Api route to direct access videos. video passthrough path String Replace the path above with the actual server path.
proxy object
| option | type | info |
|---|---|---|
| host | String | Host to start on. default 0.0.0.0 |
| port | Object | Port for api routes and Woobi UI access. |
| keystone | Boolean | Use keystone if you want to save channel configs from the UI. |
| nodeadmin | Boolean | Load the nodeadmin app. |
| auth | Boolean | Used with keystone. Set to false at first to create a new user @ http://localhost/keystone |
You can add any keystone option to the proxy configuration.
If you want to use channel saving and do not want to use keystone, then attach a mongoose model toWoobi.libs._mongo.ChannelConfig.model
adapters Array of Objects
Adapters are used to convert your information into the required format for the UI.
You can also uses adapters for non-ui use cases.
For local media amediaadapter is needed. An example using mysql databases is included.
For live tv alivetvadapter is needed. An example using a mix of mysql databses and tcp connections is supplied.
Adapters are available at
Woobi.libs['USER_SUPPLIED_NAME']
| option | type | info |
|---|---|---|
| name | String | Unique name for the adapter. Can be accessed at Woobi.libs[name] |
| adapter | String|Function | String for included adapter or a function to provide your own. |
| config | Object | |
| config.user | String | username |
| config.pass | String | password |
| config.host | String | host |
| config.database | String | database |
View /lib/core/adapter.js for all available functions to use.
note - A
mediaandlivetvadapters are used by the UI if supplied.
note - config will be passed to custom adapters and can include additional key/value pairs
The media adapter needs the following functions
tvShow( idShow )tvShows( obj )tvShowByName( name )tvShowByIMDB( imdb_id )
tvShowEpisodes( idShow )recentEpisodes( obj )
movie( idShow )movies( obj )movieByName( name )
movieByIMDB( imdb_id )recentMovies( obj )grabMedia( obj )mediaFiles( obj )mediaFile( obj )
The livetv adapter needs the following functions
connect( obj )getGuideData( channels, start, end )getSeriesTimers( obj )getTimers( obj )getTVChannels( obj )getChannelGroups( obj )
Woobi.Channel
Use
Woobi.addChannel( name, opts ).then()to add channels instead of directly withnew Woobi.Channel( name, opts, callback ).
/**
* This gives iptv by grabbing a
* tv tuner card source and sending it over udp
* For wired networks a multicast can be used
**/
Woobi.addChannel( 'TV', {
loop: true,
assets: [
{
type: 'program',
name: 'Air',
arg: 'gnutv -channels /home/woobi/dvb/channels.conf -out udp 10.10.10.82 13333 WAGA5',
redo: 'gnutv -channels /home/woobi/dvb/channels.conf -out udp 10.10.10.82 13333 ##CMD##',
},
{
type: 'udpSink',
port: 13333,
host: '10.10.10.82',
name: 'AirTV',
},
{
type: 'udpStream',
port: 13333,
host: '10.10.10.87',
name: 'streamAir'
},
],
}, ( err ) => {
if ( err ) console.log( '##ERROR##', err );
});
/**
* using the library adapter
**/
Woobi.libs.media.movies()
.then( ( movies ) => {
movies = movies.map( r => {
return { name: r.name, file: r.file, progress: true, metadata: r, encode: false }
});
return Woobi.addChannel( 'recentMovies', {
files: movies,
loop: true,
noTransition: true,
hls: {
type: 'hls',
name: 'movieChannel',
passthrough: true, // uses the stream as is / no transcoding
}
});
})
.catch( ( err ) => {
if ( err ) debug( '##ERROR##', err );
});
// channel is now available at Woobi.channels.recentMovies
Options
Adding Assets
Properties
API Routes
Watch / Listen
Woobi.Sources
.File(options, callback)
@param - options - Object
@param - callback - Function
let file = new Woobi.Sources.File({
name: 'Test',
file: '/home/woobi/Pitures/woobi.mp3'
});
| option | type | info |
|---|---|---|
| name | String | Unique name for asset |
| file | Object | Full path to file. |
.Fluent(options, callback)
@param - options - Object
@param - callback - Function
let fluent = new Woobi.Sources.Fluent({
name: 'Test',
file: '/home/woobi/Videos/woobi.mp4',
streamable: true
});
| option | type | info |
|---|---|---|
| name | String | Unique name for asset |
| file | Object | optional Full path to file. |
| stream | Object | optional Source stream. |
| progress | Boolean | Emit progress info. |
| metadata | Object | Object of information about file. Should be flat with exception of the art key(an Array). |
| seek | Number | |
| inputFormat | String | |
| inputOptions | Array|String | |
| outputOptions | Array|String | |
| videoFilters | Object | |
| onlyOptions | Array|String | |
| encode | Boolean | |
| streamable | Boolean | |
| format | String |
.Program(options, callback)
@param - options - Object
@param - callback - Function
let program = new Woobi.Sources.Program({
name: 'TV',
program: 'gnutv',
arg: '-channels /home/woobi/dvb/channels.conf -out udp 10.10.10.82 13333 WAGA5',
redo: '-channels /home/woobi/dvb/channels.conf -out udp 10.10.10.82 13333 ##CMD##',
});
| option | type | info |
|---|---|---|
| name | String | Unique name for asset |
| program | String | Program name. |
| args | String | Argument String. |
| redo | String | String used to restart program. |
.UDP(options, callback)
@param - options - Object
@param - callback - Function
let updSource = new Woobi.Sources.UDP({
name: 'UDPSource',
host: '10.10.10.10',
port: 7005
});
| option | type | info |
|---|---|---|
| name | String | Unique name for asset |
| host | String | |
| port | Number |
Woobi.Streams
.bridge()
let bridge = new Woobi.Streams.bridge();
normal passthrough stream
.HLS(options, callback)
@param - options - Object
@param - callback - Function
let hls = new Woobi.Streams.HLS({
name: 'Test',
file: '/home/woobi/Videos/woobi.mp4',
streamable: true
});
| option | type | info |
|---|---|---|
| name | String | Unique name for asset |
| file | Object | optional Full path to file. |
| stream | Object | optional Source stream. |
| progress | Boolean | Emit progress info. |
| metadata | Object | Object of information about file. Should be flat with exception of the art key(an Array). |
| seek | Number | |
| inputFormat | String | |
| inputOptions | Array|String | |
| outputOptions | Array|String | |
| onlyOptions | Array|String | |
| hlsOptions | Array|String | |
| passthrough | Boolean | |
| streamable | Boolean | |
| format | String |
.MpegTS(options, callback)
@param - options - Object
@param - callback - Function
let mpegts = new Woobi.Streams.MpegTS({
name: 'Test',
file: '/home/woobi/Videos/woobi.mp4',
streamable: true
});
| option | type | info |
|---|---|---|
| name | String | Unique name for asset |
| program | String | |
| path | String | |
| urlPath | String | |
| source | Object | input source. |
| video | String | |
| audio | String | |
| other | String | |
| segment | String |
.throttle(source, rate, onEnd)
@param - source - Stream
@param - rate - Number @param - onEnd - Function
let throttle = new Woobi.Streams.throttle(stream, 1000);
// throttle.stream.pipe(somewhere)
.transform()
let transformer = new Woobi.Streams.transform();
transform stream
.UDP(options, callback)
@param - options - Object
@param - callback - Function
let updStream = new Woobi.Streams.UDP({
name: 'UDPStream',
host: '10.10.10.11',
port: 7006
});
| option | type | info |
|---|---|---|
| name | String | Unique name for asset |
| host | String | |
| port | Number |