Including Key Frames in Video Content Items

Key frames are still images generated from a video clip. They can be hand-selected images of significant points in the video, or they can be automatically generated at fixed intervals. Key frames can be used to represent the video in various contexts - a keyframe image is usually used, for example, to represent the video when it is not being played.

Amazon Elastic Transcoder can be configured to generate key frames (called thumbnails in the Elastic Transcoder user interface) at fixed intervals. If you want to save the keyframes and associate them with the video to which they belong, then you need to add the following items to your content-type resource:

A content type for holding the key frames

This content type needs to contain a link field for storing the key frame images. A minimal key frame content type might look like this:

<content-type name="keyframe">
  <ui:label>Key Frame</ui:label>
  <ui:title-field>name</ui:title-field>
  <panel name="main">
    <ui:label>Image content</ui:label>
    <field name="name" type="basic" mime-type="text/plain">
      <ui:label>Name</ui:label>
      <constraints>
        <required>true</required>
      </constraints>
    </field>
    <field type="link" name="binary">
      <relation>com.escenic.edit-media</relation>
      <constraints>
        <mime-type>image/jpeg</mime-type>
        <mime-type>image/png</mime-type>
      </constraints>
    </field>
  </panel>
</content-type>
A relation definition

This relation definition is needed to associate key frame content items with their source video content items. It might look like this:

<relation-type-group name="default-relation-type-group">
  <relation-type name="keyframes">
    <ui:label>Key frame images</ui:label>
  </relation-type>
</relation-type-group>
Relation references

You will need to add a reference to the above relation definition to each of the video content types that you want to include key frames. For example:

<content-type name="internal-video">
  <media xmlns="http://xmlns.escenic.com/2013/media" type="video" enabled="true" dropable="true"/>
  <parameter name="com.escenic.article.staging" value="false"/>
  <ui:icon>graphic</ui:icon>
  <ui:label>Internal video</ui:label>
  <ui:title-field>title</ui:title-field>
  <ui:decorator name="videoArticleDecorator"/>
  <panel name="main">
    <field name="title" type="basic" mime-type="text/plain"/>
    <field name="binary" type="link">
      <constraints>
        <mime-type>video/mpeg</mime-type>
        <mime-type>video/mp4</mime-type>
        <mime-type>application/mxf</mime-type>
      </constraints>
    </field>
    <field name="video" type="basic" mime-type="application/json">
      <video xmlns="http://xmlns.escenic.com/2010/video" enabled="true"/>
    </field>
    <ref-relation-type-group name="default-relation-type-group"/>
  </panel>
</content-type>
A store-keyframes element

This element causes the Video plug-in to store the generated key frames as content items of the correct type. The element must belong to the namespace http://xmlns.escenic.com/2010/video and must have the following attributes:

  • content-type, specifying the name of the key frame content type you have defined

  • relation, specifying the name of the key frame relation you have defined

  • state(optional), specifying the state to be applied to generated key frame content items. If not specified, the default state is published

  • relate-keyframe-state(optional), specifying the state in which generate key frame content items will be related. It's value only be submitted or published. If not specified, the default state is published

You must add such an element to the video field in each of the video content types that you want to include key frames. For example:

<content-type name="internal-video">
  <media xmlns="http://xmlns.escenic.com/2013/media" type="video" enabled="true" dropable="true"/>
  <parameter name="com.escenic.article.staging" value="false"/>
  <ui:icon>graphic</ui:icon>
  <ui:label>Internal video</ui:label>
  <ui:title-field>title</ui:title-field>
  <ui:decorator name="videoArticleDecorator"/>
  <panel name="main">
    <field name="title" type="basic" mime-type="text/plain"/>
    <field name="binary" type="link">
      <constraints>
        <mime-type>video/mpeg</mime-type>
        <mime-type>video/mp4</mime-type>
        <mime-type>application/mxf</mime-type>
      </constraints>
    </field>
    <field name="video" type="basic" mime-type="application/json">
      <video xmlns="http://xmlns.escenic.com/2010/video" enabled="true"/>
      <store-keyframes xmlns="http://xmlns.escenic.com/2010/video"
                       content-type="keyframe" relation="keyframes" state="draft"/>
    </field>
    <ref-relation-type-group name="default-relation-type-group"/>
  </panel>
</content-type>

For information about configuring Amazon Elastic Transcoder to actually generate the key frames (or thumbnails) you want, see Thumbnail Settings.