anxdpanic / plugin.video.youtube

Watch your favorite YouTube content on Kodi
https://ytaddon.panicked.xyz/forum
675 stars 111 forks source link

Buffering Bug #163

Closed neo-neo1 closed 2 years ago

neo-neo1 commented 3 years ago

Several people have all recently reported this same issue at Kodi forums - YouTube Addon (last page). This is a reproducible problem. When playing videos from a playlist after 2-3 videos the next video that starts will buffer every several seconds.

I’m able to open a new video that won’t buffer but If I go back to the previous video which had buffering issues it will always have buffering issues unless I restart Kodi device or delete cache and database from YouTube addon settings.

This is not a network or device issue.

Edit: (Additional detail) It doesn’t only happen to videos in a playlist. Usually after watching several videos at random as well. After a Kodi restart I haven’t had the first video I opened buffer, usually after watching several.

In this YouTube Add-on settings I changed the cache size and video settings to every available option yielding the same result.

Been using this Addon since 1.0.

malversan commented 2 years ago

After some days testing the alpha1, eventually there are still throttling issues.

By the way, the explanation that @probonopd linked about Google clients not following HTTP standard to request video chunks is quite relevant, in my opinion. https://github.com/ytdl-org/youtube-dl/issues/29326#issuecomment-938337251

gatecrasher777 commented 2 years ago

Just for info on the issue of chunking. In ytcog the download chunking used is 8MB for video and 2MB for audio. These values work well. Files with combined audio/video i.e. non-adaptive formats, don't require any chunking and download the fastest.

There are two levels of throttling going on. One) is if you try to download a full adaptive format file without any chunking. It is slooooow, but watchable in real time. Two) randomly, if you don't supply the correct n parameter transform. The n-transform throttling is much more severe and in real time will buffer or die.

Fludizz commented 2 years ago

@anxdpanic I'll gather some debug logs for you next time it happens. All video's that refused to play yesterday evening are now playing just fine again.

Edit: Aaaand I have got a video to failed to play, so I enabled debug logging and tried loading that failing video a bunch of times and then a different video which did play just fine. kodi-buffering-18alpha1.log

If the full log including boot time for kodi is required, let me know.

RNavega commented 2 years ago

By the way, the explanation that @probonopd linked about Google clients not following HTTP standard to request video chunks is quite relevant, in my opinion.
https://github.com/ytdl-org/youtube-dl/issues/29326#issuecomment-938337251

plugin.video.youtube creates its own Mpeg DASH file(s) for playing the adaptive streams of YouTube, but it uses SegmentBase instead of SegmentList and SegmentURL. This is the relevant code:
https://github.com/anxdpanic/plugin.video.youtube/blob/dff2e3c421fe3914d62b7cbae1532c81166e6e05/resources/lib/youtube_plugin/youtube/helper/video_info.py#L1492-L1494

This is way beyond my skillset, but I think we could try adding the &range={start}-{end} parameter, as well as the transformed n parameter, into the SegmentURL items of the SegmentList, so that the file gets chunked by parameters instead of HTTP headers as Kodi would usually do.
The result would be something like this: https://stackoverflow.com/a/67149513

probonopd commented 2 years ago

In the meantime, I have a workaround using Invidious: https://github.com/anxdpanic/plugin.video.youtube/issues/211#issuecomment-939445166

DjDiabolik commented 2 years ago

I have to report my feedback whit alpha1 on my osmc pi2 setup.

Whitout touching anythings apparently in this latest one of two days i have watched so many video and i never obtain again the "buffering issue/trouble" reported by me here in the recent past.

I have also tryed to watch some video whit and whitout dash.............. it's really weird but at least i can back to watch my preferred youtube channel whitout any problems using my usually kodi setup :)

EDIT I have another question............ Instead panicked repo it's not be updated whit the recent alpha release i can add a GitHUB source to KODI to install directly an addons whitout need to download from a pc and install from it ?

probonopd commented 2 years ago

Possibly it depends on your location (country) and/or other parameters whether you get throttled.

Instead panicked repo it's not be updated whit the recent alpha release i can add a GitHUB source to KODI to install directly an addons whitout need to download from a pc and install from it ?

You can download the zip file from the GitHub Releases page and unpack it to the appropriate directory where your Kodi addons live, .kodi/addons/ (locations vary depending on OS). It's basically how I install all addons which are not in the official repo (in a recent enough version).

DjDiabolik commented 2 years ago

@probonopd

Possibly it depends on your location (country) and/or other parameters whether you get throttled.

could be... recently (about last week) in italy there was a serious problem whit the most social site. All Facebook, Whatsapp and other site it's goes offline for a lot of hours and and maybe the same problem has also caused problems for other sites such as youtube ?

I hope this message it's understandable... i'm using "Google Traslator" for helped me whit english :)

You can download the zip file from the GitHub Releases page and unpack it to the appropriate directory where your Kodi addons live, .kodi/addons/ (locations vary depending on OS). It's basically how I install all addons which are not in the official repo (in a recent enough version).

Yeah... it's the way i ever use: 1 - Download from PC 2 - Copy the zip by FTP to my Pi2 osmc setup (/home/osmc/) 3 - Go in front of my TV to install the zip manually :)

I was just looking for an alternative way to download and install the zip directly from kodi :). Apparently there's exist an addons called "GitHub Browser" but it's not anymore developed for kodi 19......

probonopd commented 2 years ago

italy there was a serious problem whit the most social site. All Facebook, Whatsapp and other site

That Facebook problem was not just in Italy and only with domains owned by Facebook, including Whatsapp. The buffering bug existed before that. It's unrelated.

anxdpanic commented 2 years ago

I managed to get the repository generation scripts back in order, so the alpha2 zip should be available through the development repositories now

DjDiabolik commented 2 years ago

That Facebook problem was not just in Italy and only with domains owned by Facebook, including Whatsapp. The buffering bug existed before that. It's unrelated.

then I have no idea at this point :) mine was a possible theory :)

@anxdpanic Yeah thanks to brings back the panicked repo :)

jodo234 commented 2 years ago

Where can I find the zip for the alpha repo? For now I downloaded the zipped alpha2 and copied the unzipped files to my plugin.video.youtube folder manually. But installing through a repo would be much nicer of course :) Videos are by the way still stutterin.... :(

anxdpanic commented 2 years ago

repositories are listed here: https://github.com/anxdpanic/plugin.video.youtube/wiki/Installation#repositories 👍

viper-666 commented 2 years ago

repositories are listed here: https://github.com/anxdpanic/plugin.video.youtube/wiki/Installation#repositories 👍

After installing the new Alpha2 the issue appears not so often as before. But if I look a few videos from one channel in a row the issue is back. It is buffering all few seconds, so you can't see the video. A reboot don't help, after starting the video 5 to 7 times it works again for this video.

probonopd commented 2 years ago

@viper-666 I'd be interested in whether my workaround helps for those kinds of situations.

viper-666 commented 2 years ago

@probonopd I play the plugin in a libreelec kodi installation on a raspberry 3. So your workaround is not so easy to install. But if the buffering problem appears more often in the Alpha 2 I would go this way. Now 9 from 10 times the video plays fine.

viper-666 commented 2 years ago

Since yesterday it is bad again. The same as with Alpha 1. Maybe YouTube has a quote per user at what using time it slows him down 😪

Ch1llb0 commented 2 years ago

Same here.

TheNetworkIsDown commented 2 years ago

Using latest LibreElec and yt plugin. Using yatse to share videos from my phone using "Play on media center". Currently, videos aren't even starting without buffering. Works fine on my phone. Especially ads are shown blazingly fast 🤣 Sometimes it helped just starting them a few times and they keep running without issues. Not so today. I wonder what is yt's problem. I'm using my api key so they have all the data they want to collect about me 🤷‍♂️

larena1 commented 2 years ago

I'm also using yatse addon and got YouTube fixed by swapping yatse's bundled youtube_dl with yt_dlp and disabling prefer YouTube addon

Alaardo commented 2 years ago

I'm also using yatse addon and got YouTube fixed by swapping yatse's bundled youtube_dl with yt_dlp and disabling prefer YouTube addon

Also problems but what exactly do you mean by this?

MichielBruijn commented 2 years ago

It seems that YouTube/Google is trying to frustrate our user experience. I might quit Kodi altogether and go look for other media center solutions.

kusticM commented 2 years ago

having same issue, they start, but in first few seconds it start to buffer and stuttering.

tried with all releases; unofficial 6.8.18.alpha2+matrix1, 6.8.18.alpha2+matrix1, 6.8.18.alpha1+matrix1, etc... little difference in stuttering but still not watchable.

System is : Rpi4b+ 4GB LibreELEC 10.0.0 KODI 19.1.0

TheNetworkIsDown commented 2 years ago

@MichielBruijn I don't think ranting helps in any way. In case you do not know how this works, Kodi and plugins are free and not affiliated in any way with Google/YT who could care less. You're welcome to propose patches that solve the problem though.

MichielBruijn commented 2 years ago

@MichielBruijn I don't think ranting helps in any way. In case you do not know how this works, Kodi and plugins are free and not affiliated in any way with Google/YT who could care less. You're welcome to propose patches that solve the problem though.

I was not trying to rant. I just observed that Google/YouTube is making Kodi users life difficult for a few years already. For me reason to start looking around for possible alternatives. That's all.

Anyway, I'm not developer enough to come up with another solution than to use a beautiful soup implementation to scrape YouTube webpage for results and then use a browser user agent to identify with them inorder to fool YouTube inn thinking that the video is requested by a "browser user".

My 2 cents

malversan commented 2 years ago

@MichielBruijn, spoofing the user agent could be enough in the 2000's. But here the developer is dealing with ciphered tokens calculated on the fly that are different for each request. And even that is not enough.

I'm sure we'll get there, as others seem to have done in other projects. But it's difficult. Just be patient.

In the meanwhile you can install one of the 0.6.18 alphas and lower the resolution of the videos in the plugin configuration. Those are workarounds, not definitive solutions, but help to lower the number of stalled plays you get until a definitive solution arrives.

ehoffman2 commented 2 years ago

Alpha2 worked for me (plugin.video.youtube-6.8.18.alpha2.zip), but after doing this...

Thank you for all the time you put in this project.

Best regards

ei-ke commented 2 years ago

I've also had massive buffering issues since few days. plugin.video.youtube-6.8.18.alpha2.zip fixed this. Thank you!

MichielBruijn commented 2 years ago

Alpha2 worked for me (plugin.video.youtube-6.8.18.alpha2.zip), but after doing this...

* Installed alpha2 and re-started Kodi.  Tried a video that previously had buffering issue with old addon.  Did NOT work.

* Deleted _both_ the function and data cache (going to Youtube addon setting, in maintenance tab), still using alpha2.  Tried the same video again.  Worked like a charm.

* Tried some other videos, from different channels, works fine.

Thank you for all the time you put in this project.

Best regards

I installed plugin.video.youtube-6.8.18.alpha2.zip from panicked matrix repositories, checked a stutter video, didn't work. Removed the function and data cache like you suggested, no solution to the stutter. It seems it even became worse. Rebooted the media PC, no change.

I believe there will be a fix. How can I help.

bwesen commented 2 years ago

Yeah had this since a few weeks but getting continually worse, today it got to the point of YT being completely unuseable, happens on all videos more or less, no correlation with "first in the playlist", DASH on or off etc. (this on alpha2). Is there a way to enable verbose debug-logging from the plugin?

whatsuprob commented 2 years ago

Alpha 2 with Mped-dash activated and Inputstream Adaptive has been working great for me on Kodi 18.4 android 64, 32. Kodi 18.9 windows since release date. Playlists now work too. I tried both versions. Excellent work. Youtube was completely unusable after 2nd video. I watch all my news, docs, and trailers so at least 30 videos per day, probably closer to 50.

digitalisson commented 2 years ago

Clearing the caches in YouTube maintenance settings worked for me(running alpha 2). Everything stuttered/buffered before, after its smooth sailing(so far at least).

superMoYoX commented 2 years ago

Alpha2 worked for me (plugin.video.youtube-6.8.18.alpha2.zip), but after doing this...

* Installed alpha2 and re-started Kodi.  Tried a video that previously had buffering issue with old addon.  Did NOT work.

* Deleted _both_ the function and data cache (going to Youtube addon setting, in maintenance tab), still using alpha2.  Tried the same video again.  Worked like a charm.

* Tried some other videos, from different channels, works fine.

Thank you for all the time you put in this project. Best regards

I installed plugin.video.youtube-6.8.18.alpha2.zip from panicked matrix repositories, checked a stutter video, didn't work. Removed the function and data cache like you suggested, no solution to the stutter. It seems it even became worse. Rebooted the media PC, no change.

I believe there will be a fix. How can I help.

Hi everyone.

Same as you! Installed the last alpha, cleared the caches... 95% of videos I try are buffering since the 1,2,3 first seconds

hoshy42 commented 2 years ago

hi there...

exactly the same here, it got worse every day for the last few weeks now it's just annoying instead of relaxing :/

no matter

I still have the same issue, stuttering, and buffering on almost any video. I am running: plugin 6.8.18 matrix alpha2 Libreelec 10.0.0 Generic Celeron Chrome Box Kodi 19.1

I was wondering if this is a localized thing... could that be possible? seems unlikely, but I am throwing it out there... ;)

I am for one in "middle" germany, with v0d4ph0ne cable....

can I creae some extended log?

thanks

bwesen commented 2 years ago

Could be localized, I'm in Sweden (with 1 gbit always-fast fiber though). Another confounding issue COULD be the Kodi version; I'm on the nightlies so 20.0, but many are on the old 18.0 Kodi. Some sort of debug logging would be awesome. I mean the plugin must know if the socket stops receiving data.

I mean it's a radical throttling, it's not just "oh it has to buffer for 3 seconds", it basically just stops. Nothing comes through. Sometimes Kodi crashes due to this as well. I'm sure this is Google's fault, but something in the plugin is not handling the cases optimally either I guess.

hoshy42 commented 2 years ago

"Radical throttling" seems to be the right wording for that, but it's not really "nothing", at least here, At this point the/any video stalls after ~3s and the buffering icon only appears after another ~5s my guesstimate would be below 1Mbit? but still, some videos seem to be faster from the get go, now the're close to 0 videos I can play without stuttering.. sad ;)

first i though it was some problem with my local pihole/DNS but I just tested it with wifi on LTE to rule out local NW problems, the issue remains....

maybe its not really throtteling but dumping "legacy/dev" clients to an older/slower "server"?

or maybe we stumbled upon some kind of european control infrastructure to supress free software :D

naa... all just gueswork...

I agree that some advanced logging would be awesome and should shed light on what we are actually dealing with, anybody got any pointers?

thanks h42

whatsuprob commented 2 years ago

This is my 2 cents and I do not believe this going to be the case for most because I am using kodi 18.4 on a fire tv and nvidia shield. I had to swap out my inputstream.adaptive addon to get the correct version. For some reason I was using the windows version of the inputstream.adaptive addon and that was not working.

How to verify which version you have installed: open up the inputstream.adaptive folder on a PC or somehow view it on your device. maybe es file explorer or mixplorer will work if you are using android tv (.kodi>addons> inputstream.adaptive> addon.xml) Verify the "platform" version you have towards the bottom of the XML. (it was line 25 for me in inputstream.adaptive. v2.48. android-armv7 (if it says platform>windows<platform and you are using an android tv or fire tv device it needs to be swapped or vice versa.

I switched that out with the correct version for me. That allowed me to turn on the MPEG setting in the youtube addon (mentioned above) and now the new alpha2 version runs smoothly for me. I also found that it worked with inputstream.adaptive.experimental I cannot find the version number though

RNavega commented 2 years ago

There's a new experimental patch to fix this throttling, for now it's in testing phase and you need to manually update the files like explained in here: https://github.com/anxdpanic/plugin.video.youtube/issues/211#issuecomment-943170920

Hagal77 commented 2 years ago

Windows 10 Pro 21H1 x64 with Kodi 19.2 - plugin.video.youtube-6.8.18.alpha2+matrix.1.zip

v6.8.18a not helps, nothing!! :(

Buffering still like in 28k Modem Speed
If you Start a YT Vid, its Shutter 3seks after this its need for 1% buffering 1 Minute, i have a 250Mbits Fiber. Addon is still brocken ;(

greetz

gsg2016 commented 2 years ago

plugin.video.youtube-6.8.18.alpha2+matrix.1.zip Pi4 2Gb, Libreelec 10.0.0, Kodi 19.1 video ram 256Mb youtube working perfectly now NO buffering thank you

DjDiabolik commented 2 years ago

@Hagal77 wait man.... addons it's not broken...... it just doesn't seem to work perfectly on ALL kodi setup.

Read, for example, some my old replyes here: In recent pass i have reported a experiences very similar to yours (and very similar to other users) but but when this happened I seemed to be the only one reporting the "problem".

I can simply say that from one moment to the next everything seems to work back to normal..... in my case it's very weirds/strange but the addons it's not broken. It's works.......some cases good.... some cases not. It's very weirds case.....

Ch1llb0 commented 2 years ago

There's a new experimental patch to fix this throttling, for now it's in testing phase and you need to manually update the files like explained in here: #211 (comment)

This does work for me!

hoshy42 commented 2 years ago

There's a new experimental patch to fix this throttling, for now it's in testing phase and you need to manually update the files like explained in here: #211 (comment)

OMG Man! Thanks so muuuuch.... confirmed Working on Librelec 10 Generic - Kodi 19.1 It 's like ferrydust... no buffering and videos play almost instantly now... =8D

and all is good again... ;) h42

pool15 commented 2 years ago

There's a new experimental patch to fix this throttling, for now it's in testing phase and you need to manually update the files like explained in here: #211 (comment)

OMG Man! Thanks so muuuuch.... confirmed Working on Librelec 10 Generic - Kodi 19.1 It 's like ferrydust... no buffering and videos play almost instantly now... =8D

and all is good again... ;) h42

Same here, instant start and no longer buffering 👍

anxdpanic commented 2 years ago

The only reason I haven't pushed a new alpha zip is because age-gated and My Channel content doesn't work with the new method currently. Have an idea of the likely fix, but might take me a bit to have the free time.

Azzurite commented 2 years ago

anxdpanic, you're the best. thanks a lot.

nremenda commented 2 years ago

Working good here with the fix. Thanks.

quintz commented 2 years ago

Works flawlessly!thanks!

chewiiie commented 2 years ago

There's a new experimental patch to fix this throttling, for now it's in testing phase and you need to manually update the files like explained in here: #211 (comment)

This fixed it !! Thank you very much ! Kodi 19.2 on Windows 10 21H1

anxdpanic commented 2 years ago

Okay, I had a little time and pushed alpha3, zips are in the usual places and repos are updated. No more having to patch! 😄

My Channel and at least some age-gated content is now working, but this does require adding the dual-login back to the addon. This will require you to re-login, sorry for the inconvenience hopefully it's the last for a while! Between alpha2+patches and alpha3 another https request at playback was removed as well, hopefully that will a add a little to the load time improvement with the new method @RNavega added.

Captions are still broken, but that will be looked into next hopefully.

Again, a huge thank you to @RNavega for helping us get this far.