-
-
Notifications
You must be signed in to change notification settings - Fork 110
Somtimes ffmpeg process is not finished. #194
Comments
Please post code that can reproduce this situation |
// create AudioResource
async function songDownload(url) {
const ytdlProcess = ytdl(
url,
{
o: '-',
q: '',
f: 'bestaudio[ext=webm+acodec=opus+asr=48000]/bestaudio',
r: '100K'
},
{ stdio: ['ignore', 'pipe', 'ignore'] }
);
const stream = ytdlProcess.stdout;
if (!stream) {
throw new Error('no stdout');
}
const onError = () => {
if (!ytdlProcess.killed) {
ytdlProcess.kill();
}
stream.resume();
};
ytdlProcess.on('error', onError);
try {
const probe = await demuxProbe(stream);
return createAudioResource(probe.stream, { inputType: probe.type, inlineVolume: true });
} catch (err) {
onError();
throw err;
}
};
// play the song
try {
player.play(await songDownload(songs[0].url));
player.state.resource.volume.setVolume(volume / 100);
} catch {
sendMessage('failed to play song');
songs.shift();
return;
} |
Just a recommendation, you can switch to play-dl. Play-dl doesn't require ffmpeg in normal streams. |
Thanks for your recommendation. However, I think that ffmpeg used by discordjs/voice module (https://github.com/discordjs/voice/blob/main/src/audio/TransformerGraph.ts) |
Can you test again with using this script running in a different ubuntu session after the 1st song has been completed ??
|
I will check if there is a bug that corresponds to this issue. Thanks! |
Even if all song is finished, result of that script is Running |
That only means ffmpeg instance is not deleted. Maybe this is the reason of #164 [ Memory Leak ] . |
Even if 3 songs are finished, 3 ffmpeg processes are not ended. Is there any solution?
Further details:
The text was updated successfully, but these errors were encountered: