> ## Documentation Index
> Fetch the complete documentation index at: https://cloudinary.com/documentation/llms.txt
> Use this file to discover all available pages before exploring further.

# Google Automatic Video Tagging


[Cloudinary](https://cloudinary.com) is a cloud-based service that provides an end-to-end image and video management solution including uploads, storage, transformations, optimizations and delivery. Cloudinary offers a rich set of transformation and analysis capabilities and allows you to assign multiple tags to resources for listing and managing your media assets.

The Google Automatic Video Tagging add-on integrates [Google's](https://cloud.google.com/video-intelligence/) automatic video tagging capabilities with Cloudinary's complete video management and transformation pipeline. Google analyzes video data to automatically identify scenes and suggest tags; a process that would take huge amounts of time and resources if performed manually. Google's technology includes state-of-the-art machine learning approaches that allow it to be trained in the recognition of various visual objects and concepts. When this algorithm is combined with Google's large data sets containing the visual characteristics of videos and their associated tags, the result is outstanding performance in terms of the time needed to process large videos with a high precision rate.

With the Google video tagging add-on, you can extend Cloudinary's powerful semantic data extraction and tagging features, so that your videos can be automatically tagged according to the automatically detected categories and tags in each video.
> **TIP**: You can optionally request the category and tag results in another language or in multiple languages by registering for the [Google Translation Add-on](translation_addons) in addition to the tagging add-on.#### Getting started

Before you can use the Google Automatic Video Tagging add-on:

* You must have a Cloudinary account. If you don't already have one, you can [sign up](https://cloudinary.com/users/register_free) for a free account. 

* Register for the add-on: make sure you're logged in to your account and then go to the [Add-ons](https://console.cloudinary.com/app/settings/addons) page. For more information about add-on registrations, see [Registering for add-ons](cloudinary_add_ons#registering_for_add_ons).

* Keep in mind that many of the examples on this page use our SDKs. For SDK installation and configuration details, see the relevant [SDK](cloudinary_sdks) guide.
  
* If you're new to Cloudinary, you may want to take a look at the [Developer Kickstart](dev_kickstart) for a hands-on, step-by-step introduction to a variety of features.

## Video recognition and categorization

Take a look at the following video of a turtle:

![dog.mp4](https://res.cloudinary.com/demo/video/upload/turtle.mp4)

```nodejs
cloudinary.video("turtle")
```

```react
new CloudinaryVideo("turtle.mp4");
```

```vue
new CloudinaryVideo("turtle.mp4");
```

```angular
new CloudinaryVideo("turtle.mp4");
```

```js
new CloudinaryVideo("turtle.mp4");
```

```python
CloudinaryVideo("turtle").video()
```

```php
(new VideoTag('turtle.mp4'));
```

```java
cloudinary.url().transformation(new Transformation().videoTag("turtle");
```

```ruby
cl_video_tag("turtle")
```

```csharp
cloudinary.Api.UrlVideoUp.BuildVideoTag("turtle")
```

```dart
cloudinary.video('turtle.mp4').transformation(Transformation());
```

```swift
cloudinary.createUrl().setResourceType("video").generate("turtle.mp4")
```

```android
MediaManager.get().url().transformation(new Transformation().resourceType("video").generate("turtle.mp4");
```

```flutter
cloudinary.video('turtle.mp4').transformation(Transformation());
```

```kotlin
cloudinary.video {
	publicId("turtle.mp4") 
}.generate()
```

```jquery
$.cloudinary.video("turtle")
```

```react_native
new CloudinaryVideo("turtle.mp4");
```

By setting the `categorization` parameter to `google_video_tagging` when calling Cloudinary's [upload](image_upload_api_reference#upload) or [update](admin_api#update_details_of_an_existing_resource) method, Google is used to automatically classify the scenes of the uploaded or specified existing video. For example:

```multi
|ruby
Cloudinary::Uploader.upload("turtle.mp4", 
  resource_type: "video", 
  categorization: "google_video_tagging")

|php_2
$cloudinary->uploadApi()->upload("turtle.mp4", [
    "resource_type" => "video", 
    "categorization" => "google_video_tagging"]);

|python
cloudinary.uploader.upload("turtle.mp4",
  resource_type = "video", 
  categorization = "google_video_tagging")

|nodejs
cloudinary.v2.uploader
.upload("turtle.mp4", 
  { resource_type: "video", 
    categorization: "google_video_tagging" })
.then(result=>console.log(result)); 

|java
cloudinary.uploader().upload("turtle.mp4", 
  ObjectUtils.asMap(
    "resource_type", "video", 
    "categorization", "google_video_tagging"));

|csharp
var uploadParams = new VideoUploadParams() 
{
  File = new FileDescription(@"turtle.mp4"),
  Categorization = "google_video_tagging"
};
var uploadResult = cloudinary.Upload(uploadParams); 

|go
resp, err := cld.Upload.Upload(ctx, "turtle.mp4", uploader.UploadParams{
		ResourceType:   "video",
		Categorization: "google_video_tagging"})

|android
MediaManager.get().upload("turtle.mp4")
  .option("resource_type", "video")
  .option("categorization", "google_video_tagging").dispatch();

|swift
let params = CLDUploadRequestParams()
  .setCategorization("google_video_tagging")
  .setResourceType(.video)
var mySig = MyFunction(params)  // your own function that returns a signature generated on your backend
params.setSignature(CLDSignature(signature: mySig.signature, timestamp: mySig.timestamp))
let request = cloudinary.createUploader().signedUpload(
  url: "turtle.mp4", params: params) 

|curl
curl https://api.cloudinary.com/v1_1/demo/video/upload -X POST -F 'file=@/path/to/turtle.mp4' -F 'categorization=google_video_tagging' -F 'timestamp=173719931' -F 'api_key=436464676' -F 'signature=a781d61f86a6f818af'

|cli
cld uploader upload "turtle.mp4" resource_type="video" categorization="google_video_tagging"
```

> **TIP**:
>
> :title=Tips

> * You can use **upload presets** to centrally define a set of upload options including add-on operations to apply, instead of specifying them in each upload call. You can define multiple upload presets, and apply different presets in different upload scenarios. You can create new upload presets in the **Upload Presets** page of the [Console Settings](https://console.cloudinary.com/app/settings/upload/presets) or using the [upload_presets](admin_api#upload_presets) Admin API method. From the **Upload** page of the Console Settings, you can also select default upload presets to use for image, video, and raw API uploads (respectively) as well as default presets for image, video, and raw uploads performed via the Media Library UI. 
> **Learn more**: [Upload presets](upload_presets)* You can run multiple categorization add-ons on the resource. The `categorization` parameter accepts a comma-separated list of all the Cloudinary categorization add-ons to run on the resource.

The video analysis and categorization is performed asynchronously after the method call is completed. 

> **NOTE**: The amount of time it takes for analysis and categorization of the video depends on the size and length of the video file itself. You can include a `notification_url` parameter in your request to get a [notification](notifications) to the requested URL when the categorization is ready.

The response of the upload method indicates that the process is in `pending` status.

```json
{ 
  ...
  "info": { 
    "categorization": { 
      "google_video_tagging": { 
        "status": "pending" 
      }
    }
  },
  ...
}
```

Once the categorization process completes, the information is returned to Cloudinary and stored with your video. The details of the analysis and categorization are also sent to the `notification_url` if this option was included with your method call. For example:

```json
{
...
"info_kind": "google_video_tagging",
"info_status": "complete",
"info_data": [
  {"tag": "sea turtle", 
   "categories": ["turtle"],
   "start_time_offset": 0.0, 
   "end_time_offset": 13.47364, 
   "confidence": 0.9922,
   "shot_level": false},
   {"tag": "turtle", 
   "categories": ["reptile"],
   "start_time_offset": 0.0, 
   "end_time_offset": 13.47364, 
   "confidence": 0.9922,
   "shot_level": true},
   {"tag": "animal", 
   "categories": [],
   "start_time_offset": 0.0, 
   "end_time_offset": 23.36044, 
   "confidence": 0.9715,
   "shot_level": false},
  ... 
  ]
...
```

The information includes the automatic tagging and categorization information identified by the Google Automatic Video Tagging add-on. As can be seen in the example snippet above, various tags were automatically detected in the uploaded video. Each tag is listed together with the start and end times of the relevant video segment, and any relevant `categories` of the tag . The `shot_level` is a boolean value indicating whether the segment represents the entire video (false) or just a shot within it (true). The `confidence` score is a numerical value that represents the confidence level of the detected tag, where 1.0 means 100% confidence. 

## Adding resource tags to videos

Automatically categorizing your videos is a useful way to organize your Cloudinary media assets. By providing the `auto_tagging` parameter in an `upload` or `update` call for any video where `google_video_tagging` was run, the video is automatically assigned resource tags based on the detected scene tags and categories. The value of the `auto_tagging` parameter is the minimum confidence score of a detected tag that should be automatically used as an assigned resource tag. Assigning these resource tags allows you to list and search videos using Cloudinary's API or Web interface.

The following code example automatically tags an uploaded video with all detected tags and categories that have a confidence score higher than 0.4.

```multi
|ruby
Cloudinary::Uploader.upload("turtle.mp4", 
  resource_type: "video", 
  categorization: "google_video_tagging", 
  auto_tagging: 0.4)

|php_2
$cloudinary->uploadApi()->upload("turtle.mp4", [
    "resource_type" => "video",
    "categorization" => "google_video_tagging", 
    "auto_tagging" => 0.4]);

|python
cloudinary.uploader.upload("turtle.mp4",
  resource_type = "video",
  categorization = "google_video_tagging", 
  auto_tagging = 0.4)

|nodejs
cloudinary.v2.uploader
.upload("turtle.mp4", 
  { resource_type: "video", 
    categorization: "google_video_tagging", 
    auto_tagging: 0.4 })
.then(result=>console.log(result)); 

|java
cloudinary.uploader().upload("turtle.mp4", 
  ObjectUtils.asMap(
    "resource_type", "video", 
    "categorization", "google_video_tagging", 
    "auto_tagging", "0.4"));

|csharp
var uploadParams = new VideoUploadParams() 
{
  File = new FileDescription(@"turtle.mp4"),
  Categorization = "google_video_tagging",
  AutoTagging = 0.4
};
var uploadResult = cloudinary.Upload(uploadParams);  

|go
resp, err := cld.Upload.Upload(ctx, "turtle.mp4", uploader.UploadParams{
		ResourceType:   "video",
		Categorization: "google_video_tagging",
		AutoTagging:    0.4})

|android
MediaManager.get().upload("turtle.mp4")
  .option("resource_type", "video")
  .option("categorization", "google_video_tagging")
  .option("auto_tagging", "0.4").dispatch();

|swift
let params = CLDUploadRequestParams()
  .setCategorization("google_video_tagging")
  .setResourceType(.video)
  .setAutoTagging(0.4)
var mySig = MyFunction(params)  // your own function that returns a signature generated on your backend
params.setSignature(CLDSignature(signature: mySig.signature, timestamp: mySig.timestamp))
let request = cloudinary.createUploader().signedUpload(
  url: "turtle.mp4", params: params) 

|curl
curl https://api.cloudinary.com/v1_1/demo/video/upload -X POST -F 'file=@/path/to/turtle.mp4' -F 'categorization=google_video_tagging' -F 'auto_tagging=0.4' -F 'timestamp=173719931' -F 'api_key=436464676&signature=a781d61f86a6f818af'

|cli
cld uploader upload "turtle.mp4" resource_type="video" categorization="google_video_tagging" auto_tagging=0.4
```

You can also use the `update` method to apply Google auto-tagging to already uploaded videos, based on their public IDs, and then automatically tag them according to the detected categories.

For example, the following video was uploaded to Cloudinary with the 'horses' public ID:

![horses.mp4](https://res.cloudinary.com/demo/video/upload/horses.mp4)

```nodejs
cloudinary.video("horses")
```

```react
new CloudinaryVideo("horses.mp4");
```

```vue
new CloudinaryVideo("horses.mp4");
```

```angular
new CloudinaryVideo("horses.mp4");
```

```js
new CloudinaryVideo("horses.mp4");
```

```python
CloudinaryVideo("horses").video()
```

```php
(new VideoTag('horses.mp4'));
```

```java
cloudinary.url().transformation(new Transformation().videoTag("horses");
```

```ruby
cl_video_tag("horses")
```

```csharp
cloudinary.Api.UrlVideoUp.BuildVideoTag("horses")
```

```dart
cloudinary.video('horses.mp4').transformation(Transformation());
```

```swift
cloudinary.createUrl().setResourceType("video").generate("horses.mp4")
```

```android
MediaManager.get().url().transformation(new Transformation().resourceType("video").generate("horses.mp4");
```

```flutter
cloudinary.video('horses.mp4').transformation(Transformation());
```

```kotlin
cloudinary.video {
	publicId("horses.mp4") 
}.generate()
```

```jquery
$.cloudinary.video("horses")
```

```react_native
new CloudinaryVideo("horses.mp4");
```

The following code sample uses Cloudinary's `update` method to apply Google's automatic video tagging and categorization to the `horses` uploaded video, and then automatically assign resource tags based on the categories detected with over a 60% confidence level.

```multi
|ruby
Cloudinary::Api.update("horses", 
   resource_type: "video", 
   categorization: "google_video_tagging", 
   auto_tagging: 0.6)

|php_2
$api->update("horses", [
    "resource_type" => "video",
    "categorization" => "google_video_tagging", 
    "auto_tagging" => 0.6]);

|python
cloudinary.api.update("horses",
  resource_type = "video",
  categorization = "google_video_tagging", 
  auto_tagging = 0.6)

|nodejs
cloudinary.v2.api
.update("horses", 
  { resource_type: "video", 
    categorization: "google_video_tagging", 
    auto_tagging: 0.4 })
.then(result=>console.log(result));

|java
cloudinary.api().update("horses", ObjectUtils.asMap(
  "resource_type": "video",
  "categorization", "google_video_tagging", 
  "auto_tagging", 0.6));

|csharp
var updateParams = new UpdateParams("horses") 
{
  Categorization = "google_video_tagging",
  ResourceType = "video",
  AutoTagging = 0.6
};
var updateResult = cloudinary.UpdateResource(updateParams); 

|go
resp, err := cld.Upload.Upload(ctx, "horses", uploader.UploadParams{
		ResourceType:   "video",
		Categorization: "google_video_tagging",
		AutoTagging:    0.4})

|cli
cld admin update "horses" resource_type="video" categorization="google_video_tagging" auto_tagging=0.6
```

> **TIP**: Whether or not you included a `notification_url` to get a response from the analysis, you can always use the Admin API's [resource](admin_api#get_details_of_a_single_resource_by_public_id) method to return the details of a resource, including the scene categories that you already extracted using the `upload` or `update` methods.

