Youtube video thumbnails

Youtube video thumbnails

a lot of youtube logoes

If you want to display thumbnail images from a youtube video it is possible to link to them directly, as they are accessible using a predictable address.

Direct access

To be able to show images from youtube videos, all you need is to locate the ID for the video You can find this from an youtube url :

https://www.youtube.com/watch?v=NQowXJ-C4nY

In this example the videoID is NQowXJ-C4nY

Pregenerated thumbnails:

Each YouTube video has images. They are formatted as:

https://img.youtube.com/vi/{videoId}/[0-3].jpg

The image locations are available as both http and https, and i3.ytimg.com can be used instead of img.youtube.com 

0.jpg1.jpg2.jpg3.jpg

Default Thumbnail

The default thumbnail image is 120px x 90 px

https://img.youtube.com/vi/{videoId}/default.jpg

https://img.youtube.com/vi/{videoId}/default.jpg

Resolution

The default thumbnail is available in default, medium and standard quality versions, using either: 

https://img.youtube.com/vi/NQowXJ-C4nY/hqdefault.jpghttps://img.youtube.com/vi/NQowXJ-C4nY/mqdefault.jpghttps://img.youtube.com/vi/NQowXJ-C4nY/sddefault.jpg

To get the default image in max resolution use: maxresdefault.jpg :

 

https://img.youtube.com/vi/NQowXJ-C4nY/maxresdefault.jpg

 

Api

If you want to do more with YouTube, such as upload video, manage playlists, set new thumbnail images, etc. you can use YouTube's API to do so. Their example page has code snippets available for Go, Java, JavaScript, .NET, PHP, Python, etc.

Using the api it is possible to:

  • Handle captions
  • Handle channels
  • Manage comments
  • Manage live streaming.
  • Handle playlists
  • Search YouTube for content.
  • Handle video thumbnails
  • Upload delete or add watermarks to videos

A portion of the API does not require authentication, - it is possible to play with a subset of the possibilities here

Tags