diff options
| author | Jibon Costa <jiboncosta57@gmail.com> | 2020-04-01 13:33:59 +0600 |
|---|---|---|
| committer | Jibon Costa <jiboncosta57@gmail.com> | 2020-04-01 13:33:59 +0600 |
| commit | af776feee533e0d8244840c751b1a2254c1d432b (patch) | |
| tree | 431389a5bfae8ef25858d8db99c427503897380e /ffmpegServer.js | |
| parent | 1b9b7e254aaba5fcb9ff3bbd79fa5613cdc406e4 (diff) | |
| download | bbb-recorder-af776feee533e0d8244840c751b1a2254c1d432b.tar.gz bbb-recorder-af776feee533e0d8244840c751b1a2254c1d432b.zip | |
live rtmp reconnect & google chrome use
Diffstat (limited to 'ffmpegServer.js')
| -rw-r--r-- | ffmpegServer.js | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/ffmpegServer.js b/ffmpegServer.js index ef8c3a6..c4acb1b 100644 --- a/ffmpegServer.js +++ b/ffmpegServer.js @@ -36,22 +36,22 @@ wss.on('connection', function connection(ws, req) { // FFmpeg will read input video from STDIN '-i', '-', - // Chromium doesn't support H.264, set the video codec to 'libx264' - // or similar to transcode it to H.264 here on the server. - '-vcodec', 'libx264', + // If we're encoding H.264 in-browser, we can set the video codec to 'copy' + // so that we don't waste any CPU and quality with unnecessary transcoding. + '-vcodec', 'copy', //No browser currently supports encoding AAC, so we must transcode the audio to AAC here on the server. '-acodec', 'aac', - // FLV is the container format used in conjunction with RTMP - '-f', 'flv', - '-max_muxing_queue_size', '99999', '-preset', 'veryfast', //'-vf', 'mpdecimate', '-vsync', 'vfr', //'-vf', 'mpdecimate,setpts=N/FRAME_RATE/TB', - + + // FLV is the container format used in conjunction with RTMP + '-f', 'flv', + // The output RTMP URL. // For debugging, you could set this to a filename like 'test.flv', and play // the resulting file with VLC. @@ -61,6 +61,8 @@ wss.on('connection', function connection(ws, req) { // If FFmpeg stops for any reason, close the WebSocket connection. ffmpeg.on('close', (code, signal) => { console.log('FFmpeg child process closed, code ' + code + ', signal ' + signal); + //console.log("reconnecting...") + ws.send("ffmpegClosed") ws.terminate(); }); |
