ffmpeg errors
node:events:492
throw er; // Unhandled 'error' event
^
Error: spawn ffmpeg EAGAIN
at ChildProcess._handle.onexit (node:internal/child_process:286:19)
at onErrorNT (node:internal/child_process:484:16)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Emitted 'error' event on ChildProcess instance at:
at ChildProcess._handle.onexit (node:internal/child_process:292:12)
at onErrorNT (node:internal/child_process:484:16)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
errno: -11,
code: 'EAGAIN',
syscall: 'spawn ffmpeg',
path: 'ffmpeg',
spawnargs: [
'-i',
'/home/brunommpreto/Music/CloudMusic/TBT Prod. - Gangsta Gangsta(TBT Remix).mp3',
'-analyzeduration',
'0',
'-loglevel',
'0',
'-acodec',
'libopus',
'-f',
'opus',
'-ar',
'48000',
'-ac',
'2',
'pipe:1'
]
}
node:events:492
throw er; // Unhandled 'error' event
^
Error: spawn ffmpeg EAGAIN
at ChildProcess._handle.onexit (node:internal/child_process:286:19)
at onErrorNT (node:internal/child_process:484:16)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Emitted 'error' event on ChildProcess instance at:
at ChildProcess._handle.onexit (node:internal/child_process:292:12)
at onErrorNT (node:internal/child_process:484:16)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
errno: -11,
code: 'EAGAIN',
syscall: 'spawn ffmpeg',
path: 'ffmpeg',
spawnargs: [
'-i',
'/home/brunommpreto/Music/CloudMusic/TBT Prod. - Gangsta Gangsta(TBT Remix).mp3',
'-analyzeduration',
'0',
'-loglevel',
'0',
'-acodec',
'libopus',
'-f',
'opus',
'-ar',
'48000',
'-ac',
'2',
'pipe:1'
]
}
try {
// Replace 'path/to/your/local/folder' with the path to your local folder containing audio files
const folderPath='/home/brunommpreto/Music/CloudMusic/';
//If theres already a queue avoid re-reading them
if (!queue.length && !running) {
// Read all files in the folder
const files=fs.readdirSync(folderPath);
let i=0;
for (const file of files) {
if (file.toLowerCase().endsWith('.mp3')) {
const filePath=path.join(folderPath, file.replace(/(['"()])/g, '\\$1'));
const resource=await createAudioResource(filePath, { inputType: StreamType.WebmOpus });
queue.push(resource);
i++;
console.log("Loaded " + i + " of " + files.length)
}
}
queue=queue.sort((a, b) => 0.5 - Math.random())
}
if (!isPlaying) {
await playNextTrack(newState);
running = true
}
} catch (error) {
console.error('Error joining voice channel:', error);
}
try {
// Replace 'path/to/your/local/folder' with the path to your local folder containing audio files
const folderPath='/home/brunommpreto/Music/CloudMusic/';
//If theres already a queue avoid re-reading them
if (!queue.length && !running) {
// Read all files in the folder
const files=fs.readdirSync(folderPath);
let i=0;
for (const file of files) {
if (file.toLowerCase().endsWith('.mp3')) {
const filePath=path.join(folderPath, file.replace(/(['"()])/g, '\\$1'));
const resource=await createAudioResource(filePath, { inputType: StreamType.WebmOpus });
queue.push(resource);
i++;
console.log("Loaded " + i + " of " + files.length)
}
}
queue=queue.sort((a, b) => 0.5 - Math.random())
}
if (!isPlaying) {
await playNextTrack(newState);
running = true
}
} catch (error) {
console.error('Error joining voice channel:', error);
}
2 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!okok
@Qjuh still the same
The song is 4 minutes
is there a way to skip them at least ?
I tries this:
the files that ffmpeg cant play
there are 400 music files
and a lot of them throw errors
I just rename them all Audio$N
still the same
I use vlc all of them play
Error: spawn /home/brunommpreto/WebstormProjects/DiscordBots/ucu-pt96/node_modules/ffmpeg-static/ffmpeg EAGAIN
at ChildProcess._handle.onexit (node:internal/child_process:286:19)
at onErrorNT (node:internal/child_process:484:16)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Emitted 'error' event on ChildProcess instance at:
at ChildProcess._handle.onexit (node:internal/child_process:292:12)
at onErrorNT (node:internal/child_process:484:16)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
errno: -11,
code: 'EAGAIN',
syscall: 'spawn /home/brunommpreto/WebstormProjects/DiscordBots/ucu-pt96/node_modules/ffmpeg-static/ffmpeg',
path: '/home/brunommpreto/WebstormProjects/DiscordBots/ucu-pt96/node_modules/ffmpeg-static/ffmpeg',
spawnargs: [
'-i',
'/home/brunommpreto/Music/CloudMusic/ILLENIUM_Phoebe_Ryan_-_Mine__Illenium_Remix_.mp3',
'-analyzeduration',
'0',
'-loglevel',
'0',
'-acodec',
'libopus',
'-f',
'opus',
'-ar',
'48000',
'-ac',
'2',
'pipe:1'
]
}
Node.js v20.10.0
Error: spawn /home/brunommpreto/WebstormProjects/DiscordBots/ucu-pt96/node_modules/ffmpeg-static/ffmpeg EAGAIN
at ChildProcess._handle.onexit (node:internal/child_process:286:19)
at onErrorNT (node:internal/child_process:484:16)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Emitted 'error' event on ChildProcess instance at:
at ChildProcess._handle.onexit (node:internal/child_process:292:12)
at onErrorNT (node:internal/child_process:484:16)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
errno: -11,
code: 'EAGAIN',
syscall: 'spawn /home/brunommpreto/WebstormProjects/DiscordBots/ucu-pt96/node_modules/ffmpeg-static/ffmpeg',
path: '/home/brunommpreto/WebstormProjects/DiscordBots/ucu-pt96/node_modules/ffmpeg-static/ffmpeg',
spawnargs: [
'-i',
'/home/brunommpreto/Music/CloudMusic/ILLENIUM_Phoebe_Ryan_-_Mine__Illenium_Remix_.mp3',
'-analyzeduration',
'0',
'-loglevel',
'0',
'-acodec',
'libopus',
'-f',
'opus',
'-ar',
'48000',
'-ac',
'2',
'pipe:1'
]
}
Node.js v20.10.0
player.on('error', error => {
console.error('Error:', error.message, 'with track', error.resource.metadata.title);
console.log("playing next track")
playNextTrack(voiceChannel)
});
player.on('error', error => {
console.error('Error:', error.message, 'with track', error.resource.metadata.title);
console.log("playing next track")
playNextTrack(voiceChannel)
});