Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Move seek arg to post-encode" #16

Merged
merged 3 commits into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 36 additions & 23 deletions lib/voice/Piper.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,30 +166,43 @@ class Piper extends EventEmitter {
} else {
if(this.libopus) {
if(options.opusPassthrough) {
this.streams.push(source = source.pipe(new OggOpusPassthroughTransformer({
command: this.converterCommand,
encoderArgs: options.encoderArgs,
inputArgs: options.inputArgs,
format: options.format,
frameDuration: options.frameDuration
})).once("error", (e) => this.stop(e)));
} else if(typeof source === "string") {
this.streams.push(source = new FFmpegOggTransformer({
command: this.converterCommand,
input: source,
encoderArgs: options.encoderArgs,
inputArgs: options.inputArgs,
format: options.format,
frameDuration: options.frameDuration
}).once("error", (e) => this.stop(e)));
if(typeof source === "string") {
this.streams.push(source = new OggOpusPassthroughTransformer({
command: this.converterCommand,
input: source,
encoderArgs: options.encoderArgs,
inputArgs: options.inputArgs,
format: options.format,
frameDuration: options.frameDuration
}).once("error", (e) => this.stop(e)));
} else {
this.streams.push(source = source.pipe(new OggOpusPassthroughTransformer({
command: this.converterCommand,
encoderArgs: options.encoderArgs,
inputArgs: options.inputArgs,
format: options.format,
frameDuration: options.frameDuration
})).once("error", (e) => this.stop(e)));
}
} else {
this.streams.push(source = source.pipe(new FFmpegOggTransformer({
command: this.converterCommand,
encoderArgs: options.encoderArgs,
inputArgs: options.inputArgs,
format: options.format,
frameDuration: options.frameDuration
})).once("error", (e) => this.stop(e)));
if(typeof source === "string") {
this.streams.push(source = new FFmpegOggTransformer({
command: this.converterCommand,
input: source,
encoderArgs: options.encoderArgs,
inputArgs: options.inputArgs,
format: options.format,
frameDuration: options.frameDuration
}).once("error", (e) => this.stop(e)));
} else {
this.streams.push(source = source.pipe(new FFmpegOggTransformer({
command: this.converterCommand,
encoderArgs: options.encoderArgs,
inputArgs: options.inputArgs,
format: options.format,
frameDuration: options.frameDuration
})).once("error", (e) => this.stop(e)));
}
}
this.streams.push(source.pipe(new OggOpusTransformer()).once("error", (e) => this.stop(e)));
} else {
Expand Down
2 changes: 1 addition & 1 deletion lib/voice/streams/FFmpegOggTransformer.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ module.exports = function(options = {}) {
options.frameDuration = 60;
}
let inputArgs = [
"-i", options.input || "-",
"-analyzeduration", "0",
"-loglevel", "24"
].concat(options.inputArgs || []);
Expand All @@ -22,6 +21,7 @@ module.exports = function(options = {}) {
);
}
inputArgs = inputArgs.concat(
"-i", options.input || "-",
"-vn"
);
const outputArgs = [
Expand Down
2 changes: 1 addition & 1 deletion lib/voice/streams/OggOpusPassthroughTransformer.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ module.exports = function(options = {}) {
options.frameDuration = 60;
}
let inputArgs = [
"-i", options.input || "-",
"-loglevel", "24"
].concat(options.inputArgs || []);
if(options.format === "pcm") {
Expand All @@ -21,6 +20,7 @@ module.exports = function(options = {}) {
);
}
inputArgs = inputArgs.concat(
"-i", options.input || "-",
"-vn"
);
const outputArgs = [
Expand Down
Loading