forked from oozman/rtsp2web
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
46 lines (43 loc) · 1.1 KB
/
index.js
File metadata and controls
46 lines (43 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
require('dotenv').config();
const NodeMediaServer = require('node-media-server');
const config = {
rtmp: {
port: 1935,
chunk_size: 60000,
gop_cache: true,
ping: 30,
ping_timeout: 60
},
http: {
port: 80,
allow_origin: '*',
mediaroot: '/var/www/html/media',
},
relay: {
ffmpeg: '/usr/bin/ffmpeg',
tasks: [
{
app: 'live',
mode: 'static',
edge: process.env.RTSP_URL,
name: process.env.RTSP_NAME,
rtsp_transport : 'tcp' //['udp', 'tcp', 'udp_multicast', 'http']
}
]
},
trans: {
ffmpeg: '/usr/bin/ffmpeg',
tasks: [
{
app: 'live',
hls: true,
hlsFlags: '[hls_time=2:hls_list_size=3:hls_flags=delete_segments]',
dash: true,
dashFlags: '[f=dash:window_size=3:extra_window_size=5]',
name: process.env.RTSP_NAME
}
]
}
};
const nms = new NodeMediaServer(config);
nms.run();