Discord.js: Support for additional ffmpeg input parameters on voice.

Created on 13 Oct 2018  路  3Comments  路  Source: discordjs/discord.js

Is your feature request related to a problem? Please describe.
I noticed that Discord.js Voice doesn't support additional input parameters on ffmpeg encoder. Because of this, we cannot really tweak the sound output that much.

Describe the ideal solution
This can be implemented on the <Voice Connection>.play() options. Where in we can put the additional params on the ffmpeg along side with the default one.

Describe alternatives you've considered
I thought about recreating the readable stream, but that can become a cpu intensive workload because of double processing that happens, where in you can just use the ffmpeg to fine tune the sound.

voice enhancement

Most helpful comment

I think it'd be easier if you just use the prism module (npm i amishshah/prism-media), it's more suited to the job.

const input = getInputStream();

const transcoder = new prism.FFmpeg({
  args: [
    '-analyzeduration', '0',
    '-loglevel', '0',
    '-f', 's16le',
    '-ar', '48000',
    '-ac', '2',
    // Add your -af equalizer here
  ],
});

const output = input.pipe(transcoder);

connection.play(output, { type: 'converted' });

I don't think this is something that we should add to Discord.js internally as FFmpeg arguments can get complex, and using prism yourself should be fine anyway.

All 3 comments

What additional parameters would you use?

the -af equalizer

I think it'd be easier if you just use the prism module (npm i amishshah/prism-media), it's more suited to the job.

const input = getInputStream();

const transcoder = new prism.FFmpeg({
  args: [
    '-analyzeduration', '0',
    '-loglevel', '0',
    '-f', 's16le',
    '-ar', '48000',
    '-ac', '2',
    // Add your -af equalizer here
  ],
});

const output = input.pipe(transcoder);

connection.play(output, { type: 'converted' });

I don't think this is something that we should add to Discord.js internally as FFmpeg arguments can get complex, and using prism yourself should be fine anyway.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tiritto picture tiritto  路  3Comments

iCrawl picture iCrawl  路  3Comments

Alipoodle picture Alipoodle  路  3Comments

shukriadams picture shukriadams  路  3Comments

kvn1351 picture kvn1351  路  3Comments