-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a00a4ba
commit 5a21450
Showing
5 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
README-zh.md | ||
README.md | ||
LICENSE | ||
.all-contributorsrc | ||
logs | ||
src/node_modules | ||
src/tsconfig.json | ||
src/webpack.config.js | ||
src/.eslintrc.js | ||
examples |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -91,3 +91,5 @@ typings/ | |
|
||
### Custom | ||
.idea | ||
/examples/*/rebirth_data/* | ||
!/examples/*/rebirth_data/.gitkeep |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM rebirth:1.0.0 | ||
|
||
MAINTAINER Black-Hole<[email protected]> | ||
|
||
RUN apt-get install -yq ffmpeg | ||
|
||
RUN npm install fluent-ffmpeg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
version: '3' | ||
services: | ||
webm2mp4: | ||
build: . | ||
container_name: webm2mp4-rebirth | ||
ports: | ||
- "9223" | ||
- "5920" | ||
volumes: | ||
- ./hooks:/etc/www/hooks | ||
- ./rebirth_data/video:/root/Downloads | ||
- ./rebirth_data/logs:/etc/www/logs | ||
environment: | ||
MATERIAL_URL: "https://www.bugs.cc/self_page/github/rebirth/webm2mp4/" | ||
START_VNC: "yes" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
const { join } = require('path'); | ||
const { homedir } = require('os'); | ||
const ffmpeg = require('fluent-ffmpeg'); | ||
const { loggerHooks } = require('../lib/log'); | ||
|
||
module.exports = { | ||
completeRecordAfter: (data) => { | ||
const baseFile = join(homedir(), 'Downloads'); | ||
const inputFile = join(baseFile, `${data.fileName}.webm`); | ||
const outputFile = join(baseFile, `${data.fileName}.mp4`) | ||
|
||
return new Promise((resolve, reject) => { | ||
ffmpeg(inputFile) | ||
.on('start', commandLine => { | ||
loggerHooks.info('ffmpeg start', { | ||
commandLine | ||
}); | ||
}) | ||
.on('error', err => { | ||
loggerHooks.error('ffmpeg error', { | ||
errMessage: err.message, | ||
errStack: err.stack | ||
}); | ||
reject(err); | ||
}) | ||
.on('end', () => { | ||
loggerHooks.info('ffmpeg complete', { | ||
inputFile, | ||
outputFile | ||
}); | ||
resolve(); | ||
}) | ||
.outputOptions(['-fflags +genpts', '-max_muxing_queue_size 99999', '-r 30', '-crf 20']) | ||
.save(outputFile); | ||
}); | ||
} | ||
}; |