Overview

Extracting data from media files enhances content moderation and improves user experience by providing relevant, personalized interactions. Additionally, these techniques enable efficient data analysis, increase accessibility, and bolster security, ultimately helping your site optimize content management and user safety.

Learn how to extract intelligence from your media files using Ittybit's Intelligence API.

Step-by-step guide

  1. Locate the media file you want to extract intelligence from. You will need the media id as an input as well as an API Key. You can find the media id in the Media object.

  2. Use the following code snippet to extract intelligence from your media file:

  3. Optional: Use the confidence parameter to filter out low-confidence results.

const API_KEY = "YOUR API KEY HERE" // Your Ittybit API key
const response = await fetch("https://api.ittybit.com/tasks", {
  headers: {
    Method: "POST",
    Authorization: `Bearer ${API_KEY}`,
    "Content-Type": "application/json",
    body: JSON.stringify({
    input: "med_abcdefgh1234", // Required parameter: media id or file URL
    output: {
      kind: "speech", // Required parameter: desired output type
      confidence: 0.5 // Optional parameter: minimum confidence level required for speech to be labeled.
    },
  }),
},
});

About the API

Endpoint

POST https://api.ittybit.com/tasks

Body parameters

{
  "input": "MEDIA_ID", // Required parameter: media id or file URL
  "output": {
    "kind": "speech" // or "objects", "faces", "text", "nsfw"
  }
}

Required

  • input string

    The ID of the media to use as the input for the task. You may use a media_id: the id from a Media object, or a file_id: the id from a File object or a URL to the media file.

  • output object

    Defines the output for the task. The output object must include a kind and may include additional options that are specific to the kind of task.

Available kinds

  • "objects" - detects and labels objects in a video.
  • "faces" - detecs and differentiates between faces in a video.
  • "text" - detects text in the video along with the timestamp.
  • "nsfw" - checks to see if the media contains adult or NSFW content.
  • "speech" - transcribes audio in the media file.

Available parameters and modifiers

  • confidence number The minimum confidence level required for an object to be detected. A number between 0 and 1. The default value is 0.5.. This is an optional parameter that can be used to filter out low-confidence results.

Next: Combine with Automations API

You can use the Automations API to automatically extract intelligence from all uploaded media files. This is useful for large media libraries or social networks with user-generated content.

See the guide here: Automations

Or see Tracks in action within an Automations API request:

const response = await fetch("https://api.ittybit.com/automations", {
headers: {
  Method: "POST",
  Authorization: `Bearer ${API_KEY}`,
  "Content-Type": "application/json",
  body: JSON.stringify({
"name": "All video uploads",
"trigger": {
	"event": "media.created",
	"conditions": [
		{"prop": "kind", "value": "video"}
	]
},
"tasks": [
	{
		"kind": "image",
		"start": 0
	}, {
		"kind": "video",
		"width": 600,
		"format": "mp4",
		"filename": "600.mp4",
		"next": [
			{
				"kind": "speech", // extracts speech from video
				"next": [
					{
						"kind": "subtitles" // generates subtitles
					}
				]
			},
			{
				"kind": "thumbnails" // generates a thumbnail track
			}
		]
	}
]
 }),
},
});

Considerations

This guide is being updated. Please check back soon for more information.