GuidesAPIStatusSign up

πŸŽ₯ Video analysis

Eden AI gives access to a large number of Video analysis technologies from the best providers.

Video Analysis is a feature that allows you to extract information and insights from video files. It is designed to be asynchronous, meaning that the analysis process happens in the background and you can access to the result when it's ready.

With Eden AI, you can access to multiple Video analysis technologies. For each of those technologies, different providers are available. Here is the complete list of technologies available on Eden AI:

Subfeatures

  1. Label detection : identify the objects, people, and other entities present in a video. It returns a list of labels, along with confidence scores indicating the likelihood that the label is accurate and the timestamps of each detected label.
  2. Face detection : identify the faces present in a video. It returns the location and coordinates of each face, as well as any available metadata such as landmarks and poses if available.
  3. Text detection : extract any text present in a video. It returns the location, size, and content of each piece of text.
  4. Logo detection : identify logos present in a video. It returns the location and coordinates of each logo, along with the associated brand name if available.
  5. Explicit content detection : detect whether a video contains explicit or inappropriate content. It returns a label indicating the category, along with a confidence score.
  6. Object tracking : track specific objects as they move throughout a video. It returns the location and size of the tracked object at each frame.
  7. Person tracking : track specific people as they move throughout a video. It returns the location and size of the tracked person at each frame with the timestamp.

Usage

All video analysis subfeatures are asynchronous API, which means you start the analysis of a video by calling a POST request to the API with the video file, the desired subfeature and the available providers. The API will then return a job ID.

You can use the GET operation to get the completion status of the request with the job ID.

Finally, when the process is over you can access the video analysis request results by calling a GET operation again.

The information in the following examples uses label detection with both google and amazon to show how edenai video label detection works.

Starting video analysis

You start an Video label detection request by calling a POST request. The following is an example that makes a call to the API with the video.mp4 video file and request label detection subfeature.

import requests

headers = {"Authorization": "Bearer πŸ”‘ Your_API_Key"}

url="https://api.edenai.run/v2/video/label_detection_async"
data={"providers": "amazon,google"}
files = {'file': open("🎬 path/to/your/video.mp4",'rb')}

response = requests.post(url, data=data, files=files, headers=headers)
data = response.json()

The API will then return a JSON request response with an ID that show that the job has been launched.

{"public_id": "9421ae03-6180-4aef-82ce-19b2c33e9397"}

Getting the response status

We will then use the returned Job ID to get info on the current status of the job, or get the result of label detection analysis if the job is finished.

url = "https://api.edenai.run/v2/video/label_detection_async/{public_id}"

headers = {
    "accept": "application/json",
    "authorization": "Bearer πŸ”‘ Your_API_Key"
}

response = requests.get(url, headers=headers)

Alternatively you can return all your launched jobs for label detection.

headers = {"Authorization": "Bearer πŸ”‘ Your_API_Key"}

url = "https://api.edenai.run/v2/video/label_detection_async"

response = requests.get(url, headers=headers).json()

Getting video analysis result

A successful video analysis request has a status finished. You can get access to the results with the same Get operation.

The following result shows the successful processing of a label detection job.

{
  "public_id": "18d9a290-aa55-4e51-b3a9-7aea2738244e",
  "status": "finished",
  "error": null,
  "results": {
    "amazon": {
      "error": null,
      "id": "7b34f341-cca8-46b9-89ef-242d999b02f2",
      "final_status": "finished",
    	"labels": [
          {
              "name": string,
              "confidence":float,
              "timestamp": [
                  {
                      "start": float,
                      "end": float
                  },
                    ...
              ],
              "category": [string],
              "bounding_box": [
                  {
                      "top": float,
                      "left": float,
                      "height": float,
                      "width": float
                  },
                   ...
              ]
          },
           ...
      ]
    }
 }

Once the operation has been completed, the response will contain the result for each provider which consist of a list of labels.

Each label include it's entity name, a list of the entity categories, a confidence score indicating the likelihood that the label is accurate and a list timestamps where the label appear with it's bounding box.

Pricing

By default the video features pricing is calculated per units of 1 minute. Some exceptions exist for google which is priced per units of 1 second.

Here is an example for a pricing per units of 1 minute:

Per default : a request of 50 seconds will cost the price of 1 minute and a video of 2:01 minutes will cost 3 minutes.

Google : a video of 1:23 minute will cost the price of 1 minute and 23 seconds.

You can use all those technologies through the platform or API. Do not hesitate to check our Getting Started With Your API to use API.