node-ytdl-core
node-ytdl-core copied to clipboard
Error: imput stream: aborted
Today i wrote simple play command for discord bot. But after some time of music plaing i get this error My code for music play is:
const { Permissions:{FLAGS} } = require ("discord.js")
const ytdl = require('ytdl-core')
const fs = require('fs')
module.exports={
name: "play",
description: "Puszczanie muzyki",
args: true,
usage: "<tytuł/url>",
guildOnly: true,
cooldown: 10,
aliases: ["p"],
botPermissions: [FLAGS.CONNECT,FLAGS.SPEAK],
async run(message, args) {
//console.log(args)
const voiceChannel = message.member.voice.channel
if(!voiceChannel) return message.channel.send("Potrzebujesz być na kanale głosowym by to zrobić")
try {
var connection = await voiceChannel.join()
} catch (error) {
console.log(`There was an error connecting to the voice channel: ${error}`)
}
const dispatcher = connection.play(ytdl(args[0],{Quality: 'highestaudio'},{filter:'audiooly'},{highWaterMark: 1<<23},{dlChunkSize:0}))
.on('finish',() => {
voiceChannel.leave()
})
.on('error', error => {
console.log(error)
})
dispatcher.setVolumeLogarithmic(5 / 5)
}
}
Any ideas how to fix it ?
does calling ytdl by itself show this error too? or only with discordjs? what's your version? a similar bug was recently fixed.
I dont know . And im using the newest version of discord js and ytdl How similar bug was fixed ?
Question: how can i get the transcript from the youtube url?
I have this error show up quite frequently. I've run the ytdl-core tests by cloning the repo etc and no issues there The issue seems to arise after some time of playing, at which point it will crash and throw the error mentioned earlier.
I am running discord js 12.5.1 and ytdl-core 4.5.0 This has been occurring across multiple versions of ytdl-core for me.
Node: 15.5.1 Running on Ubuntu I can provide more info if needed
I am having this issue as well I can play about 3 or 4 songs and then this issue occurs> Interestingly it is not at the beginning or end of a video but can be anywhere randomly
I too am using Discord.js and this error is called from the Discord Voice Dispatcher however it is clearly in relation to the input stream, which in our case is ytdl-core
Raspberry Pi (Raspbian - latest) nodejs @15.x.x
ytdl-core @4.5.0 ffmpeg-static @4.2.8 discord.js @12.5.1 @discord.js/opus @0.3.3
Today i runed test that author submit in the his code and got this error : (logs below)
0 verbose cli [ 0 verbose cli 'D:\\nodejs\\node.exe', 0 verbose cli 'D:\\nodejs\\node_modules\\npm\\bin\\npm-cli.js', 0 verbose cli 'run', 0 verbose cli 'test:irl' 0 verbose cli ] 1 info using [email protected] 2 info using [email protected] 3 timing config:load:defaults Completed in 1ms 4 timing config:load:file:D:\nodejs\node_modules\npm\npmrc Completed in 3ms 5 timing config:load:builtin Completed in 3ms 6 timing config:load:cli Completed in 1ms 7 timing config:load:env Completed in 0ms 8 timing config:load:file:C:\Users\polsk\Downloads\node-ytdl-core-master\node-ytdl-core-master\.npmrc Completed in 0ms 9 timing config:load:project Completed in 1ms 10 timing config:load:file:C:\Users\polsk\.npmrc Completed in 0ms 11 timing config:load:user Completed in 0ms 12 timing config:load:file:C:\Users\polsk\AppData\Roaming\npm\etc\npmrc Completed in 0ms 13 timing config:load:global Completed in 0ms 14 timing config:load:cafile Completed in 0ms 15 timing config:load:validate Completed in 0ms 16 timing config:load:setUserAgent Completed in 1ms 17 timing config:load:setEnvs Completed in 0ms 18 timing config:load Completed in 7ms 19 verbose npm-session 588df15ba9a49949 20 timing npm:load Completed in 14ms 21 timing command:run-script Completed in 7681ms 22 verbose stack Error: command failed 22 verbose stack at ChildProcess.<anonymous> (D:\nodejs\node_modules\npm\node_modules\@npmcli\promise-spawn\index.js:64:27) 22 verbose stack at ChildProcess.emit (node:events:378:20) 22 verbose stack at maybeClose (node:internal/child_process:1067:16) 22 verbose stack at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5) 23 verbose pkgid [email protected] 24 verbose cwd C:\Users\polsk\Downloads\node-ytdl-core-master\node-ytdl-core-master 25 verbose Windows_NT 10.0.19042 26 verbose argv "D:\\nodejs\\node.exe" "D:\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "test:irl" 27 verbose node v15.8.0 28 verbose npm v7.5.1 29 error code 4 30 error path C:\Users\polsk\Downloads\node-ytdl-core-master\node-ytdl-core-master 31 error command failed 32 error command C:\Windows\system32\cmd.exe /d /s /c mocha --timeout 16000 test/irl-test.js 33 verbose exit 4
Hi,
I'm getting this error too
[email protected] [email protected] [email protected] @discord.js/[email protected] I can provide more info if needed
🤔 it would be cool to do some modifications to discord.js to check for ffmpeg errors
other than that this is pretty unfixable in the current situation... we'd need a way to reproduce this error without discord.js... or at least narrow down if it is actually discord.js or ytdl-core...
So im running a small discord bot called Tinker I run development on my laptop and production on my raspberry pi. The issue does not seem to occur when in development. The only differences are, of course the OS, and the nodejs version. The code is the exact same Here are the stats of the two:
Development (no issues)
Windows Home (latest updates)
node index.js
run directly in terminal (Command Prompt)
nodejs: v14.16.1
Production (fairly regular "Input Stream Aborted" errors)
Raspbian (latest updates)
pm2 start tinker
pm2 process manager, configured with the correct nodejs runtime
nodejs: v16.0.0
Edit
I have just done a further test, running my production with all the same settings and system but with nodejs v 14.16.1 and no errors whatsoever. Nodejs version appears to be the culprit (at least in my instance). I hope this helps some people with issues and the devs with fixing the error. Love the package and keep up the good work!
So im running a small discord bot called Tinker I run development on my laptop and production on my raspberry pi. The issue does not seem to occur when in development. The only differences are, of course the OS, and the nodejs version. The code is the exact same Here are the stats of the two:
Development (no issues) Windows Home (latest updates)
node index.js
run directly in terminal (Command Prompt) nodejs: v14.16.1Production (fairly regular "Input Stream Aborted" errors) Raspbian (latest updates)
pm2 start tinker
pm2 process manager, configured with the correct nodejs runtime nodejs: v16.0.0Edit
I have just done a further test, running my production with all the same settings and system but with nodejs v 14.16.1 and no errors whatsoever. Nodejs version appears to be the culprit (at least in my instance). I hope this helps some people with issues and the devs with fixing the error. Love the package and keep up the good work!
@LordFarquhar Did you find any solution yet ? I am facing a same issue.
Changing that node version seemed to solve it all for me
Changing that node version seemed to solve it all for me
@LordFarquhar Thank you for the reply. Can you let me know which version of node and pm2 did you use in production?
Can reproduce on Windows and Linux on Node.js v16 (16.5.0), but this issue does not exist on v14 (14.17.3). Using ytdl-core and piping it to fs.createWriteStream does not have any issue, only if ytdl-core + Discord.js has this issue, probably related to discordjs/discord.js#5214, and probably has something to do with highWatermark, will update the situation later
Node LTS, pm2 latest update DiscordJS is at the latest stable update
Can reproduce on Windows and Linux on Node.js v16 (16.5.0), but this issue does not exist on v14 (14.17.3). Using ytdl-core and piping it to fs.createWriteStream does not have any issue, only if ytdl-core + Discord.js has this issue, probably related to discordjs/discord.js#5214, and probably has something to do with highWatermark, will update the situation later
Confirmed, setting ytdl-core highWatermark option to 32MiB on Node.js v16 (16.5.0) fixes the problem, so the workarounds are use Node v14.x or play with the highWatermark settings, not sure if this will apply to everyone
I've the same problem. I'm streaming to Telegram.
Here are my options.
Oh and here's my Node version.
thinking it would be cool to do some modifications to discord.js to check for ffmpeg errors
other than that this is pretty unfixable in the current situation... we'd need a way to reproduce this error without discord.js... or at least narrow down if it is actually discord.js or ytdl-core...
Here I get it without Discord.js, @TimeForANinja. :)
I'm using ytdl-core-telegram, gram-tgcalls and GramJS.
Here's my full source code: https://github.com/callsmusic/callsmusicremix
Been getting this issue after playing for a while. then it errors out.
Error: aborted
at connResetException (node:internal/errors:691:14)
at TLSSocket.socketCloseListener (node:_http_client:407:19)
at TLSSocket.emit (node:events:406:35)
at node:net:672:12
at TCP.done (node:_tls_wrap:580:7) {
code: 'ECONNRESET'
}
Node: 16.6.1 ytdl-core: 4.9.1
@GaryCraft Try using a stable version of Node (ie the v14 LTS) and see if that fixes it?
@redbrain the thing is that I need to use Node v 16+
I am having the same issue with it aborting playing.
I am having tha same issue.
I got a direct video url (like https://r8--***.googlevideo.com/videoplayback?***
) via youtube-dl
and tried playing directly with the url using miniget
, but aborted error still occurred.
Though this is not what prove the issue is of miniget, I think it might be the helpful information.
highWaterMark
option won't solve the actual cause of the issue because it only makes the time to the error an error occurs longer.
node
: v16.6.1
discord.js
: v13.1.0
@discordjs/voice
: v0.6.0
ytdl-core
: v4.9.1
miniget
: v4.2.1
I can reproduce the issue only with node
(v16.6.1), ytdl-core
(v4.9.1), prism-media
(v1.3.2) and node-opus
(v0.3.3).
I don't know if this is helpful but the complete source code is here: https://github.com/mtripg6666tdr/ytdl-test/blob/master/src/index.js
I've noticed that this error happens every time when a song plays to 30 minutes
Maybe the time when this error occur related to highWaterMark
and actual size of the stream.
When I played a stream, it occurred in sometimes 44 minutes, at other times in 28 minutes (highWaterMark
was set default).
When I played an other stream, it occurred in 57 seconds.
is this looks like related problem fent/node-feedsub#60
is this looks like the same problem fent/node-feedsub#60
This error occurs nodejs v15 or more only, same as the issue you mentioned. So this issue might be solved by updating miniget version. (unverified yet) I will try it!