bin | ||
sounds | ||
.gitignore | ||
index.js | ||
LICENSE | ||
package-lock.json | ||
package.json | ||
README.md |
Discord Voice Recorder
A Discord.js script that can record discord voice calls. Summon a bot running this script to a voice channel to record a multi-user call, and save the recording locally!
Jump to Installation & Usage to get started.

Index
Installation and Usage
Download the Source and Install FFmpeg
Clone the repository :
git clone https://github.com/sravanth-chebrolu/discord-voice-recorder/
Run npm i
to install the dependent node_modules
.
Next head over to the FFmpeg.org, and download the executables for your OS; If you're on Windows, double check if ffmpeg bin is on your path.
Setting Up the Local Environment
To run this script locally you will need to create a discord bot first. Invite your bot to your server(to avoid potential problems, it is recommended that the bot be given adminstrator privileges when creating the initve link). Follow the next steps to finish the setup:
- Create a
config.json
file and arecordings
folder at the root directory. - Copy the the bot token from the developer window.
- Choose a prefix you want the bot to answer to.
Paste the bot token and the prefix value to your config.json, like this:
{
"BOT_TOKEN": "<your-bot-token>",
"PREFIX": "<your-prefix>"
}
And you're all set. Note that all your recordings will be saved to the recordings
directory.
Running the Script
To run the script just run:
npm start
The bot should be online and you can run the bot commands in your discord server. There are only two commands currently,
Start Recording
<PREFIX>enter <VOICE_CHANNEL_NAME>
Note: You should hear a 'drop' sound when you run the command indicating that the connection has been established. If you don't hear the sound, there's a problem with your ffmpeg installation.
Stop Recording
<PREFIX>exit
Managing the Output
Keep in mind that the audio will be recorded in the PCM format.
To work with PCM audio, you could use software such as Audacity. To import the audio into Audacity, open File > Import > Raw Data... and then select your audio file. You should select Signed 16-bit PCM as the encoding, a Little-endian byte order, 2 Channels (Stereo) and a sample rate of 48000Hz.
Merge Recording
The output is saved as a seperate file for each audio stream, and is named with the timestamp at which it was created. To merge all output files, run:
node ./bin/merge.js
This will pipe data from the individual PCM files to a merge.pcm
file in the recordings
directory.
IMPORTANT: Do not forget to empty your recordings
folder after each recording session. Running ./bin/merge.js
without deleting a previously created merge.pcm
will make bad things happen. This will be fixed later.
Convert the Merged File to MP3
Since FFmpeg is a dependency, we can use it to convert the raw .pcm
file to a more user friendly .mp3
format, mentioned in issue #3 this can be done using:
ffmpeg -f s16le -ar 44.1k -ac 2 -i merge.pcm output.mp3
Thanks
Also, huge thanks to @eslachance for the gist, which is what this repo is based on. https://gist.github.com/eslachance/fb70fc036183b7974d3b9191601846ba.