Open jamesdools opened 3 years ago
Hi James!
I took a look at your code snippet and I managed to reproduce the EPIPE
error. It seems to come from discord-ytdl-core not properly propagating errors. If you take a look at its source code, you'll notice that the only errors that are actually propagated are the ones from inputStream
.
A quick fix for me was adding the following directly after the declaration of outputStream
on line 81:
output.on('error', e => outputStream.emit('error', e));
I'd recommend that the author of that package makes sure that they propagate all of these errors, or consider using stream.pipeline to really reduce on some of the boilerplate there.
Note that this won't remove the EPIPE error entirely (it will still be thrown, but with this fix it won't crash the process), so you'll have to make sure to ignore errors once you've stopped playing that stream.
Let me know if this works for you!
Hey Amish!
Thanks so much for that - makes a lot of sense. Running that fix locally it does catch the error, and I can run with that for now. Have made a quick PR for that with discord-ytdl-core 👍
Was still curious about the error itself:
Error: write EPIPE
at WriteWrap.onWriteComplete [as oncomplete] (internal/stream_base_commons.js:94:16) {
errno: -32,
code: 'EPIPE',
syscall: 'write'
}
It does seem to trim the clip at the right start / end point, but error on onWriteComplete
.
Any thoughts on if that's just down to the usage of discord-ytdl-core
(or maybe my ffmpeg args?) 😄
As mentioned previous, I'm supplying['-ss', '2:10', '-to', '2:30']
while discord-ytdl-core adds a few boilerplate ones too.
Issue:
Hey Amish - appreciate all the work on this!
I'm using discord-ytdl-core to effectively trim a youtube clip with a start & end time (
-ss
/-to
flags in FFmpeg).Some flags work okay, but those two together consistently throws a
write EPIPE
error, which I can't handle gracefully. Seems like an error with the readable stream upon after the ffmpeg process.Wondering if you know what this might be?
Steps to reproduce:
Originally opened an issue in the above mentioned repo but apparently is happening directly with
prism-media
.Code snippet inside this issue: https://github.com/DevSnowflake/discord-ytdl-core/issues/20
Further details: