How are video and audio resources described in Open Graph?

The Citead team, updated

In short. Open Graph uses root media URLs plus structured secure URL and type fields, with width and height for video.

Definition: Open Graph describes a media resource with a root og:video or og:audio URL and structured properties for an HTTPS URL and media type. Video also supports width and height fields; audio has no dimension fields in the protocol.

Key facts

  • The Open Graph protocol defines og:video as a URL to a video file and og:audio as a URL to an audio file that accompanies the object. The Open Graph protocol lists both under optional metadata.
  • A media type consists of a top-level type and a subtype, with optional parameters, according to IETF RFC 6838.
  • A URI identifies a resource through a sequence of characters and an extensible naming scheme, as described by IETF RFC 3986.

What does the root URL describe?

The root property points to the media resource associated with the page object. The protocol defines og:video as a URL to a video file that complements the object and og:audio as a URL to an audio file that accompanies it. A URI is the identifier carried by each value; RFC 3986 describes a URI as a sequence of characters used for uniform identification of resources.

Structured properties belong to the root that precedes them. When another root element is parsed, the preceding structured-property group is complete, so the order of the tags matters when a page describes more than one media resource.

Which fields are available for video and audio?

The protocol gives og:video the same structured fields as og:image: og:video:secure_url supplies an alternate URL for a page that requires HTTPS, og:video:type carries a MIME type, and og:video:width and og:video:height carry pixel dimensions. The example in the specification uses application/x-shockwave-flash, 400 pixels wide, and 300 pixels high.

RFC 6838 calls this kind of value a media type and describes its top-level type and subtype. The protocol's audio group contains only the root URL, secure URL, and type fields because the specification says that size does not make sense for sound.

<meta property="og:video" content="http://example.com/movie.swf" />
<meta property="og:video:secure_url" content="https://secure.example.com/movie.swf" />
<meta property="og:video:type" content="application/x-shockwave-flash" />
<meta property="og:video:width" content="400" />
<meta property="og:video:height" content="300" />

<meta property="og:audio" content="http://example.com/sound.mp3" />
<meta property="og:audio:secure_url" content="https://secure.example.com/sound.mp3" />
<meta property="og:audio:type" content="audio/mpeg" />

How should the tags be ordered?

Place each structured property after its root property. For a page with several media roots, repeat the root property before its own structured fields. The protocol gives the first value preference during conflicts when a tag has multiple values, and it treats a new root as the start of another group.

The secure_url value is an alternate HTTPS URL, while the root value remains the media URL declared for the object. The protocol's example pairs an HTTP root with an HTTPS secure_url for both video and audio.

FAQ

Is og:video the same as og:video:type?

No. og:video identifies the video file URL. og:video:type describes that resource with a MIME type.

Can audio use width and height fields?

The protocol documents only the first three audio properties: the root URL, secure_url, and type. Its explanation says that size does not make sense for sound.

What should a secure_url contain?

Use the alternate HTTPS URL for the same media resource when the page requires HTTPS. The protocol presents secure_url as an alternate URL, rather than as a replacement for the root property.

Sources

  1. Open Graph protocol, "The Open Graph protocol", undated
  2. IETF, "Media Type Specifications and Registration Procedures", January 2013
  3. IETF, "Uniform Resource Identifier (URI): Generic Syntax", January 2005

Check how a page reads to answer engines. Open the GEO score analyzer

Test a page and see what to fix first

The analysis usually takes less than 10 seconds and needs no account.

400,000+ pages scored in the public benchmark