2017-04-06, 13:40
Hi all
Soo, I have been irritated by the thumbnails that the Youtube plugin shows for videos for a long time.
Basically my problem is that most content (for me at least) from Youtube is widescreen but the thumbnails that are used have a 4:3 aspect ration, so widescreen videos get black bars over and under.
So I finally figured I'll look into why the the thumbnails are all 4:3 and not based on the aspect ratio of the video.
So looks like Youtube supports 5 different thumbnail images for videos (Documented here)
The Youtube plugin uses the "high" version unfortunately it has always 4:3 aspect ratio, so not nice for widescreen videos.
Only "medium" and "maxres" are widescreen, "medium" has a lower resolution than "high" and "maxres" seems to be several times bigger (in bytes) than "high" and is only available for some videos (most likely HD ones)
Example "high":
Example "medium":
Example "maxres":
I found two places to change in the plugin for it to use the "medium" thumbnail
plugin.video.youtube\resources\lib\youtube\helper\utils.py line 233:
Change to:
plugin.video.youtube\resources\lib\youtube\helper\v3.py line 67:
Change to:
This is probably not the "correct" way to change this and I have probably missed some changes, "But seems to work for me" ;-)
So I was hoping to use 4:3 thumbnail for 4:3 videos and widescreen thumbnail for widescreen videos, but there don't seem to be any simple way to find out what aspect ratio a Youtube video is using.
I also made a github issue here.
jonib
Soo, I have been irritated by the thumbnails that the Youtube plugin shows for videos for a long time.
Basically my problem is that most content (for me at least) from Youtube is widescreen but the thumbnails that are used have a 4:3 aspect ration, so widescreen videos get black bars over and under.
So I finally figured I'll look into why the the thumbnails are all 4:3 and not based on the aspect ratio of the video.
So looks like Youtube supports 5 different thumbnail images for videos (Documented here)
The Youtube plugin uses the "high" version unfortunately it has always 4:3 aspect ratio, so not nice for widescreen videos.
Only "medium" and "maxres" are widescreen, "medium" has a lower resolution than "high" and "maxres" seems to be several times bigger (in bytes) than "high" and is only available for some videos (most likely HD ones)
Example "high":
Example "medium":
Example "maxres":
I found two places to change in the plugin for it to use the "medium" thumbnail
plugin.video.youtube\resources\lib\youtube\helper\utils.py line 233:
Code:
thumbnail_sizes = ['high', 'medium', 'default']
Code:
thumbnail_sizes = ['medium', 'default']
plugin.video.youtube\resources\lib\youtube\helper\v3.py line 67:
Code:
image = snippet.get('thumbnails', {}).get('high', {}).get('url', '')
Code:
image = snippet.get('thumbnails', {}).get('medium', {}).get('url', '')
This is probably not the "correct" way to change this and I have probably missed some changes, "But seems to work for me" ;-)
So I was hoping to use 4:3 thumbnail for 4:3 videos and widescreen thumbnail for widescreen videos, but there don't seem to be any simple way to find out what aspect ratio a Youtube video is using.
I also made a github issue here.
jonib