Browse Source

Try to tweak ffmpeg setting, but there are still some stalling issues..

Godzil 5 years ago
parent
commit
14fd18479e
2 changed files with 9 additions and 1 deletions
  1. 6 0
      src/my_request.ts
  2. 3 1
      src/video/stream.ts

+ 6 - 0
src/my_request.ts

@@ -173,6 +173,12 @@ export function eatCookies(config: IConfig)
   j = undefined;
 }
 
+export function getUserAgent(): string
+{
+  return defaultHeaders['User-Agent'];
+}
+
+
 /**
  * Performs a GET request for the resource.
  */

+ 3 - 1
src/video/stream.ts

@@ -3,6 +3,7 @@ import childProcess = require('child_process');
 import os = require('os');
 import path = require('path');
 
+import my_request = require('../my_request')
 import log  = require('../log');
 
 /**
@@ -24,7 +25,8 @@ export default function(rtmpUrl: string, rtmpInputPath: string, swfUrl: string,
   else if (mode === 'HLS')
   {
       cmd = command('ffmpeg') + ' ' +
-          '-y -xerror ' +
+          '-user_agent "' + my_request.getUserAgent() + '" ' +
+          '-y -xerror -discard none ' +
           '-i "' + rtmpInputPath + '" ' +
           '-c copy -bsf:a aac_adtstoasc ' +
           '"' + filePath + '.mp4"';