Last updated: Dec-11-2024
Cloudinary 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 upload images and videos to the cloud, transform them on the fly and deliver them to your users optimized and cached via a fast CDN.
Google Cloud Video Intelligence is a service that makes it easy to add video analysis to your applications. Cloudinary provides an add-on for Google's automatic video moderation service, fully integrated into Cloudinary's video management and transformation pipeline.
With the Google AI Moderation add-on, you can extend Cloudinary's powerful cloud-based transformation and delivery capabilities with automatic AI-based moderation of your videos. Protect your users from explicit and suggestive adult content in your user-uploaded videos, making sure that no offensive videos are displayed to your viewers. Adult content is generally inappropriate for those under 18 years of age and includes, but is not limited to, nudity, sexual activities, and pornography. Such content detected in cartoons or anime is also identified.
Getting started
Before you can use the Google AI Video Moderation add-on:
You must have a Cloudinary account. If you don't already have one, you can sign up 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 page. For more information about add-on registrations, see 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 guide.
If you're new to Cloudinary, you may want to take a look at the Developer Kickstart for a hands-on, step-by-step introduction to Programmable Media features.
Automatic video moderation flow
The following describes the flow of uploading and displaying moderated videos using Cloudinary and the Google AI Video Moderation add-on:
- Your users upload a video to Cloudinary through your application.
- The uploaded video is sent to Google for moderation and set to a 'pending' status.
- The video is marked as either approved or rejected based on the results returned by Google.
- An optional notification callback is sent to your application with the video moderation result.
- A rejected video does not appear in the Cloudinary Console, but is backed up, consuming storage, so that it can be restored if necessary.
- Moderated videos can be listed programmatically using Cloudinary's Admin API or interactively using the Media Library in your Console.
- You can manually override the automatic moderation results using the Admin API or the Media Library.
Moderation categorization
Google assigns a moderation confidence level indicating the chances that a video contains unacceptable content. The likelihood is given as a value on the following scale: very_unlikely
, unlikely
, possible
, likely
, and very_likely
.
The default moderation confidence level for rejecting an image is likely
, unless specifically overridden (see explanation and examples below). All videos classified by Google with a value that is more severe than the rejection confidence level are classified as "rejected". Otherwise their status is set to "approved".
Request video moderation
To request moderation while uploading a video with the default rejection confidence level, set the moderation
upload API parameter to google_video_moderation
and set the resource_type
parameter to video
:
By default, if any frame in the video returns a result of at least likely
, then the video will be rejected. You can override the default rejection confidence level of likely
by including the new value as part of the 'moderation' parameter value, separated by a colon. Possible rejection values are: unlikely
, possible
, likely
, and very_likely
.
For example, to request moderation with the rejection confidence level set to possible
:
Moderation response
As moderation is processed asynchronously, the initial upload response will include a moderation
parameter indicating the status and kind of moderation:
Once the moderation is complete, you will receive a notification indicating the results of the request for moderation. The snippet below shows the individual frames that failed the moderation evaluation, and that the video has been placed in 'rejected' moderation status.
Video moderation listing
Cloudinary's Admin API can be used to list all moderated videos. You can list either the approved or the rejected videos by specifying the second parameter of the resources_by_moderation
API method. For example, to list all videos rejected by the Google AI Video Moderation add-on:
Manual override
As the automatic video moderation of the Google AI Moderation add-on is based on a decision made by an advanced artificial intelligence algorithm, in some cases you may want to manually override the automatic moderation decision and either approve a previously rejected video or reject an approved one.
Overriding moderation via the Media Library
One way to manually override the moderation result is using Cloudinary's Media Library Web interface. From the left navigation menu, select Moderation. Then, from moderation tools list in the top menu, select Google Video and then select the status of the videos you want to display (Rejected, or Approved).
- When displaying the videos rejected by Google, you can click on the green Approve button to revert the decision and recover the original rejected video.
- When displaying the videos approved by Google, you can click on the red Reject button to revert the decision and prevent a certain video from being publicly available to your users.
Overriding moderation via the Admin API
Alternatively to using the Media Library interface, you can use Cloudinary's Admin API to manually override the moderation result. The following example uses the update
API method while specifying a public ID of a moderated video and setting the moderation_status
parameter to the rejected
status.