Configuration¶
Moderator can read its initial configuration from a text file. By default it tries
to use /usr/local/antmedia/conf/moderator.conf
as a global file for all
applications, unless a more specific file is found with the name pattern
/usr/local/antmedia/conf/moderator-[lowercased application name].conf
.
If none of these configuration files exist, default settings will be used.
The location of the configuration file can be overridden using the JVM argument
-Dmoderator.config.file=/var/tmp/my.conf
which can be specified in the AMS service startup file.
The configuration file is parsed using TypeSafe Config library. The simplest syntax is treating the file as key=value pairs per line or key = [value1, value2] for lists.
Below is the list of configuration values parsed from the config file.
moderator.enabled
¶
Enables or disables the moderation functionality for the plugin.
Values: true
, false
Default: true
Example:
moderator.enabled = true
moderator.labels
¶
The list of moderation labels that should trigger the moderation action.
Values: Smoking
, see Amazon Rekognition documentation for the complete list
Default: no default
Example:
moderator.labels = [ "Smoking", "Alcohol" ]
moderator.frame.sampling.rate
¶
Defines how many frames to skip before processing one. For example, a value of 30 means every 30th frame will be processed, which helps reduce AWS costs while maintaining effective moderation.
Values: Positive integers (1, 2, 3, …)
Default: 30
Example:
moderator.frame.sampling.rate = 30
moderator.aws.region
¶
Specifies the AWS region where the Rekognition service is located.
Values: Valid AWS region identifiers
Default: us-east-1
Example:
moderator.aws.region = us-east-1
moderator.aws.access.key.id
¶
AWS access key ID for authentication with AWS services.
Values: Valid AWS access key ID string
moderator.aws.secret.access.key
¶
AWS secret access key for authentication with AWS services.
Values: Valid AWS secret access key string
moderator.confidence.threshold
¶
Minimum confidence threshold for moderation results. Results below this threshold will be considered unreliable and may be filtered out.
Values: Decimal numbers between 0.0 and 1.0
Default: 0.7
Example:
moderator.confidence.threshold = 0.8
moderator.stream.ids
¶
List of specific stream IDs to moderate. If empty, all streams will be moderated.
Values: List of stream ID strings or single stream ID string
Default: []
(empty list, which means all streams will be moderated)
Example:
# Single stream
moderator.stream.ids = stream123
# Multiple streams
moderator.stream.ids = ["stream123", "stream456", "stream789"]
moderator.action
¶
Action to take when moderation detects inappropriate content.
Values: String describing the action
Default: log
Example:
moderator.action = log
moderator.notify.webhook.url
¶
URL for webhook notifications when moderation events occur.
Values: Valid HTTP/HTTPS URL string or null
Default: null
Example:
moderator.notify.webhook.url = https://example.com/webhook/moderator
Payload:
{ "streamId": "myStream",
"image": "null or base64 encoded frame if moderator.notify.webhook.include.image is enabled",
"labels": [
{
"confidence": 20.9185,
"label": "Smoking"
}
],
}
moderator.notify.webhook.include.image
¶
Flag to indicate if the notification webhook payload should include a base64 encoded JPEG screenshot
Values: true
, false
Default: false
Example:
moderator.notify.webhook.include.image = true
moderator.capture.image
¶
Flag to indicate if the screenshot of the moderated stream should be saved to disk in JPEG format.
It is effective only if the moderation action is stop
. The directory where the file is
saved is controlled by moderator.capture.image.directory
Values: true
, false
Default: false
Example:
moderator.capture.image = true
moderator.capture.image.directory
¶
The directory where moderated screenshots are saved if moderator.capture.image
is enabled.
Created automatically if not existing.
Default: .
(ie. Ant Media Server installation directory)
Example:
moderator.capture.image.directory = /var/tmp/moderation