Kodi Community Forum

Full Version: YouTube (IMPORTANT - READ FIRST POST)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
(2015-01-28, 20:21)bromix Wrote: [ -> ]
(2015-01-27, 19:58)constrainer Wrote: [ -> ]As far as I know, the plugin works by downloading the video and playing it as a local temporary file (correct me if I'm wrong). I made an experiment and downloaded one video with issues from YouTube via third-party software, resulting in a 360p mp4 file. I played this file on XBMC (Gotham, 13.2, working on an MX Linux), and it plays smoothly and fine. Is it possible that the plugin is using different file format for the data, which triggers the issue with the decoding? If the plugin is providing an mp4 stream in 360, I think we're good.
Go to the Addon-Settings and select for video quality "360p" Smile

Do you really think this was not the first thing I did on initial setup? Smile

Anyway, I dug deeper into the problem and found a solution. Here is a full report on it.

First, what do we know up to now:

1. The problem is that some videos are playing glitchy on some devices with XBMC/Kodi installed on embedded Linux.
2. The problem is not in the plugin itself, it is due to problems in some versions of FFMPEG library with the VP8 media format.
3. This problem is brought up by the plugin using this format when fetching a video from YouTube.
4. The problem is avoidable if we request the video from YouTube in MPEG-4 format.

Upon playing such a video among other things in the log file we have this:

Code:
DEBUG: FactoryCodec - Video:  - Opening
NOTICE: CDVDVideoCodecFFmpeg::Open() Using codec: On2 VP8
DEBUG: FactoryCodec - Video: ff-vp8 - Opened
NOTICE: Creating video thread

The result is glitchy playback.

Enter the file ~/.xbmc/addons/plugin.video.youtube/resources/lib/youtube/helper/video_info.py. This is part of the Bromix YouTube plugin for XBMC/Kodi. In it on line 13 and further we have this:
Code:
DEFAULT_ITAG_MAP = {'5': {'format': 'FLV', 'width': 320, 'height': 240},
                        '17': {'format': '3GP', 'width': 176, 'height': 144},
                        '18': {'format': 'MP4', 'width': 480, 'height': 360},
                        '22': {'format': 'MP4', 'width': 1280, 'height': 720},
                        '34': {'format': 'FLV', 'width': 480, 'height': 360},
                        '35': {'format': 'FLV', 'width': 640, 'height': 480},
                        '36': {'format': '3GP', 'width': 320, 'height': 240},
                        '37': {'format': 'MP4', 'width': 1920, 'height': 1080},
                        '38': {'format': 'MP4', 'width': 2048, 'height': 1080},
                        '43': {'format': 'WEB', 'width': 480, 'height': 360},
                        '44': {'format': 'WEB', 'width': 640, 'height': 480},
                        '45': {'format': 'WEB', 'width': 1280, 'height': 720},
                        '46': {'format': 'WEB', 'width': 1920, 'height': 1080},
                        '82': {'format': 'MP4', 'width': 480, 'height': 360, '3D': True},
                        '83': {'format': 'MP4', 'width': 640, 'height': 480, '3D': True},
                        '84': {'format': 'MP4', 'width': 1280, 'height': 720, '3D': True},
                        '85': {'format': 'MP4', 'width': 1920, 'height': 1080, '3D': True},
                        '100': {'format': 'WEB', 'width': 480, 'height': 360, '3D': True},
                        '101': {'format': 'WEB', 'width': 640, 'height': 480, '3D': True},
                        '102': {'format': 'WEB', 'width': 1280, 'height': 720, '3D': True},
                        '133': {'format': 'MP4', 'width': 320, 'height': 240, 'VO': True},
                        '134': {'format': 'MP4', 'width': 480, 'height': 360, 'VO': True},
                        '135': {'format': 'MP4', 'width': 640, 'height': 480, 'VO': True},
                        '136': {'format': 'MP4', 'width': 1280, 'height': 720, 'VO': True},
                        '137': {'format': 'MP4', 'width': 1920, 'height': 1080, 'fps': 30},
                        '140': {'format': 'audio/mp4'},
                        '160': {'format': 'MP4', 'width': 256, 'height': 144, 'VO': True},
                        '171': {'format': 'audio/webm'},
                        '242': {'format': 'WEB', 'width': 320, 'height': 240, 'VOX': True},
                        '243': {'format': 'WEB', 'width': 480, 'height': 360, 'VOX': True},
                        '244': {'format': 'WEB', 'width': 640, 'height': 480, 'VOX': True},
                        '245': {'format': 'WEB', 'width': 640, 'height': 480, 'VOX': True},
                        '246': {'format': 'WEB', 'width': 640, 'height': 480, 'VOX': True},
                        '247': {'format': 'WEB', 'width': 1280, 'height': 720, 'VOX': True},
                        '248': {'format': 'WEB', 'width': 1920, 'height': 1080, 'VOX': True},
                        '264': {'format': 'MP4', 'width': 1920, 'height': 1080, 'VOX': True},
                        '298': {'format': 'video/mp4; codecs="avc1.4d4020', 'width': 1280, 'height': 720, 'fps': 60},
                        '299': {'format': 'video/mp4; codecs="avc1.64002a', 'width': 1920, 'height': 1080, 'fps': 60},
                        '302': {'format': 'video/webm; codecs="vp9', 'width': 1280, 'height': 720, 'fps': 60},
                        '303': {'format': 'video/webm; codecs="vp9', 'width': 1920, 'height': 1080, 'fps': 60}}

This regulates the format in which we request the video from the YouTube server. Now, if we make a slight adjustment in it in the form of commenting out the options that are not MPEG-4 based, we get this code (only for 360p!):

Code:
DEFAULT_ITAG_MAP = {'5': {'format': 'FLV', 'width': 320, 'height': 240},
                        '17': {'format': '3GP', 'width': 176, 'height': 144},
                        '18': {'format': 'MP4', 'width': 480, 'height': 360},
                        '22': {'format': 'MP4', 'width': 1280, 'height': 720},
                        #'34': {'format': 'FLV', 'width': 480, 'height': 360},
                        '35': {'format': 'FLV', 'width': 640, 'height': 480},
                        '36': {'format': '3GP', 'width': 320, 'height': 240},
                        '37': {'format': 'MP4', 'width': 1920, 'height': 1080},
                        '38': {'format': 'MP4', 'width': 2048, 'height': 1080},
                        #'43': {'format': 'WEB', 'width': 480, 'height': 360},
                        '44': {'format': 'WEB', 'width': 640, 'height': 480},
                        '45': {'format': 'WEB', 'width': 1280, 'height': 720},
                        '46': {'format': 'WEB', 'width': 1920, 'height': 1080},
                        '82': {'format': 'MP4', 'width': 480, 'height': 360, '3D': True},
                        '83': {'format': 'MP4', 'width': 640, 'height': 480, '3D': True},
                        '84': {'format': 'MP4', 'width': 1280, 'height': 720, '3D': True},
                        '85': {'format': 'MP4', 'width': 1920, 'height': 1080, '3D': True},
                        '100': {'format': 'WEB', 'width': 480, 'height': 360, '3D': True},
                        '101': {'format': 'WEB', 'width': 640, 'height': 480, '3D': True},
                        '102': {'format': 'WEB', 'width': 1280, 'height': 720, '3D': True},
                        '133': {'format': 'MP4', 'width': 320, 'height': 240, 'VO': True},
                        '134': {'format': 'MP4', 'width': 480, 'height': 360, 'VO': True},
                        '135': {'format': 'MP4', 'width': 640, 'height': 480, 'VO': True},
                        '136': {'format': 'MP4', 'width': 1280, 'height': 720, 'VO': True},
                        '137': {'format': 'MP4', 'width': 1920, 'height': 1080, 'fps': 30},
                        '140': {'format': 'audio/mp4'},
                        '160': {'format': 'MP4', 'width': 256, 'height': 144, 'VO': True},
                        '171': {'format': 'audio/webm'},
                        '242': {'format': 'WEB', 'width': 320, 'height': 240, 'VOX': True},
                        '243': {'format': 'WEB', 'width': 480, 'height': 360, 'VOX': True},
                        '244': {'format': 'WEB', 'width': 640, 'height': 480, 'VOX': True},
                        '245': {'format': 'WEB', 'width': 640, 'height': 480, 'VOX': True},
                        '246': {'format': 'WEB', 'width': 640, 'height': 480, 'VOX': True},
                        '247': {'format': 'WEB', 'width': 1280, 'height': 720, 'VOX': True},
                        '248': {'format': 'WEB', 'width': 1920, 'height': 1080, 'VOX': True},
                        '264': {'format': 'MP4', 'width': 1920, 'height': 1080, 'VOX': True},
                        '298': {'format': 'video/mp4; codecs="avc1.4d4020', 'width': 1280, 'height': 720, 'fps': 60},
                        '299': {'format': 'video/mp4; codecs="avc1.64002a', 'width': 1920, 'height': 1080, 'fps': 60},
                        '302': {'format': 'video/webm; codecs="vp9', 'width': 1280, 'height': 720, 'fps': 60},
                        '303': {'format': 'video/webm; codecs="vp9', 'width': 1920, 'height': 1080, 'fps': 60}}

After that, we play the same video as above and in the log file we get this:

Code:
NOTICE: CDVDVideoCodecFFmpeg::Open() Using codec: H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10

Obviously we forced the server to return an MPEG-4. Now the video is playing fine, no more glitches.

This is a very crude and probably flawed way to fix this issue, but it works fine on my device.

What I am suggesting to Bromix is to probably include an option in the configuration of the plugin in the manner of "Use MPEG-4 whenever possible" or something in that matter so that people with this issue could work around the problem and enjoy the otherwise excellent experience this plugin delivers.
(2015-01-29, 12:21)constrainer Wrote: [ -> ]....

Obviously we forced the server to return an MPEG-4. Now the video is playing fine, no more glitches.

This is a very crude and probably flawed way to fix this issue, but it works fine on my device.

What I am suggesting to Bromix is to probably include an option in the configuration of the plugin in the manner of "Use MPEG-4 whenever possible" or something in that matter so that people with this issue could work around the problem and enjoy the otherwise excellent experience this plugin delivers.

Ahh....Good point...didn't thought about that. You're right...this could happen. I just created an issue for me Wink For the final v5.0.5 I will select the MP4 container preferred - after that best fit. This could maybe also the problem with the live streams.

At the moment we get a complete list with all possible streams (mp4, webm and so on mixed). I select the stream only based on the resolution of the video - not the format Confused I will correct this and I hope you will test this in the next beta Wink

Thanks man for this insight Smile
(2015-01-29, 08:29)RonnieG3 Wrote: [ -> ]So I'm having this conundrum:

I'm running 5.0.5~beta5 on Gotham 13.2 (Win7), and just recently when I select Search with the remote, I can't select anything on the on-screen keyboard. The only way off the screen is to select OK with nothing in the search box - I can't move to select letters/space or back out.

If I use PC Keyboard, I can type my search just fine, but when I back out to make a new search or selection, that search is not saved in my recent searches. I've Signed out (add-on and PC) and back in/reactivated and I get the same thing. Did I accidentally click a setting I'm not aware ofHuh
That's a problem of XBMC/KODI - not the addon Sad

(2015-01-29, 08:29)RonnieG3 Wrote: [ -> ]ALSO - I assumethe History is watched history. Any way to have it show Search History from the web? (just lookin' for a way around if necessary. Not quite ready o make the jump to KODI until my skin is compatible.)

Any help would be hot! Wink

Thanks in Advance
Sorry no....I already looked into it, but both APIs don't provide anything to gather the search history.
(2015-01-29, 01:28)finnaldo Wrote: [ -> ]
(2015-01-28, 20:21)bromix Wrote: [ -> ]Sooooo, everything is working, but the debug option is missing? Wink

Nice summary Wink

My suggestion was that maybe a couple of tweaks to the faq could help others in the assumption I can't be the only person to run into these problems.

1. If having login problems try deleting the old config file as the authentication mechanism has changed (just my theory so curious if you think this is likely).
2. Instructions say how to enable debug but the option wasn't available in the location described, since I'm using current kodi release and default skin, I was imagining the problem was common?
3. It should be possible to uninstall the youtube beta through the kodi UI, again I was assuming this was a common problem and not specific to me?

Thanks again, you rock.

Ahhh Wink
1.) I could update this. But it shouldn't be a problem if some old data of the other addon remained, because the addons use completely different mechanism and different settings for that.
2.) Everything is here for that. An addon don't need an extra option for debug if the developer uses the provided logging-mechanism of XBMC/KODI (Log-Level)
3.) What was the problem uninstalling the beta addon and why?

And thanks Wink
(2015-01-29, 13:28)bromix Wrote: [ -> ]Ahh....Good point...didn't thought about that. You're right...this could happen. I just created an issue for me Wink For the final v5.0.5 I will select the MP4 container preferred - after that best fit. This could maybe also the problem with the live streams.

At the moment we get a complete list with all possible streams (mp4, webm and so on mixed). I select the stream only based on the resolution of the video - not the format Confused I will correct this and I hope you will test this in the next beta Wink

Thanks man for this insight Smile

I'm glad to be of help Smile. MPEG-4 is rather "safe" format for usage, so I think it is issue-free. Also, of more than hundred videos on YouTube I tested, all can be requested as MPEG-4 streams, so it can be assumed that relatively rarely a fallback to different format will be needed. But, of course, there should be a fallback implemented. I have subscribed my device to the Bromix beta-testing repository, so I always have the latest beta, and I can test it. If there is an issue with something I will write here, and if you need to specifically test a feature you can PM me anytime to get feedback Smile
The classic context menu is back in 5.0.5 beta5, yay!...This add-on really gives me the best YouTube experience and it's still improving itself like every other day.Wink


Edit: I just found that the "next page" button in the subscription folder (the folder that stores/lists my subscribed channels) is gone in this latest beta. Is this normal?
Many users using cubox-i (openelec 5.0) is reporting problems in the addon from beta5 version. Beta4 fix worked fine, but today 3 friends reported me errors and scripts failes.
Ill try to post debug log later.
In my pc (win8) everything is working fine.
(2015-01-29, 15:47)gotiuser01 Wrote: [ -> ]The classic context menu is back in 5.0.5 beta5, yay!...This add-on really gives me the best YouTube experience and it's still improving itself like every other day.Wink


Edit: I just found that the "next page" button in the subscription folder (the folder that stores/lists my subscribed channels) is gone in this latest beta. Is this normal?
Ups Tongue I will fix this in beta6 sorry for that.
(2015-01-29, 19:51)tomer953 Wrote: [ -> ]Many users using cubox-i (openelec 5.0) is reporting problems in the addon from beta5 version. Beta4 fix worked fine, but today 3 friends reported me errors and scripts failes.
Ill try to post debug log later.
In my pc (win8) everything is working fine.
A debug-log of the openelec systems would cool Wink
(2015-01-29, 21:08)bromix Wrote: [ -> ]
(2015-01-29, 19:51)tomer953 Wrote: [ -> ]Many users using cubox-i (openelec 5.0) is reporting problems in the addon from beta5 version. Beta4 fix worked fine, but today 3 friends reported me errors and scripts failes.
Ill try to post debug log later.
In my pc (win8) everything is working fine.
A debug-log of the openelec systems would cool Wink

I can confirm the problem, also tried it and script failes in search, or in watch...
beta5 for me.

debug log
http://pastebin.com/30012REA
hey, searched for an answer and didnt find any:

getting " line 67, in convert_timestamp" problem on version 13.2 /
kodi is working fine.
both version on same win7 pc

link:
plugin://plugin.video.youtube/play/?video_id=shH7oqffJQ4

maybe its python version problem?

system\python\Lib\sqlite3\dbapi2.py", line 67, in convert_timestamp
year, month, day = map(int, datepart.split("-"))
TypeError: 'NoneType' object is not callable
another 1 :

calling plugin://plugin.video.youtube/play/?playlist_id=PLK_Lf3fJd0-DvrEp7WQeCuZXExgNLU44-&order=shuffle

always give me the same order of videos.

what am i doing wrong?
(2015-01-30, 00:10)o2ri Wrote: [ -> ]another 1 :

calling plugin://plugin.video.youtube/play/?playlist_id=PLK_Lf3fJd0-DvrEp7WQeCuZXExgNLU44-&order=shuffle

always give me the same order of videos.

what am i doing wrong?
A full log please in both your cases.
(2015-01-29, 22:34)tomer953 Wrote: [ -> ]
(2015-01-29, 21:08)bromix Wrote: [ -> ]
(2015-01-29, 19:51)tomer953 Wrote: [ -> ]Many users using cubox-i (openelec 5.0) is reporting problems in the addon from beta5 version. Beta4 fix worked fine, but today 3 friends reported me errors and scripts failes.
Ill try to post debug log later.
In my pc (win8) everything is working fine.
A debug-log of the openelec systems would cool Wink

I can confirm the problem, also tried it and script failes in search, or in watch...
beta5 for me.

debug log
http://pastebin.com/30012REA
Are you sure beta4 worked? Because I changed nothing in this regions of the addon.
Are you behind a proxy? This is a well known issue in the implementation of urllib2 of python.
No proxy
Same problem with 3 more devices (friends and family)

And yes, beta3 has the vevo problem, i reported here, and when beta4 came out - all worked perfectly.
I dont know if it is the update to beta5 (because i dont have beta4 to test it ) but now we have a problem.
Any suggestions? Maybe delete some files or complete addon and reinstall ?