From 65894b6f2e2924c27ad4ca150278f99add9be5d0 Mon Sep 17 00:00:00 2001 From: knotteye Date: Tue, 30 Jun 2020 06:26:42 +0000 Subject: [PATCH] Fix for not transcoding streams which aren't already mp4 encoded. --- src/server.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/server.ts b/src/server.ts index 1fff80c..34685ad 100644 --- a/src/server.ts +++ b/src/server.ts @@ -41,7 +41,7 @@ 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}); + execFile(config['media']['ffmpeg'], r, {maxBuffer: Infinity}, (err, stdout, stderr) => {}); }); break; } @@ -112,12 +112,12 @@ function init () { } async function transCommand(user: string, key: string): Promise{ - 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', '-i', 'rtmp://127.0.0.1:'+config['rtmp']['port']+'/'+config['media']['privateEndpoint']+'/'+key]; if(config['transcode']['adaptive']===true && config['transcode']['variants'] > 1) { for(let i=0;i{ } } else { - args = args.concat(['-c:a', 'copy', '-c:v', 'copy']); + args = args.concat(['-c:a', 'aac', '-c:v', 'libx264']); } //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']); @@ -139,4 +139,4 @@ async function transCommand(user: string, key: string): Promise{ //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; } -export { init }; \ No newline at end of file +export { init };