1.1.0 • Published 4 years ago

discord.js-arbitrary-ffmpeg v1.1.0

Weekly downloads
12
License
ISC
Repository
github
Last release
4 years ago

FFmpeg with custom parameters in Discord.js

Installation:

npm install discord.js-arbitrary-ffmpeg

Example usage:

const Discord = require('discord.js');
const playArbitraryFFmpeg = require('discord.js-arbitrary-ffmpeg');

const objBot = new Discord.Client();

// ... login and connect to a voice channel so you get a voice connection ...

// These params will play a sound file in a much faster speed.
// Standard KHz rate is 44.1.
let arrFFmpegParams = [
  '-i', 'sounds/funny-meme-sound.mp3',
  '-filter:a', 'asetrate=r=66K'
];

const objStreamDispatcher = playArbitraryFFmpeg(
  objVoiceConnection, // A VoiceConnection from Discord.js
  arrFFmpegParams,
  { volume: .25 } // Optional stream options (same as for playFile, playStream, etc.)
);