forked from abalabahaha/eris
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add OggOpusPassthroughTransformer, revert FFmpegOggTransformer
- Loading branch information
1 parent
f3a8702
commit cd3d054
Showing
4 changed files
with
47 additions
and
3 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
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
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
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,32 @@ | ||
"use strict"; | ||
|
||
const FFmpegDuplex = require("./FFmpegDuplex"); | ||
|
||
module.exports = function(options = {}) { | ||
if(!options.command) { | ||
throw new Error("Invalid converter command"); | ||
} | ||
if(options.frameDuration === undefined) { | ||
options.frameDuration = 60; | ||
} | ||
let inputArgs = [ | ||
"-loglevel", "24" | ||
].concat(options.inputArgs || []); | ||
if(options.format === "pcm") { | ||
inputArgs = inputArgs.concat( | ||
"-f", "s16le", | ||
"-ar", "48000", | ||
"-ac", "2" | ||
); | ||
} | ||
inputArgs = inputArgs.concat( | ||
"-i", options.input || "-", | ||
"-vn" | ||
); | ||
const outputArgs = [ | ||
"-c", "copy", | ||
"-f", "ogg", | ||
"-" | ||
]; | ||
return FFmpegDuplex.spawn(options.command, inputArgs.concat(options.encoderArgs || [], outputArgs)); | ||
}; |