Discord Voice Recorder
A Discord.js script which can record voice calls. Summon the bot to a voice channel, and voilĂ ! the audio is piped right into your local machine. Jump to Installation & Usage to get started.
Index
Note: Recording voice calls without prior consent violates privacy. Do not use this bot without approval. I'm not responsible for your insanity.
Installation and Usage
Clone the repository :
git clone https://github.com/chebro/discord-voice-recorder/
Create a discord bot if you don't have one already and invite the bot to your server, then:
- Create
config.json
file and a/recordings
directory at the root folder. - Paste the bot token (from developer window) and any bot prefix into
config.json
, like so:
{
"BOT_TOKEN": "<YOUR_BOT_TOKEN>",
"PREFIX": "<BOT_PREFIX>"
}
You can run the script in any of the following two ways:
Run Locally
-
Run
npm i
to download necessarynode_modules
. -
Run
npm start
.
The bot should be online.
Run in Container
- Build the docker image:
docker build -t dvr .
- Bind
/recordings
directory on host to container and start the container with a custom name:
docker run \
--name <CONTAINER_NAME> \
--mount type=bind,source="$(pwd)"/recordings,target=/usr/src/bot/recordings \
dvr
The bot should be online.
Bot Commands
-
Start Recording :
<PREFIX>enter <VOICE_CHANNEL_NAME>
-
Stop Recording :
<PREFIX>exit
Managing the Output
The output for each piece of audio stream is written to a unique file in PCM format (48000 Hz, signed 16-bit little-endian, 2 channel (stereo)) and saved in the /recordings
directory organized by user id (/recordings/<USER_ID>/
).
Merge Recording
To merge the output files, run:
node /bin/merge.js
This will merge each user's audio clips into a single pcm file (/recordings/<USER-ID>.pcm
) with all the proper delays to make all output files line up.
Note: Empty your recordings
folder after each session. Running ./bin/merge.js
otherwise will dump large merge files.
Convert the Merged File to MP3
Head over to FFmpeg.org, and download executables for your OS; If you're on Windows, double-check if the FFmpeg bin is on your path. As discussed in issue #3, to convert pcm to mp3, run:
ffmpeg -f s16le -ar 48000 -ac 2 -i merge.pcm out.mp3
Thanks
Special thanks to @eslachance for the gist. It is what inspired me to make this repo.
TODO
In my fork of the repo, I plan to add a few features:
- Multi-User support
- Merge directly into more portable audio formats (.wav)
- ~~Possibly use the slnt RIFF chunk in wav to allow for longer recordings ~~
slnt chunk is not supported by ffmpeg, and so I will not be implementing this
- Automatically merge outputs after finishing a session
- Handle the exception that occurs when someone is in the middle of talking, and the exit command is called.