Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions recipe/0079-annotations-for-captions/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
title: Using Annotations for Timed Text
id: 79
layout: recipe
tags: [video, caption, subtitle, presentation]
summary: "Providing captions, represented as annotations, to a video resource."
viewers:
- Clover
- Ramp
- Aviary
- Theseus
topic: AV
---

## Use Case

You want to represent captions for your video content as timed annotations.

## Implementation notes

This recipe follows the pattern for [Using Caption Files with Video Content][0219], but shows an alternative form of representing a caption file using annotations.

In this recipe, annotations are used to mark up video content shown on a canvas of the manifest. The time alignment of the captions with the video content is achieved by annotations that target the canvas by using Media Fragments URIs with a [temporal dimenstion](https://www.w3.org/TR/media-frags/#naming-time). The `provides` property of the Annotation is used by the IIIF client to identify the annotations containing captions and be used as such by the media player.

## Restrictions



## Example

In this example we show the same captions and video from [Using Caption Files with Video Content][0219]. but the `annotations` section of the manifest links to a `AnnotationPage` instead of the WebVTT file. For readability, the example contains only the annotations that concern the captions of the first minute of the video.

The `AnnotationPage` contains one annotation per individual caption entry, and these are provided as `supplementing` annotations on the Canvas that contains the video file. The references to the canvas uses Media Fragment URIs with a begin time and an end time. The annotations also contain the `provides` property with the value `closedCaptions` to inform the IIIF viewer that these annotations are representing captions. The language of the captions is expressed with a `language` property containing a [BCP 47](https://tools.ietf.org/html/bcp47) language code as specified by the Presentation API 4.0.

Note: This recipe may also be applied for subtitles. In such cases, the `provides` property of the annotations must have the value `subtitles`.

{% include manifest_links.html viewers="Clover, Ramp, Aviary, Theseus" manifest="manifest.json" %}

{% include jsonviewer.html src="manifest.json" config='data-line="39-44"'%}

{% include jsonviewer.html src="lunchroom_manners-captions-en.json" config='data-line="6-18"'%}

# Related recipes

- [Simplest Manifest - Video][0003]
- [Using Caption Files with Video Content][0219]
- [Using Caption and Subtitle Files in Multiple Languages with Video Content][0074]
- [Using Transcript Files with Audio or Video Content][0253]
- [Providing Access to Transcripts of A/V Content][0017]

{% include acronyms.md %}
{% include links.md %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
{
"@context": "http://iiif.io/api/presentation/3/context.json",
"id": "{{ id.url }}",
"type": "AnnotationPage",
"items": [
{
"id": "https://data.europeana.eu/annotation/2051943/data_euscreenXL_EUS_2BAA81D23D6F41578CB2C2071D0325FC/en/a1",
"type": "Annotation",
"motivation": "supplementing",
"provides": [ "closedCaptions" ],
"body": {
"type": "TextualBody",
"format": "text/plain",
"language": "en",
"value": "[music]"
},
"target": "{{ id.path }}/canvas#t=1.200,21.000"
},
{
"id": "https://data.europeana.eu/annotation/2051943/data_euscreenXL_EUS_2BAA81D23D6F41578CB2C2071D0325FC/en/a2",
"type": "Annotation",
"motivation": "supplementing",
"provides": [ "closedCaptions" ],
"body": {
"type": "TextualBody",
"format": "text/plain",
"language": "en",
"value": "Just before lunch one day, a puppet show \nwas put on at school."
},
"target": "{{ id.path }}/canvas#t=22.200,26.600"
},
{
"id": "https://data.europeana.eu/annotation/2051943/data_euscreenXL_EUS_2BAA81D23D6F41578CB2C2071D0325FC/en/a3",
"type": "Annotation",
"motivation": "supplementing",
"provides": [ "closedCaptions" ],
"body": {
"type": "TextualBody",
"format": "text/plain",
"language": "en",
"value": "It was called \"Mister Bungle Goes to Lunch\"."
},
"target": "{{ id.path }}/canvas#t=26.700,31.500"
},
{
"id": "https://data.europeana.eu/annotation/2051943/data_euscreenXL_EUS_2BAA81D23D6F41578CB2C2071D0325FC/en/a4",
"type": "Annotation",
"motivation": "supplementing",
"provides": [ "closedCaptions" ],
"body": {
"type": "TextualBody",
"format": "text/plain",
"language": "en",
"value": "It was fun to watch."
},
"target": "{{ id.path }}/canvas#t=31.600,34.500"
},
{
"id": "https://data.europeana.eu/annotation/2051943/data_euscreenXL_EUS_2BAA81D23D6F41578CB2C2071D0325FC/en/a5",
"type": "Annotation",
"motivation": "supplementing",
"provides": [ "closedCaptions" ],
"body": {
"type": "TextualBody",
"format": "text/plain",
"language": "en",
"value": "In the puppet show, Mr. Bungle came to the \nboys' room on his way to lunch."
},
"target": "{{ id.path }}/canvas#t=36.100,41.300"
},
{
"id": "https://data.europeana.eu/annotation/2051943/data_euscreenXL_EUS_2BAA81D23D6F41578CB2C2071D0325FC/en/a6",
"type": "Annotation",
"motivation": "supplementing",
"provides": [ "closedCaptions" ],
"body": {
"type": "TextualBody",
"format": "text/plain",
"language": "en",
"value": "He looked at his hands. His hands were dirty \nand his hair was messy."
},
"target": "{{ id.path }}/canvas#t=41.400,46.200"
},
{
"id": "https://data.europeana.eu/annotation/2051943/data_euscreenXL_EUS_2BAA81D23D6F41578CB2C2071D0325FC/en/a7",
"type": "Annotation",
"motivation": "supplementing",
"provides": [ "closedCaptions" ],
"body": {
"type": "TextualBody",
"format": "text/plain",
"language": "en",
"value": "But Mr. Bungle didn't stop to wash his hands \nor comb his hair."
},
"target": "{{ id.path }}/canvas#t=46.300,51.100"
},
{
"id": "https://data.europeana.eu/annotation/2051943/data_euscreenXL_EUS_2BAA81D23D6F41578CB2C2071D0325FC/en/a8",
"type": "Annotation",
"motivation": "supplementing",
"provides": [ "closedCaptions" ],
"body": {
"type": "TextualBody",
"format": "text/plain",
"language": "en",
"value": "He went right to lunch."
},
"target": "{{ id.path }}/canvas#t=51.200,54.900"
},
{
"id": "https://data.europeana.eu/annotation/2051943/data_euscreenXL_EUS_2BAA81D23D6F41578CB2C2071D0325FC/en/a9",
"type": "Annotation",
"motivation": "supplementing",
"provides": [ "closedCaptions" ],
"body": {
"type": "TextualBody",
"format": "text/plain",
"language": "en",
"value": "Then, instead of getting into line at the \nlunchroom, Mr. Bungle pushed everyone aside \nand went right to the front."
},
"target": "{{ id.path }}/canvas#t=57.900,65.700"
}
]
}
47 changes: 47 additions & 0 deletions recipe/0079-annotations-for-captions/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"@context": "http://iiif.io/api/presentation/3/context.json",
"id": "{{ id.url }}",
"type": "Manifest",
"label": {
"en": [
"Lunchroom Manners"
]
},
"items": [
{
"id": "{{ id.path }}/canvas",
"type": "Canvas",
"height": 360,
"width": 480,
"duration": 572.034,
"items": [
{
"id": "{{ id.path }}/canvas/page",
"type": "AnnotationPage",
"items": [
{
"id": "{{ id.path }}/canvas/page/annotation1",
"type": "Annotation",
"motivation": "painting",
"body": {
"id": "https://fixtures.iiif.io/video/indiana/lunchroom_manners/high/lunchroom_manners_1024kb.mp4",
"type": "Video",
"height": 360,
"width": 480,
"duration": 572.034,
"format": "video/mp4"
},
"target": "{{ id.path }}/canvas"
}
]
}
],
"annotations": [
{
"id": "{{ id.path }}/lunchroom_manners-captions-en.json",
"type": "AnnotationPage"
}
]
}
]
}
Loading