discord.py: create_ytdl_player stream crashes

This is the error message I’m getting

[tls @ 0500eb60] Error in the pull function. [matroska,webm @ 0501c500] Read error [tls @ 0500eb60] The specified session has been invalidated for some reason. Last message repeated 1 times

It doesn’t happen all the time though. Usually the first video plays just fine without problems. The video after that might play well but usually after that this error comes and snowballs to every video in the playlist that’s left basically emptying the queue.

The videos that get this error in the snowball effect usually play for a fraction of a second before it moves to the next video on the queue.

I have looked at issue #157 but that hasn’t been of any help since I have the latest versions of everything as of today. (I am using ffmpeg btw because avconv had the same issue as in #157)

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 20 (2 by maintainers)

Most upvoted comments

If you use Ubuntu 16.04, ffmpeg is normally installed version 2.8~.

However, This ffmpeg version didn’t include “reconnect_streamed” and “reconnect_delay_max”…

So you need to upgrade your ffmpeg version to 3… I’m using followed way and works well !

sudo add-apt-repository ppa:jonathonf/ffmpeg-3 -y sudo apt update sudo apt install ffmpeg -y

references : http://blog.programster.org/ubuntu-16-04-install-ffmpeg-from-ppa https://github.com/qeled/discordie/issues/62

@Vadyy So I reproduced the issue and this time I got the same error messages as you did, so I guess the problem is related. So now I’m gonna recommend that you download the files before playing, so you don’t have to worry about that problem again. If you need help on how to do that, send me a message on discord s0hvaperuna#4758

@Vadyy I solved it completely by downloading the file first and then playing it. Also I think your problem is a bit different from mine since you are getting errors when trying to read from the socket.

Can you tell the steps to reproduce this. I’ll look into more detail on it tomorrow.

OK now its mostly fixed. I just added this line to audio_player_task in the VoiceState class (not in the discord module but like the one in the examples)

self.current.player = await self.voice.create_ytdl_player(self.current.player.url, ytdl_options=self.opts, after=self.toggle_next)

This seems to get the new download_url and works way more consistently. The error still comes sometimes but it doesn’t cause the whole playlist to end now. Just one video will be skipped where the URL has expired. I have not tested this with long videos yet so I’m not sure how this fix is gonna affect those. I’ll try to update the post when I have tested at those