Extract logos

At a high level, extracting logs from a video involves the following steps:

  • Upload and index a video. When you upload a video by calling the POST method of the/tasks endpoint, the platform creates a video indexing task and returns its unique identifier.
  • Retrieve the unique identifier of your video. Once the platform finishes indexing your video, you can retrieve its unique identifier by calling the GET method of the /tasks/{task-id} endpoint and passing it the unique identifier of your video indexing task.
  • Extract logos. Call the GET method of the /indexes/{index-id}/videos/{video_id}/logo endpoint, specifying the following parameters in the URL:
    • The unique identifier of your index
    • The unique identifier of your video

Prerequisites

  • You’re familiar with the concepts that are described on the Platform overview page.
  • You must use at least the 1.1 version of the API.
  • You've created at least one index and you've enabled the logo indexing option for it by adding logo to the index_options array. The unique identifier of your index is stored in a variable named INDEX_ID. For details about creating indexes, see the Create indexes page.
  • You've uploaded at least one video, and the platform has finished indexing it. The unique identifier of your video is stored in a variable named VIDEO_ID. For details, see the Upload videos page.

Procedure

  1. Construct the URL for retrieving the logos recognized in your video based on the INDEX_ID and VIDEO_ID variables:

    LOGOS_URL = f"{API_URL}/indexes/{INDEX_ID}/videos/{VIDEO_ID}/logo"
    
    const LOGOS_URL = `${API_URL}/indexes/${INDEX_ID}/videos/${VIDEO_ID}/logo`
    
  2. Retrieve the logos and print the status code and the response to the console:

    response = requests.get(LOGOS_URL, headers=headers)
    print(f"Status code: {response.status_code}")
    pprint(response.json())
    
    const resp = await axios.get(
    	LOGOS_URL,
    	{
    		'headers': {
    			'x-api-key': API_KEY
    		}
    	}
    )
    const { data: response } = resp;
    console.log(`Status code: ${resp.status}`)
    console.log(JSON.stringify(response,null,4))
    

    The following example output has been truncated for brevity:

    Status code: 200
    {
      "id": "63eb68e09678ed7709731d64",
      "index_id": "63eb49211b8502baddec7391",
      "data": [
        {
          "end": 168,
          "start": 167,
          "value": "Hyundai Motor Company"
        },
        {
          "end": 226,
          "start": 224,
          "value": "Hyundai Motor Company"
        },
      ]
    }
    

    In this example output, the Hyundai logo appears in the specified video twice, as shown below:

    • At 167 seconds from the start of the video:

    • At 224 seconds from the start of the video: