With the explosive growth of podcasting, publishers are including more multimedia in their RSS feeds than ever. While the method of including media content in an RSS feed with enclosures is fairly well known, there are other methods available for including media content in RSS feeds, one of which is Media RSS.
Originally authored by Yahoo! to improve media enclosures in RSS and also allow the submission of media content to its search engine via RSS, the development of Media RSS has since been opened up to the RSS community through the rss-media mailing list. Full disclosure: I’m also one of the people at Yahoo! who worked on the creation of Media RSS.
Before I go into how Media RSS works, I’ll start by reviewing the standard ways of including multimedia content into RSS feeds, and then show you the advantage that Media RSS brings to the table.
With the current version of RSS, you can include media content as an enclosure. These were added in RSS 2.0 to allow publishers to include media files in their RSS feeds. This has the advantage of being supported by nearly all RSS aggregators, but you are restricted to adding only one media enclosure per <item>, and there are only two metadata fields:MIME type and file size. Here’s an example of an RSS enclosure:
<enclosure url="http://www.webmonkey.com/monkeyrock.mpg" length="2471632" type="video/mpeg"/>
Alternatively, there is Media RSS. Media RSS takes the idea of adding multimedia content into an RSS feed and expands it by allowing publishers to include various bits of helpful information about the media files they are publishing. Because Media RSS is a module that extends the current RSS 2.0 spec, all the Media RSS fields are normally prefixed with “media:” to show they are part of Media RSS. For a quick overview of Media RSS, you can read Yahoo!’s Media RSS FAQ.
One of the immediate advantages of Media RSS is that it allows you to associate multiple pieces of media content with a single item in an RSS feed. For example, you can have an <item> linking to a blog entry about a specific day of your vacation in Rome, and then you can use Media RSS to include in the <item> several photos and a short video taken with your camera that day.
In addition, you can provide a lot more metadata about your media, including full time-coded transcripts, keywords and thumbnail images. Media RSS also supports linking to embedded players, which is great for those of you hosting your media content on sites like YouTube. There are also examples in the Media RSS specification showing how it can be used to link to Bittorrent files and Creative Commons-licensed media files.
The visible feed
I’ve put together an example RSS feed with a Media RSS video in it so you can see how it could work. I’m only using a simple subset of fields for this example. I’ll list the other potential fields you can use in a moment. I’m using a feed example of an (unfortunately) non-existent Webmonkey band.
<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/"> <channel> <title>Some Bands I Like</title> <link>http://www.andyvolk.com/webmonkey/bands/</link> <description>A list of some bands I like (or have been a member of).</description> <item> <title>Rocking Webmonkey Garage Band</title> <link>http://www.webmonkey.com/ourband.html</link> <description>The best ever garage band on the Internet.</description> <guid isPermaLink="false"> http://www.webmonkey.com/ourband.html</guid> <media:content url="http://www.webmonkey.com/monkeyrock.mpg" fileSize="2471632" type="video/mpeg" height="240" width="320" duration="147" medium="video" isDefault="true"> <media:title>The Webmonkey Band "Monkey Rock"</media:title> <media:description>See Rocking Webmonkey Garage Band playing our classic song "Monkey Rock" to a sold-out audience at the Fillmore Auditorium.</media:description> <media:thumbnail url=" http://www.webmonkey.com/images/monkeyrock-thumb.jpg" height="98" width="145"/> </media:content> <media:content duration="180" medium="video" isDefault="true"> <media:title>The Webmonkey Band - Fan Snippets</media:title> <media:description>Some cool video uploaded by our fans from a show at Bottom of the Hill.</media:description> <media:player url="http://www.somevideouploadsite/webmonkey.html" /> <media:thumbnail url="http://www.webmonkey.com/images/both-thumb.jpg" height="98" width="145"/> </media:content> </item> </channel> </rss>
The opening line is a standard RSS opening tag, with one important exception. To use Media RSS, instead of having a standard <rss version="2.0"> line in your header to declare the RSS version, you should have this line in your header to declare that you’re using the Media RSS extensions to RSS 2.0:
<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/">
The <media:content> element is the core of Media RSS. It’s an element that you use to describe a media file. While the only required attribute is either a URL or the use of a <media:player> element later, there are thirteen (!) other fields you can use to describe your media object. The Media RSS spec gives a full rundown of the attributes you can use, but I’ll list a few one of most useful ones here:
url: A direct URL to the media object. Pretty straightforward, eh?
fileSize: The size of the media object in bytes. Always handy to let folks know if you’re sending them a two megabyte or a two gigabyte (Hello, HD video!) media file.
type is the MIME type of the media object (i.e.:”video/quicktime”). If you’re not going to use this, you should consider using the medium attribute instead to tell user what kind of content you have.
medium gives the type of the media object. Values you can use for this are “image”, “audio”, “video”, “document”, or “executable”.
expression indicates whether you’re linking to a short sample of a longer video (“sample”), or if you’re linking to the full thing (“full”), or if you’re linking to a live stream (“nonstop”).
duration is the length of your media file in seconds. Letting people know the difference between a two minute song and a three hour independent film tour de force is probably a good idea.
<media:title>. Put the title of your media file here (surprise, surprise). You can either just put plain text into this element, or you can set the type attribute to “HTML” if you want to use HTML here.
<media:description>. Here’s where you put the text description of your media file. As with <media:title>, set the type attribute to “HTML” if you’d like to use an HTML description instead.
<media:thumbnail> This element allows you publish a thumbnail image of your image or video. For Media RSS aware readers, this is a key feature, since readers are more likely to click on your media content if it has a nice shiny thumbnail. You’ll definitely need to give the URL attribute of your thumbnail image, which is all you basically need to do in order to include a thumbnail image.
<media:player> This is where things start getting to be even more fun. With the growth of video upload sites, often a piece of video content is only available through accessing a webpage rather than downloading a video file directly. By using the player attribute to point to your media content, you can tell the RSS reader to pop up a player window with your video content in it, rather than trying to download a file. The only required attribute here is the URL of the player’s webpage, but giving the height and width of the player in pixels will let you control the size the window showing this player page.
A note on compatibility:You can ensure compatibility with RSS readers that only support enclosures by putting an <enclosure> tag around versions of the same elements that you’re including as <media:content> items in your Media RSS feed. Remember that you can only use one enclosure per item. Since enclosure support is nearly universal in media-aware RSS readers, I strongly recommend that you also include enclosures in your Media RSS feeds.
For example, in the first <item> of the feed above, you could insert this line to include an enclosure version of the same media file that was included as the default <media:content> item:
<enclosure url="http://www.webmonkey.com/monkeyrock.mpg" length="2471632" type="video/mpeg"/>
Now let’s look at some of the more advanced elements that you can include in your feeds.
Alright, now we’re getting to the stuff for advanced media geeks. Here are the fields that let you specify more granular information about your media files. If you’re just creating a simple Media RSS feed, you may never need to use these.
isDefault comes in handy when you have multiple media files enclosed in a <media:group>. This attribute lets you tell the RSS reader which media file to play by default. Set this attribute to “true” for your default media object in an <item>. No cheating by setting this to true for multiple objects in a single <item>!
<media:group> is useful for more complex publishing setups. Let’s say you’re publishing your latest indie movie sensation, and you want to include two versions of the video, one at 300K and one at 700K. Both versions of your video could be <media:content> items under the same <media:group>. In addition, you can use the isDefault field to indicate which one of the two items from that group should be played by default. Another example could be if you had the same video clip with different versions that had voiceovers in other languages. Two <media:content> items (each with the language indicated in the lang attribute) could be placed under the same media group.
<media:keywords>. A comma-delimited list of relevant keywords that describe your media content. Handy for search engine optimization.
<media:category>. If you want to add still more detail, you can label your content with the category (such as Flickr tags or a music genre) element. See the Media RSS specification for information on what category schemes you can use here.
<media:text>. If you really want to add detail, you can submit a transcript of every bit of speech in your media files, including timecodes indicating when every sentence was spoken. This works for closed captioning transcripts, song lyrics, or any other spoken words in your video. RSS karaoke, anyone? Here’s an example using the world’s worst song lyrics:
<media:text type="plain" lang="en" start="00:00:01.000" end="00:00:7.000"> My name is Andy and I never stop rocking with the Webmonkey band</media:text> <media:text type="plain" lang="en" start="00:00:7.000" end="00:00:12.000"> I've got Mike Calore on the bass and he's rocking too</media:text>
<media:credit> is handy for giving credit to all those people who made the piece of content that you’re featuring. Using the correct format to enter all of the people is a little complex, so see the Media RSS specification for information on how to enter <media:credit> elements.
<media:copyright>. Use the copyright element to add a copyright notice to your piece of content. You can use plain text here, or you can set the type attribute to “HTML” if you want to use HTML instead.
<media:rating> For all of you concerned parents out there, the <media:rating> tag allows you to indicate when you’re including explicit content. No more unlabelled MC5 lyrics! This can support any number of ratings schemes, but complex ratings schemes are difficult to implement. I recommend sticking with the simple “adult” or “nonadult” values for this tag. Keep in mind that for this feature, you’re relying on the user’s RSS reader to support these fields properly.
Reading and writing
Of course, having all of these useful fields doesn’t do you much good without a properly equipped reader. So you’ll want to check to see which of the many optional Media RSS fields are being supported by your reader, or already supported by your publishing tool. For example, Feedburner already supports Media RSS output, and some RSS readers/aggregators such as FireANT already support Media RSS intake.
So where is all of this headed? I’d like to think that Media RSS is going to allow RSS readers to handle media more intelligently, and take some of the burden off of publishers. One example of this is how websites ask you to choose a favorite player/format and streaming video bitrate. It’s pretty silly to have every website you visit ask you these questions — with an intelligent Media RSS reader, you could tell it your preferences, and it would automatically select the right pieces of content from a website’s Media RSS feed. All the publisher would need to do is list links in their feed to all available encoded versions of their media content, and let the feed reader do the rest.
In addition, online streaming media content delivery is rapidly moving away from allowing users to download video files. Instead, they’re played via a streaming media player hosted on the publisher’s website. Because Media RSS lets you treat a streaming media player in a website as a piece of media content, and set attributes like thumbnails, video formats, transcripts, and so on, you can still leverage Media RSS extensions to give rich data about your content without having to allow users to link to it directly.
Media RSS also has a lot of promise as a data exchange standard between websites with large repositories of media content. Some of the flags such as <media:rating> were designed with this scenario in mind, so it’s a good way to package up a lot of metadata about a large set of media files to deliver to a search engine.
The big thing to take away here is that the way media is being delivered via RSS feeds is changing fast. There is at least one other similar RSS module out there, Apple’s itms:extension (PDF download), which they’ve created for podcasts and iTunes. By supporting multiple systems for enclosing media content in your RSS feeds, you can give your readers the best experience possible on the RSS reader that they choose to use.
Thanks to David Hall at Yahoo! for his feedback and thoughts on Media RSS, which were included in this article.