Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Force High Quality Thumbnails for YouTube

Is there a way to force a high quality THUMBNAIL for YouTube?

My videos are of very high quality and once they start streaming they run fine in 720p, however the thumbnail for the video is of variable quality - sometimes it's high, other times it's really blurry.

Is there a way of forcing a high quality thumbnail? I've found this in the API docs - http://code.google.com/apis/youtube/2.0/reference.html#youtube%5Fdata%5Fapi%5Ftag%5Fmedia:thumbnail but it doesn't detail how to use the media tag.

like image 431
SparrwHawk Avatar asked Jan 29 '12 11:01

SparrwHawk


People also ask

Can YouTube thumbnails be 1080p?

Q. 2 Can a YouTube Thumbnail be 1920x1080? Ans: Yes your YouTube thumbnail can be 1920x1080, but your image may look pixelated and this may affect your video playback on YouTube. So it is recommended that you stick to the 1280x720p dimensions.


3 Answers

There is a "maxres" version as well, which is a "full hd" picture in case that the video resolution is high enough.

http://i.ytimg.com/vi/VIDEO_ID/maxresdefault.jpg 

However, if the video resolution isn't high enough, this image doesn't seem to be created. So you might want to have a function that shows a lower quality version in case the "maxres" version doesn't exist.

Check out How do I get a YouTube video thumbnail from the YouTube API? for more info.

like image 138
Johan Dettmar Avatar answered Oct 11 '22 15:10

Johan Dettmar


Thanks, Johan for answer.

http://i.ytimg.com/vi/VIDEO_ID/maxresdefault.jpg

If you also want set playback to HQ use Javascript API https://developers.google.com/youtube/js_api_reference?hl=fi-FI#Playback_quality

var qualityLevels = self.players[iframeID].getAvailableQualityLevels();
/* Set highest quality */
self.players[iframeID].setPlaybackQuality(qualityLevels[0]);

In order for this to work we first need to call:

self.players[iframeID].playVideo();

Then it will triggrer

self.players[iframeID] = new YT.Player(iframeID, {
                        events: {
                            'onReady': function(event) {
                                var iframe = $(event.target.getIframe());

                                self.players[iframe.attr('id')].loaded = true;
                            },
                            'onStateChange': function(event) {
                                var iframe = $(event.target.getIframe());
                                var iframeID = iframe.attr('id');

                                if(event.data == 1) /* playing */
                                {
                                    var qualityLevels = self.players[iframeID].getAvailableQualityLevels();

                                    if(self.players[iframeID].getPlaybackQuality() != qualityLevels[0])
                                    {
                                        /* Set highest quality */
                                        self.players[iframeID].setPlaybackQuality(qualityLevels[0]);
                                    }
                                }
                            }
                        }
                    });
like image 32
Evalds Urtans Avatar answered Oct 11 '22 15:10

Evalds Urtans


Example:

http://img.youtube.com/vi/xjFouf6j81g/hqdefault.jpg

where xjFouf6j81g, videoid

like image 31
iqmaker Avatar answered Oct 11 '22 13:10

iqmaker