anxdpanic / plugin.video.twitch

Watch your favorite gaming streams on Kodi
https://twitchaddon.page.link/forum
264 stars 81 forks source link

Video pauses for buffer every 20-30 seconds #67

Closed SubElement closed 10 years ago

SubElement commented 10 years ago

Hey,

I've been having this issue since probably Nov/Dec last year. All of a sudden TwitchTV on OpenELEC on my Intel NUC (wired) started having to buffer every 20-30 seconds, on every stream, regardless of quality.

Streams run perfectly fine in browser on my PC and Mac, wired and wireless.

I've tested this with TwitchTV 1.0.8 on the current OpenELEC stable (3.2.4)and TwitchTV 1.0.8 and 1.1.0 on the latest OpenELEC beta (4.0b5)

If you would like more information, please contact me. I would love to help to get this issue fixed.

Sub

MrSprigster commented 10 years ago

Hey Sub,

Sorry to hear that you're having issues with streams buffering.

Unfortunately anything we change in our code isn't going to help with this problem, this is due to this Addon not handling any aspects of playback.

Our code asks for a playlist file from Twitch's API (based on your selected Quality Options and Stream choice within the UI) and then tells the XBMC video player to load that playlist which then takes over all functionality.

This means that any issues which you experience once playback has already started are not caused by and are outside the control of this Addon and we are therefore unable to change or add anything to fix the problem.

I will however attempt to help you diagnose the source of your buffering issue which is usually caused by a users environment rather than a bug in software.

The first thing I would recommend trying is playing one of the streams that you're having issues with on a Windows machine running XBMC with the latest version of this Addon (1.1.0 at time of writing) to see if you experience the same issues. If you don't experience any buffering then we have at least narrowed the issue down to the OpenELEC platform on Intel NUC hardware and we can continue diagnostics from that point.

Sprig

SubElement commented 10 years ago

Hey Sprig,

Thanks so much for the reply. So just downloaded XBMC 12.3 for Windows, running on a more than powerful enough rig.

I don't believe I didn't think of trying this out! I just did it using the 1.0.8 on the repo and 1.1.0 from GIT, and it's doing exactly the same thing! I honestly thought as soon as you suggested it, that it would work fine.

This really confuses me, as it works perfectly fine in browser on full quality. I have an 100mbit connection, so it's not that either really.

I would love to hear some ideas on what you think it could be.

Sub

MrSprigster commented 10 years ago

Okay, that only leaves your network as the common denominator. The next thing to eliminate is your router. Connect your windows PC directly to your modem via ethernet and retest and see if that solves the issue.

Sprig

kokarn commented 10 years ago

Just to let you know you are not alone. My system does the same thing from time to time. One time it works perfect, next time it buffers over and over.

SubElement commented 10 years ago

Hey Sprig,

Just tried it and it does the same thing. Through browser, totally fine. Through XBMC, has to buffer.

I do notice when I bring up the stream information (while the stream is playing) that the buffering pauses for a moment, then starts to buffer again, then it gets to a point where the pause catches up with the stream and it actually stops the video to buffer. This seems to be the cause of the issue. Not sure why it wouldn't be a constant stream...

Thanks,

Sub

MrSprigster commented 10 years ago

Mine often does that little audio skip too but then continues to play fine with no buffering, but as this part is handled by the XBMC video player code so I can't debug it :(.

Ok next step, let's make sure that this issue only occurs in XBMC. If you haven't already got it, download VLC player (www.videolan.org).

Now open a stream in XBMC and then stop it playing. This addon will of created a playlist file for that stream in %appdata%\xbmc\cache called hlsplaylist.m3mu (this is the exact same one which the XBMC player was playing). Open the playlist in VLC and see if you have the same issues.. if the stream plays fine in VLC, you've just identified a bug in the XBMC videoplayer HLS stream playback code.

Feel free to try the above too @kokarn.

Thanks for your patience and help figuring this out guys,

Sprig

ingwinlu commented 10 years ago

I use the generated playlist in my media center application. Only problem I found is a slight stutter around 1s after playback. Thought that this was a twitch problem since thats usually when ads start

MrSprigster commented 10 years ago

ingwinlu: Adverts are not (yet) implemented into Twitch's API (which is where we retrieve the stream information for the playlist file) so it is unlikely that this is the cause of the stutter.

Additional findings: after doing some further reading up on the XBMC player side of things, it looks as though XBMC uses FFMpeg (libavcodec) to handle HLS streams.

MrSprigster commented 10 years ago

if VLC playback works fine it is certainly worth trying a Nightly Build of XBMC to see if it has an updated build of FFMpeg (http://mirrors.xbmc.org/nightlies/win32/)

Sprig

ingwinlu commented 10 years ago

I know sprig. But that does not mean that the twitch servers send data continiously. They might throttle data transfer while they think ads are active to preserve bandwidth.

Need to look into thar. I.e. count data rates.

Other possibilities are load balancing or regional issues. Though I am not sure why it works in browsers then

MrSprigster commented 10 years ago

Yeah, load balancing / regional issues definitely have an impact with such high and constant bandwidth usage. I had major issues with buffering due to my ISP's (Virgin Media) routing to Twitch servers. My resolution was a VPN but that was a fairly extreme fix and i have to pay an annual fee :(.

SubElement commented 10 years ago

Hey guys,

Firstly, thank you, SO MUCH, for everyone's help. Even though it's not been an issue with the plugin, Sprig has been above and beyond helpful.

I tried a whole heap of things. None of them really worked. You stated that you used a VPN, so I signed up for a trial for VyperVPN, and it's worked a damn dream.

So looks like it's just crappy routing from my ISP. Now I have to weigh up if the price is worth it.

Again, thanks so much!

Sub

MrSprigster commented 10 years ago

No problem Sub, thanks for the update :). I'm glad you managed to find a solution even though it's not the most convenient. A decent speed proxy server in the XBMC options may also help you in place of a VPN but finding a free one that will handle the streaming bandwidth may be difficult.

I use privateinternetaccess.com which hasn't let me down yet and also provides constant super fast speeds and 3 concurrent connections for use on any of my devices, not to mention, with encryption enabled it keeps all of my internet traffic private and anonymous.

Cheers,

Sprig.