# Comprehend Media

Comprehend audio or video with Backtracks Media Intelligence to get powerful contextual understanding of what that media is actually about. Backtracks will kick off a comprehension job to understand what the media is about in detail including transcripts with timings of what is actually said, advertising categories that the media maps to, keywords, topics, brand safety scoring and more.

# Comprehend

Comprehend audio and video with media_id. The /comprehend API endpoint is the core endpoint for media intelligence calls.

TIP

Backtracks supports automatic language detection and transcription in 80+ languages.

# Comprehend Request

Initiate a comprehend request to kick-off a job to understand and comprehend the meaning of the media. After submitting the request, the processing and completion status of the job may be verified, and when the job is complete then the results will contain data like a full transcript with timings and the data related to the specified options (i.e. advertising categories).

POST https://api.backtracks.fm/v1/media-intelligence/comprehend HTTP/1.1
Accept: application/json
Authorization: JWT <your backtracks access token>...
Content-Type: application/json

{
   "media_id":"<media_id>",
   "options":{
      "iab_categories":true,
      "keywords":true,
      "entities":true
   },
   "webhook":{
      "url":"https://example.com/abc-123",
      "headers":{
         "Authorization":"Bearer abc123",
         "X-Custom-Header":"456"
      }
   }
}

TIP

Backtracks will automatically isolate speech and remove background sounds when understanding media, but in general better input quality will result in better comprehension.

# Parameters

Property Type Required Description
media_id string y universal media id
language_code string n This is an optional hint. If it is not specified then the language will be automatically detected.
options object n These are the options for which types of data to generate or return
webhook object n These are the settings for webhook or callback on request success or error
# Options

The options object represents the types of data requested for the media intelligence comprehend response. If the options object is not specified or any of the options does not receive an explict value then the default value will apply. The transcript flag/option is the only option that has a default value of true if a value for the property is omitted.

Property Type Required Default Description
transcript boolean n true Transcribe media that is audio or video content
iab_categories boolean n false Detect IAB taxonomy categories for ads and content
keywords boolean n false Detect keywords
entities boolean n false Detect people, products, organizations, etc.

TIP

If processing is required to fulfill the request, then this will be completed implicitly if needed (i.e. keywords are requested a transcript needs to be generated even if the transcript is not requested in the response).

# Webhook

The webhook object represents the optional settings for a webhook or callback that is called via HTTP POST on success or error of the request.

# Parameters
Property Type Required Description
url string y URL to POST to on success or error
headers object n Key/value pairs of HTTP headers to echo in the webhook POST
# Webhook Payload

Webhooks are sent via HTTP POST to the URL specified in the request. The job_id/id of the comprehend request and the success or error status of the request is sent in the payload. The receiver of the webhook would then call into the API to retreive the data for the request by the job_id/id of the request. Receiving endpoints that error or timeout without returning an HTTP 200 series status code (i.e. 200, 201, 202, etc.) in less than 30 seconds are retried for up to 24 hours.

HTTP/1.1 200 OK
User-Agent: Backtracks/1.0 (+https://backtracks.fm)
Content-Type: application/hal+json; charset=utf-8
Header-Abc: <Header value>

{
    "id": "<id>",
    "status": "success|error"
}

# Comprehend Response

The comprehend job id is returned with the current status of the job. To check on the status of the job and return the result of the job, the API caller would call the self link returned in the response to get the comprehend job status or get the comprehend job result.

HTTP/1.1 202 Accepted
Location: https://api.backtracks.fm/v1/media-intelligence/comprehend
Content-Type: application/hal+json; charset=utf-8

{
    "id": "<id>", 
    "status": "processing",
    "_links": {
        "self": {
            "href": "https://api.backtracks.fm/v1/media-intelligence/comprehensions/<id>"
        }
    }
}

# Comprehend Status

When a comprehend job is initiated the system returns the jobs status in the response immediately. The API caller may check on the status of the job and when the job is complete the result will also be returned when the job is complete.

# Get Comprehend Status Request

You may retrieve the status of the comprehend process for a particular comprehend job id with the following API call.

# Parameters

Property Type Description
id string Comprehend job id
GET https://api.backtracks.fm/v1/media-intelligence/comprehensions/dde0d890-9c13-40de-be68-01c7b1fa9246
Accept: application/json
Authorization: JWT <your backtracks access token>...

# Get Comprehend Status Response

HTTP/1.1 200 OK
Location: https://api.backtracks.fm/v1/media-intelligence/comprehensions/dde0d890-9c13-40de-be68-01c7b1fa9246
Content-Type: application/hal+json; charset=utf-8

{
    "id": "dde0d890-9c13-40de-be68-01c7b1fa9246",
    "status": "processing", 
    "_links": {
        "self": {
            "href": "https://api.backtracks.fm/v1/media-intelligence/comprehensions/dde0d890-9c13-40de-be68-01c7b1fa9246"
        }
    }
}

The primary comprehend job statuses are below. When a comprehend job is complete and successful the status will be success. A comprehend job is called a comprehension.

# Statuses

Name Description
queued Request is queued and waiting to start
processing Request is processing
success Request was successful
error Request errored

If the comprehend request by media_id has not started, needs processing, or errored then a response like the following will be returned by the API. The caller may then check on the status of processing by calling the comprehension status endpoints using the id (i.e. job id) returned from the processing response to determine when the data is available.

HTTP/1.1 200 OK
Location: https://api.backtracks.fm/v1/media-intelligence/comprehensions/<id>
Content-Type: application/hal+json; charset=utf-8

{
    "id": "<id>", 
    "status": "<queued|processing|success|error>",
    "_links": {
        "self": {
            "href": "https://api.backtracks.fm/v1/media-intelligence/comprehensions/<id>"
        }
    }
}

# Success

When a comprehend is complete and successful then a success response is returned with an HTTP 200 status code in the the response. The results of the comprehend job are returned in the response when the job is complete.

HTTP/1.1 200 OK
Location: https://api.backtracks.fm/v1/media-intelligence/comprehensions/<id>
Content-Type: application/hal+json; charset=utf-8

{
   "id":"<id>",
   "media_id":"<media_id>",
   "language_code":"en_us",
   "status":"complete",
   "results":[
      {
         "final":true,
         "transcript":{
            "status":"complete",
            "items":[
               {
                  "id":"c0",
                  "start":0.0,
                  "end":11.953,
                  "body":"This is the text of a segment of the transcript. There will be N segments."
               }
            ],
            "_links":{
               "self":{
                  "href":"https://api.backtracks.fm/v1/media-intelligence/comprehensions/<id>/transcript"
               },
               "srt":{
                  "href":"https://api.backtracks.fm/v1/media-intelligence/comprehensions/<id>/transcript/srt"
               },
               "vtt":{
                  "href":"https://api.backtracks.fm/v1/media-intelligence/comprehensions/<id>/transcript/vtt"
               }
            }
         },
         "iab_categories":{
            "status":"complete",
            "items":[
               {
                  "label":"Media Industry",
                  "score":0.3827972114086151,
                  "text":"Backtracks Media Intelligence enables contextual understanding of audio and video at scale. Get automatic transcripts, topic identification, and contextual understanding of media from what is actually said in ads and content.",
                  "tier_1":"Business and Finance",
                  "tier_2":"Industries",
                  "tier_3":"Media Industry",
                  "iab_id":"106"
               },
               {
                  "label":"Advertising Industry",
                  "score":0.3541545867919922,
                  "text":"Backtracks detects the keywords, people, products, dates, companies, organizations, and more, like brand safety categorizations and scoring. It even automatically maps media to advertising categories supported by programmatic ad platforms to enable monetization opportunities. Unlock value through understanding, and learn more at backtracks.fm.",
                  "tier_1":"Business and Finance",
                  "tier_2":"Industries",
                  "tier_3":"Advertising Industry",
                  "iab_id":"91"
               }
            ],
            "summary":{
               "Media Industry":1.907792329788208,
               "Advertising Industry":1.6625179946422577
            }
         },
         "keywords":{
            "status":"complete",
            "items":[
               {
                  "label":"backtracks media",
                  "score":0.26368705417506344
               },
               {
                  "label":"contextual understanding",
                  "score":0.239762634514837
               },
               {
                  "label":"safety categorizations",
                  "score":0.1666656878643069
               }
            ]
         },
         "entities":{
            "status":"complete",
            "items":[
               {
                  "label":"Backtracks Media Intelligence",
                  "type":"PRODUCT"
               },
               {
                  "label":"Backtracks",
                  "type":"ORG"
               },
               {
                  "label":"backtracks.fm",
                  "type":"ORG"
               }
            ]
         }
      }
   ],
   "_links":{
      "self":{
         "href":"https://api.backtracks.fm/v1/media-intelligence/comprehensions/<id>"
      }
   }
}

# Advertising Categories & Topics

Enable contextual and programmatic advertising in audio and video by mapping what is actually said in media to advertising categories and topics. This granular level of advertising category and topic mapping allows for surfacing contextual data for advertising use cases. For example, in media or media segments about automobiles the most appropriate ads may be automotive ads, ads and content that are both about autombiles may be an appropriate match, etc.

TIP

Backtracks will automatically map which of 698 IAB ad and content taxonomy categories are applicable to the media.

# Advertising Categories Response

In the response from a comprehend request, aka a comprehension, the IAB advertising and content categories are returned if iab_categories is set to true in the options of the comprehend request.

{
   "iab_categories":{
      "status":"complete",
      "items":[
         {
            "label":"Media Industry",
            "score":0.3827972114086151,
            "text":"Get automatic transcripts, topic identification, and contextual understanding of media from what is actually said in ads and content.",
            "tier_1":"Business and Finance",
            "tier_2":"Industries",
            "tier_3":"Media Industry",
            "iab_id":"106"
         }
      ],
      "summary":{
         "Media Industry":1.907792329788208,
         "Advertising Industry":1.6625179946422577
      }
   }
}

# Advertising Categories by Overall Media

Determine the overall advertising categories for a piece of media. For example, the categories for ad creative/media or episode content may be automotive and auto repair. This is represented by the summary property/object of the of the iab_categories.

{
   "iab_categories":{
      "status":"complete",
      "summary":{
         "Automotive":5.570719301700592,
         "Auto Repair":1.907792329788208
      }
   }
}

# Advertising Categories by Segment

In a piece of audio or video media, the topics discussed may change over the duration of the media. For example, the advertising categories associated with one segment of the media are different than the advertising categories associated with another segment where different topics are discussed in the media. This is represented by the items property/object of the of the iab_categories.

{
   "iab_categories":{
      "status":"complete",
      "items":[
         {
            "label":"Media Industry",
            "score":0.3827972114086151,
            "text":"Get automatic transcripts, topic identification, and contextual understanding of media from what is actually said in ads and content.",
            "tier_1":"Business and Finance",
            "tier_2":"Industries",
            "tier_3":"Media Industry",
            "iab_id":"106"
         }
      ]
   }
}

# Brand Safety & Sensitive Content

Automatically determine if media (i.e. ads or content) contains sensitive topics. This is useful for automated ad and content categorization as well as brand safety. Sensitive topics are represented by the summary property/object of the of the iab_categories response data.

{
   "iab_categories":{
      "status":"complete",
      "summary":{
         "Illegal Drugs, Tobacco, eCigarettes, Vaping, Alcohol":1.6625179946422577,
         "Obscenity and Profanity":1.4562954008579254,
         "Online Piracy":1.3775753378868103
      }
   }
}

# Sensitive Topics

Topic
Adult & Explicit Sexual Content
Arms & Ammunition
Crime & Harmful Acts to Individuals, Society & Human Right Violations
Death, Injury, or Military Conflict
Debated Sensitive Social Issues
Hate Speech and Acts of Aggression
Illegal Drugs, Tobacco, eCigarettes, Vaping, Alcohol
Obscenity and Profanity
Online Piracy
Spam or Harmful Content
Terrorism

# Keywords

Determine exactly what the keywords (or keyphrases) are in the media. This is useful for contextual targeting, search, tagging, and more. When keywords is set to true in the options of the comprehend request, the detected keywords are returned in the success job results response.

# Keywords Response

{
   "keywords":{
      "status":"complete",
      "items":[
         {
            "label":"backtracks media",
            "score":0.26368705417506344
         },
         {
            "label":"contextual understanding",
            "score":0.239762634514837
         },
         {
            "label":"safety categorizations",
            "score":0.1666656878643069
         }
      ]
   }
}

# Topics and Entities

Determine exactly what topics, people, places, etc. are discussed in media. When entities is set to true in the options of the comprehend request, the detected topic and entity types are returned in the success job results response.

{
   "entities":{
      "status":"complete",
      "items":[
         {
            "label":"Backtracks Media Intelligence",
            "type":"PRODUCT"
         },
         {
            "label":"Backtracks",
            "type":"ORG"
         },
         {
            "label":"backtracks.fm",
            "type":"ORG"
         }
      ]
   }
}

# Topic Types

Type Description
PERSON People
NORP Nationalities or groups
FAC Facilities, buildings, airports, highways, bridges, etc.
ORG Organizations, companies, agencies, institutions, etc.
GPE Geopolitical entities, Countries, cities, states, etc
LOC Locations, mountain ranges, bodies of water, etc.
PRODUCT Products, objects, vehicles, foods, etc
EVENT Named events, sporting events, etc.
WORK_OF_ART Titles of paintings, books, songs, etc.
LAW Laws
LANGUAGE Language
DATE Abolute dates, relative dates, or time periods
TIME Times smaller than a day
PERCENT Percentage
MONEY Monetary values, including units
QUANTITY Measurements such as weight or distance
ORDINAL First, second, third, etc.
CARDINAL Numerals that do not fall under any other type

# Accessibility and Captions

Backtracks Media Intelligence creates caption and subtitle formats from generated transcripts. These caption and subtitle formats may be used for accessibility, loading into media players, etc.

# Caption Formats

The Backtracks Media Intelligence API supports converting transcripts to the most utilized caption and subtitle formats with support for srt and vtt.

Type
SRT
VTT

To convert the transcript to a caption or subtitle format, utilize the _links object and navigate to the key or node for the file format. For exmaple, to access the transcript in the vtt file format find the link in the _links section with the key of vtt.

TIP

Backtracks Media Intelligence APIs are HAL+JSON, meaning that the content type for API responses is application/hal+json and that links to resources follow a self-describing pattern in the responses returned. For more information on HAL+JSON click here.

{
   "transcript":{
      "_links":{
         "self":{
            "href":"https://api.backtracks.fm/v1/media-intelligence/comprehensions/<id>/transcript"
         },
         "srt":{
            "href":"https://api.backtracks.fm/v1/media-intelligence/comprehensions/<id>/transcript/srt"
         },
         "vtt":{
            "href":"https://api.backtracks.fm/v1/media-intelligence/comprehensions/<id>/transcript/vtt"
         }
      }
   }
}

For example, the video file below has captions provided in the srt file format.

TIP

To force a download of the caption or subtitle file add the querystring parameter of download=true to the file format URL. This will return the bytes of the file instead of returning the contents as a string, json, etc. Example: https://api.backtracks.fm/v1/media-intelligence/comprehensions/<id>/transcript/vtt?download=true.

# Supported Languages

The following 80+ languages are supported for Media Intelligence (in transcription).

Language Code (language_code) Native Language Name English Display Name
af Afrikaans Afrikaans
am አማርኛ Amharic
ar العربية Arabic
as অসমীয়া Assamese
az azərbaycan Azerbaijani
ba Bashkir Bashkir
bg български Bulgarian
bn বাংলা Bangla
bo བོད་སྐད་ Tibetan
br brezhoneg Breton
bs bosanski Bosnian
ca català Catalan
cs čeština Czech
cy Cymraeg Welsh
da dansk Danish
de Deutsch German
el Ελληνικά Greek
en English English
es español Spanish
et eesti Estonian
eu euskara Basque
fa فارسی Persian
fi suomi Finnish
fo føroyskt Faroese
fr français French
gl galego Galician
gu ગુજરાતી Gujarati
ha Hausa Hausa
hi हिन्दी Hindi
hr hrvatski Croatian
ht Haitian Creole Haitian Creole
hu magyar Hungarian
id bahasa Indonesia Indonesian
is íslenska Icelandic
it italiano Italian
iw עברית Hebrew
ja 日本語 Japanese
jw Jawa Javanese
ka ქართული Georgian
kk қазақ тілі Kazakh
km ខ្មែរ Khmer
kn ಕನ್ನಡ Kannada
ko 한국어 Korean
la Lingua latina Latin
lb Lëtzebuergesch Luxembourgish
ln lingála Lingala
lo ລາວ Lao
lt lietuvių Lithuanian
lv latviešu Latvian
mg Malagasy Malagasy
mk македонски Macedonian
ml മലയാളം Malayalam
mn монгол Mongolian
mr मराठी Marathi
ms bahasa Malaysia Malay
mt Malti Maltese
my မြန်မာ Burmese
nl Nederlands Dutch
nn norsk nynorsk Norwegian Nynorsk
no norsk Norwegian
oc Occitan Occitan
pa ਪੰਜਾਬੀ Punjabi
pl polski Polish
ps پښتو Pashto
pt português Portuguese
ro română Romanian
ru русский Russian
sa संस्कृत भाषा Sanskrit
sd سنڌي Sindhi
si සිංහල Sinhala
sk slovenčina Slovak
sl slovenščina Slovenian
sn chiShona Shona
so Soomaali Somali
sq shqip Albanian
sr српски Serbian
su Basa Sunda Sundanese
sv svenska Swedish
ta தமிழ் Tamil
te తెలుగు Telugu
tg тоҷикӣ Tajik
th ไทย Thai
tk türkmen dili Turkmen
tl Filipino Filipino
tr Türkçe Turkish
tt татар Tatar
uk українська Ukrainian
ur اردو Urdu
uz o‘zbek Uzbek
vi Tiếng Việt Vietnamese
yi ייִדיש Yiddish
yo Èdè Yorùbá Yoruba
zh 中文 Chinese