Skip to Content
Mux Docs: Home

Embed videos for social media

Learn how to embed your videos using Open Graph cards

Introduction to Open Graph

The Open Graph protocol is initialized by using HTML meta tags in the <head> section of a webpage, allowing you to define objects from your webpage as thumbnails. These can be used in social media posts or appear in search results. Open Graph also helps search engines find videos on your webpage that might be otherwise hidden due to JavaScript.

Here is a list of Open Graph properties for video optimization:

og:typeThe object’s type e.g video, audio
og:urlThe URL of the webpage
og:titleTitle of the video
og:descriptionDescription of the video
og:imageThumbnail of the video
og:videoThe URL of the video
og:video:widthWidth of the video in pixels
og:video:heightHeight of the video in pixels
og:site_nameThe website name the contains the video

Object types

You can also use sub types, for example, if your object type is video and you want to create a open graph card for an episode or movie you can use video.episode or

<meta property="og:type" content="video.episode">
<meta property="og:type" content="">
<meta property="og:type" content="video.tv_show">

Optional meta tags

Use additional properties to provide additional metadata about your object such as the actor and director.

video:actorprofile array - Actors in the movie.
video:actor:rolestring - The role they played.
video:directorprofile array - Directors of the movie.
video:writerprofile array - Writers of the movie.
video:durationinteger >=1 - The movie's length in seconds.
video:release_datedatetime - The date the movie was released.
video:tagstring array - Tag words associated with this movie.

Integrate the Open Graph meta tags

To add the Open Graph meta tags into your website, simply implement new meta tags in the <head> section of the webpage. Below is an example of Open Graph tags:

<!DOCTYPE html>
<html lang="en">
<meta property="og:title" content="Mux Video" />
<meta property="og:type" content="video.episode" />
<meta property="og:description" content="MP4 video asset for Open Graph Cards" />
<meta property="og:image" content="" />
<meta property="og:video" content="" />
<meta property="og:video:width" content="350">
<meta property="og:video:height" content="200">
<meta property="og:video:duration" content="300">
<meta property="og:url" content="">
style="width: 100%; max-width: 500px;"

Creating Twitter cards

Twitter cards are implemented using meta tags, but unlike Open Graph cards, they use different property names.

There are four different types of cards to choose from which is defined in the meta tag property twitter:card:

  • photo card
  • player card
  • summary card
  • app card

The player card provides functionality to play external media files inside of Twitter. Below are the definitions of other Twitter meta tags you can use with the player card.

Twitter meta tags

twitter:cardType of Twitter card e.g., "player."
twitter:titleThe title of your content as it should appear in the card
twitter:siteThe Twitter @username the card should be attributed to
twitter:descriptionDescription of the content (optional)
twitter:playerHTTPS URL to I-frame player; this must be a HTTPS URL which does not generate active mixed content warnings in a web browser (URL to the page hosting the player)
twitter:player:widthWidth of I-frame specified in twitter:player in pixels
twitter:player:heightHeight of I-frame specified in twitter:player in pixels
twitter:imageImage to be displayed in place of the player on platforms that don’t support I-frame or inline players; you should make this image the same dimensions as your player

Example twitter meta tags

<meta name="twitter:card" content="player" />
<meta name="twitter:title" content="Some great video" />
<meta name="twitter:site" content="@twitter_username">
<meta name="twitter:description" content="Great video by @twitter_username" />
<meta name="twitter:player" content="" />
<meta name="twitter:player:width" content="360" />
<meta name="twitter:player:height" content="200" />
<meta name="twitter:image" content="" />

Preview your Open Graph cards

Using an Open Graph previewer

You can preview your Open Graph cards using any one of many services that allow you to simply enter a URL that generates a preview.

One such service is that allows you to not only preview what you have configured, but also helps you to generate more Open Graph meta tags.

Below is a preview of the example above in

Preview Open Graph cards

Was this page helpful?