|
|
|
@ -41,7 +41,11 @@ function init () { |
|
|
|
|
while(true){ |
|
|
|
|
if(session.audioCodec !== 0 && session.videoCodec !== 0){ |
|
|
|
|
transCommand(results[0].username, key).then((r) => { |
|
|
|
|
execFile(config['media']['ffmpeg'], r, {maxBuffer: Infinity}, (err, stdout, stderr) => {}); |
|
|
|
|
execFile(config['media']['ffmpeg'], r, {maxBuffer: Infinity}, (err, stdout, stderr) => { |
|
|
|
|
console.log(err); |
|
|
|
|
console.log(stdout); |
|
|
|
|
console.log(stderr); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
@ -112,7 +116,9 @@ function init () { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
async function transCommand(user: string, key: string): Promise<string[]>{ |
|
|
|
|
let args: string[] = [/*'-loglevel', 'fatal',*/ '-y', '-i', 'rtmp://127.0.0.1:'+config['rtmp']['port']+'/'+config['media']['privateEndpoint']+'/'+key]; |
|
|
|
|
let args: string[] = ['-loglevel', 'fatal', '-y']; |
|
|
|
|
if(config['transcode']['inputflags'] !== null && config['transcode']['inputflags'] !== "") args = args.concat(config['transcode']['inputflags'].split(" ")); |
|
|
|
|
args = args.concat(['-i', 'rtmp://127.0.0.1:'+config['rtmp']['port']+'/'+config['media']['privateEndpoint']+'/'+key, '-movflags', '+faststart']); |
|
|
|
|
if(config['transcode']['adaptive']===true && config['transcode']['variants'] > 1) { |
|
|
|
|
for(let i=0;i<config['transcode']['variants'];i++){ |
|
|
|
|
args = args.concat(['-map', '0:2']); |
|
|
|
@ -133,8 +139,11 @@ async function transCommand(user: string, key: string): Promise<string[]>{ |
|
|
|
|
else { |
|
|
|
|
args = args.concat(['-c:a', 'aac', '-c:v', 'libx264']); |
|
|
|
|
} |
|
|
|
|
args = args.concat(['-preset', 'veryfast', '-tune', 'zerolatency']); |
|
|
|
|
//if(config['transcode']['format'] === 'dash')
|
|
|
|
|
args = args.concat(['-remove_at_exit', '1', '-seg_duration', '1', '-window_size', '30', '-f', 'dash', config['http']['directory']+'/'+config['media']['publicEndpoint']+'/'+user+'/index.mpd']); |
|
|
|
|
args = args.concat(['-remove_at_exit', '1', '-seg_duration', '1', '-window_size', '30']); |
|
|
|
|
if(config['transcode']['outputflags'] !== null && config['transcode']['outputflags'] !== "") args = args.concat(config['transcode']['outputflags'].split(" ")); |
|
|
|
|
args = args.concat(['-f', 'dash', config['http']['directory']+'/'+config['media']['publicEndpoint']+'/'+user+'/index.mpd']); |
|
|
|
|
//else if(config['transcode']['format'] === 'hls')
|
|
|
|
|
//args = args.concat(['-remove_at_exit', '1', '-hls_time', '1', '-hls_list_size', '30', '-f', 'hls', config['http']['directory']+'/'+config['media']['publicEndpoint']+'/'+user+'/index.m3u8']);
|
|
|
|
|
return args; |
|
|
|
|