Installation
This guide will walk you through installing Discord Player and all the required dependencies.Prerequisites
Check your current Discord.js version:Installation Steps
Install Discord Player
Install the main Discord Player library and the extractors package:
The
@discord-player/extractor package provides default extractors for popular platforms like YouTube, Spotify, SoundCloud, and more.Install Opus Library
We recommend mediaplex for libopus. Mediaplex also helps with audio metadata extraction:
Opus is required for encoding audio data. Without an opus library, Discord Player won’t be able to stream audio to Discord.
Install FFmpeg
FFmpeg or Avconv is required for media transcoding. You can install it from the official website or via npm.
Recommended: System Installation
Download and install FFmpeg from https://ffmpeg.orgAlternative: NPM Installation
If you must install via npm, choose one of these packages:Optional Dependencies
Additional Extractors
While@discord-player/extractor provides most common extractors, you can install additional packages for specific platforms:
Custom FFmpeg Path
If you need to specify a custom FFmpeg path, you can do so when creating the Player instance:Dependency Overview
Here’s what each dependency does:| Package | Purpose | Required |
|---|---|---|
discord-player | Core framework | Yes |
@discord-player/extractor | Default extractors for audio sources | Yes |
discord.js | Discord API wrapper | Yes |
mediaplex | Opus encoding/decoding | Yes |
ffmpeg | Audio/video transcoding | Yes |
Troubleshooting
FFmpeg Not Found
If you get an error that FFmpeg is not found:- Ensure FFmpeg is installed and available in your system PATH
- Try setting the
FFMPEG_PATHenvironment variable - Use the
ffmpegPathoption when creating the Player instance
Opus Library Issues
If you encounter opus-related errors:- Make sure you’ve installed
mediaplex - Try reinstalling the package:
npm install mediaplex --force - Check that your Node.js version is compatible
Discord.js Version Mismatch
If you see warnings about Discord.js version:- Update Discord.js to v14.0 or higher:
npm install discord.js@latest - Clear your node_modules and reinstall:
rm -rf node_modules && npm install