It is often useful to display a preview of an embedded YouTube video on your website rather than the long winded HTML object/embed code. Fortunately YouTube provides us with an undocumented way to retrieve video stills.
Each video has three separate stills that you can choose from after you upload the video. YouTube, now also support high definition videos and because of that, provides higher quality stills as well. Below I will run through all the various YouTube images that are available for each video.
The Setup
Below is a break down of the YouTube URL. For all of my examples I have chosen my new favorite YouTube video Leprechaun in Mobile, Alabama.
Domain | Folder | Video | Image |
---|---|---|---|
http://i.ytimg.com | /vi/ | nda_OSWeyn8 | default.jpg |
The Default YouTube Image
YouTube's default video image, i.e. the image that the uploader has chosen, can be retrieved by using the default.jpg image. Its dimensions are 120px x 90px and its file size is 3.07KB. You may want to use this image when you want the exact image the original uploader intended.
Series Images 0 - 4
Next YouTube provides us with images 0.jpg, 1.jpg, 2.jpg & 3.jpg. These 4 images are basically the 4 images the uploader can chose from after uploading a video.
Image 0.jpg is larger, sized at 320px x 240px and its file size is 11.77KB.
Images 1, 2, 3 are smaller images sized at 130px x 97px.
High Quality Images
Next, YouTube provides us with what they label 'high quality' images. These are named hq1.jpg, hq2.jpg, hq3.jpg & finally hqdefault.jpg.
Images 1, & 3 are smaller images sized at 130px x 97px. Even those these are prefixed with 'hq' the images appear to be of the same quality that images 1, 2, & 3 were.
Image 2 is larger and sized at 480px x 360px. Its file size is 14.63KB. I'm not sure why this image is larger because it seems to break the pattern of the other images. It does appear to be the default image so perhaps that has something to do with it.
Finally, the hqdefault.jpg is the largest and highest quality of all the images. It is sized at 480px x 360px. Its file size is 14.63KB. I would recommend using this image as your primary image due to its quality.
Conclusion
You now probably know more than you ever wanted to know about the available images YouTube provides us for each video. Feel free to bookmark this article as you'll probably need to refer back to it someday while working on a project.