├── .gitignore ├── rtmp_server.js ├── dns_server.js ├── package.json ├── web_server.js ├── index.js └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | config.js 3 | .scsrrc -------------------------------------------------------------------------------- /rtmp_server.js: -------------------------------------------------------------------------------- 1 | module.exports = function (config) { 2 | const { NodeMediaServer } = require('node-media-server'); 3 | var nmcs = new NodeMediaServer(config) 4 | nmcs.run(); 5 | } 6 | 7 | 8 | -------------------------------------------------------------------------------- /dns_server.js: -------------------------------------------------------------------------------- 1 | module.exports = function (config) { 2 | process.env['dnsproxy_logging'] = 'dnsproxy:info'; 3 | process.env['dnsproxy_host'] = config.external_ip; 4 | process.env['dnsproxy_reload_config'] = false; 5 | process.env['dnsproxy_domains__api.ustream.tv'] = config.external_ip; 6 | require('dns-proxy'); 7 | } 8 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "sony-cameras-stream-receiver", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "MIT", 11 | "dependencies": { 12 | "dns-proxy": "^0.6.2", 13 | "node-media-server": "git://github.com/LucaLanziani/Node-Media-Server.git#feature/fdr-x3000-hack" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /web_server.js: -------------------------------------------------------------------------------- 1 | module.exports = function (config) { 2 | const http = require('http'); 3 | const channel_numbers = [config.channel_number]; 4 | const port = config.port; 5 | const hostname = config.hostname; 6 | 7 | let channels = {} 8 | channel_numbers.forEach((channel) => { 9 | channels[channel] = { 10 | broadcast_urls: [ 11 | `rtmp:\/\/api.ustream.tv\/${channel}` 12 | ] 13 | } 14 | }) 15 | 16 | const server = http.createServer((req, res) => { 17 | res.statusCode = 200; 18 | res.setHeader('Content-type', 'application/json'); 19 | res.end(JSON.stringify({channels: channels})); 20 | }); 21 | 22 | server.listen(port, hostname, () => { 23 | console.log(`Server listening at http://${hostname}:${port}/`); 24 | }); 25 | } 26 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | const rc = require('rc'); 2 | let config = rc('scsr', { 3 | web: { 4 | hostname: '0.0.0.0', 5 | port: 80, 6 | channel_number: null 7 | }, 8 | dns: { 9 | external_ip: null 10 | }, 11 | node_media_server: { 12 | rtmp: { 13 | port: 1935, 14 | chunk_size: 60000, 15 | gop_cache: true, 16 | ping: 10, 17 | ping_timeout: 30 18 | } 19 | } 20 | }); 21 | 22 | 23 | if (!config.dns.external_ip) { 24 | const os = require( 'os' ); 25 | var networkInterfaces = os.networkInterfaces( ); 26 | console.log(` 27 | If you want the dns module to work select one of the following addressess and use 28 | --dns.external_ip=
`); 29 | 30 | Object.keys(networkInterfaces).forEach(interface => { 31 | networkInterfaces[interface].forEach(addresses => { 32 | console.log(`\t${interface} => ${addresses.address}`); 33 | }) 34 | }); 35 | console.log(); 36 | } 37 | 38 | if (!config.web.channel_number) { 39 | console.log(` 40 | Missing param --web.channel_number=