December 3, 2012 by Baawraman
We can use Semantic Markup for videos in order to generate rich snippets for the videos easily if the video is hosted on our own server, but the same is not possible if you are using videos from Video hosting websites. But, if you are using videos on your website which are hosted on YouTube, then you have to embed those videos on your website through the code provided by Youtube, make sure not to use iframe embedded code, use traditional one.
Here is an sample code provided by YouTube(Click Image to Zoom) .
We need to find out below properties from this code:
media:video –> A URL to the video you wish to be displayed when the user clicks the “play” button.
media:thumbnail –> A URL pointing to a preview thumbnail, which must be a GIF, PNG, or JPG image.
Also, the preview thumbnail must be hosted on the same domain as the video. YouTube does not provide an option to upload a preview thumbnail as they create one. Here is the trick, in order to find out the path to the image thumbnail, follow below steps.
1. The Thumbnail url will be http://i1.ytimg.com/vi/YourID/default.jpg with the ID of your video
2. You just need to enter the ID of your video here. You can find the id of the video from the embed scr section of the above code, the embed url is http://www.youtube.com/v/aGNSU_Y_5IM?version=3&hl=en_US.
3. The / or = after the “v” is always the first delimiter, and the “?version=3&” is always the second delimiter. Everything in between is the video ID. In other words, http://www.youtube.com/v/VIDEOID?version=3&hl=en_US&rel=0
4. In the above url, your Id is 6mZShors3o0, which is marked in Red in the above code. So, the thumbnail url would be http://i1.ytimg.com/vi/aGNSU_Y_5IM/default.jpg
Note: This thumbnail URL will be useful in creating video sitemaps for such videos as well. You can use http://www.video-sitemap.org/
The media:video url will be the url which contains the video id, i.e, http://www.youtube.com/v/aGNSU_Y_5IM?version=3&hl=en_US
Now we have media:video url and thumbnail url. We will now create the RDfa markup code(You can use Microdata as well); the equivalent RDFa code for the video would be like this(Click Image to Zoom):
And that’s all. With above code along with video sitemap, you can generate rich snippets for the videos hosted on Youtube.