Products

SIGN UPLOG IN

Video Moderation / Livestream Moderation

Live stream and Live video Moderation

Introduction

If your application or site supports live streaming, you will probably want to monitor and moderate in real-time the content that is being streamed.

This is possible with Sightengine's Live streaming Moderation API. The Moderation API is entirely automated — which makes it very fast and scalable — and it is completely customizable, so that you can define your own moderation rules.

Here are the steps to moderate live streams:

  1. Your back-end submits a live stream to the Sightengine API
  2. Sightengine analyzes the live stream, and creates alerts each time unwanted content is detected
  3. Your back-end receives callbacks (a.k.a. webhooks) to inform you of any unwanted content. You can also poll Sightengine to ask for status updates, moderation progress and results

Get API access credentials

The Sightengine API uses a key pair that consists of an API user id and an API secret for authentication. To get your own API credentials, create an account and go the the API key page to retrieve them.

Pick your Moderation Models

Sightengine has a long list of moderation models that you can pick and choose from. A model is a video recognition engine that has been designed to spot certain types of unwanted content.

Here are our most popular models for live stream moderation:

nudity-2.1

Detect all types of nudity and sexual content. Pornography, X-rated nudity, partial nudity, suggestive scenes and poses, lingerie... More

violence

Detect physical violence, threats and more More

offensive

Detect offensive and hateful signs, symbols, flags and gestures. More

weapon

Detect weapons, firearms and threatening knives More

face-attributes

Detect faces along with their main attributes: gender, age...

gore-2.0

Detect horrific imagery including scenes with blood, wounds, self-harm, guts... More

recreational_drug

Detect recreational and medical drugs More

alcohol

Detect wine, beer, cocktails, spirits. More

gambling

Detect gambling, casinos, slot machines... More

tobacco

Detect smoking and tobacco products More

money

Detect displays of money and banknotes More

self-harm

Detect self-harm More

The full list of models along with details is available in the Model Reference.

Submit a Live Stream to Sightengine

Once a live stream has started, you need to send the URL of your live-stream to the Sightengine API along with your list of moderation models.

Sightengine supports the following protocols for live video ingestion:

  • HLS also known as HTTP Live streaming, over HTTPS or HTTP
  • RTMP and RTMPS, Real-Time Messaging Protocol
  • RTSP and RTP, Real Time Streaming Protocol
  • MPEG-DASH MPEG Dynamic Adaptive Streaming over HTTP

Send it through a GET request to Sightengine, along with the list of models.


curl -X GET -G 'https://api.sightengine.com/1.0/video/check.json' \
    --data-urlencode 'stream_url=https://yourvideo/path' \
    -d 'models=nudity-2.1' \
    -d 'callback_url=https://your.callback.url/path' \
    -d 'api_user={api_user}' \
    -d 'api_secret={api_secret}'


# if you haven't already, install the SDK with 'pip install sightengine'
from sightengine.client import SightengineClient
client = SightengineClient('{api_user}','{api_secret}')
output = client.check('nudity-2.1').video('https://yourvideo/path', 'https://your.callback.url/path')


// if you haven't already, install the SDK with 'composer require sightengine/client-php'
use \Sightengine\SightengineClient;
$client = new SightengineClient('{api_user}','{api_secret}');
$output = $client->check(['nudity-2.1'])->video('https://yourvideo/path', 'https://your.callback.url/path');


// if you haven't already, install the SDK with 'npm install sightengine --save'
var sightengine = require('sightengine')('{api_user}', '{api_secret}');
sightengine.check(['nudity-2.1']).video('https://yourvideo/path', 'https://your.callback.url/path').then(function(result) {
    // The API response (result)
}).catch(function(err) {
    // Handle error
});

The JSON response contains the media id for your stream. The media id is a string that starts with med_

            
            
{
    "status": "success",
    "request": {
        "id": "req_1ML249NoEZ8j12op9Lipg",
        "timestamp": 1508774201.3177
    },
    "media": {
        "id": "med_1ML2wKmVgucuNPBN6xT33",
        "uri": "https://yourvideo/path"
    },
    "callback": "https://yourcallback/path"
}
            
        

In the above example, med_1ML2wKmVgucuNPBN6xT33 is the media id you should store to monitor the progress of this moderation job.

Next steps

Once Sightengine starts analyzing a live stream, you can retrieve moderation results in realtime through two separate channels: either through callbacks (this is the recommended approach as it is more efficient and faster) or by polling the API.

Was this page helpful?