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 /export.js | |
| parent | 1b9b7e254aaba5fcb9ff3bbd79fa5613cdc406e4 (diff) | |
| download | bbb-recorder-af776feee533e0d8244840c751b1a2254c1d432b.tar.gz bbb-recorder-af776feee533e0d8244840c751b1a2254c1d432b.zip | |
live rtmp reconnect & google chrome use
Diffstat (limited to 'export.js')
| -rw-r--r-- | export.js | 26 |
1 files changed, 20 insertions, 6 deletions
@@ -2,7 +2,9 @@ const puppeteer = require('puppeteer'); const Xvfb = require('xvfb'); var exec = require('child_process').exec; const fs = require('fs'); -const homedir = require('os').homedir(); +const os = require('os'); +const homedir = os.homedir(); +const platform = os.platform(); var xvfb = new Xvfb({ silent: true, @@ -26,16 +28,25 @@ var options = { ], } +if(platform == "linux"){ + options.executablePath = "/usr/bin/google-chrome" +}else if(platform == "darwin"){ + options.executablePath = "/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome" +} + + async function main() { try{ - xvfb.startSync() + if(platform == "linux"){ + xvfb.startSync() + } var url = process.argv[2], exportname = process.argv[3], duration = process.argv[4], convert = process.argv[5] - if(!url){ url = 'http://tobiasahlin.com/spinkit/' } - if(!exportname){ exportname = 'spinner.webm' } + if(!url){ url = 'https://www.mynaparrot.com/' } + if(!exportname){ exportname = 'export.webm' } if(!duration){ duration = 10 } if(!convert){ convert = false } @@ -76,7 +87,10 @@ async function main() { await page.waitForSelector('html.downloadComplete', {timeout: 0}) await page.close() await browser.close() - xvfb.stopSync() + + if(platform == "linux"){ + xvfb.stopSync() + } if(convert){ convertAndCopy(exportname) @@ -107,7 +121,7 @@ function convertAndCopy(filename){ console.log(copyTo); console.log(copyFrom); - var cmd = "ffmpeg -y -i '" + copyFrom + "' -preset veryfast -movflags faststart -profile:v high -level 4.2 -max_muxing_queue_size 9999 -vf mpdecimate -vsync vfr '" + copyTo + "'"; + var cmd = "ffmpeg -y -i '" + copyFrom + "' -c:v libx264 -preset veryfast -movflags faststart -profile:v high -level 4.2 -max_muxing_queue_size 9999 -vf mpdecimate -vsync vfr '" + copyTo + "'"; console.log("converting using: " + cmd); |
