Audio and video moderation

AudioPreview · VideoPreview

Audio and video uploads always return with classification.moderation.decision null and run in the background, including when wait=true. Retrieve the asset or receive the decision through a webhook, as described in Waiting for the decision.

Coverage and limits

Each upload is analysed the same way, whatever your policy: CalmLens scores each group of video frames (including visible text) and the speech transcript for categories and qualifiers, and assesses how the whole clip frames what they show. Each 30-second section is also listened to for sexual sounds, and an audio upload with no speech is listened to for every category. Stretches with no audible sound aren't listened to.

  • Before billing is set up, audio and video uploads can be up to 50 MiB and 120 seconds. Once billing is set up, they can be up to 30 minutes, and files over 50 MiB, up to 2 GiB, are sent as a multipart upload. An upload in one request stays at 50 MiB, and a remote URL import at 20 MiB. Media longer than 120 seconds is analysed in sections.
  • An upload whose file states it is over the limit is refused with 422 media/duration-limit: no asset is created and it doesn't use a free upload. CalmLens reads the duration from MP4, MOV, M4A, WebM, Matroska, WAV and FLAC files, and from MP3 files with a Xing, Info or VBRI header. Other files, and files that don't state one, are accepted and fail with duration-limit once processing measures them.
  • Media has one audio track, of at most eight channels, and one video track. Video resolution is at most 8,847,360 pixels (4096 × 2160).
  • Subtitle tracks are moderated as text, every cue of every track, and billed as text moderation. Subtitles drawn as pictures (such as DVD or Blu-ray subtitles) and closed captions carried inside the video stream can't be read, so media with them fails with unsupported-format.
  • Pictures embedded in the file, such as album or cover art, are moderated as images, each distinct picture once, and billed as image moderation, one for each group of up to eight. Media with more than 16 distinct pictures fails with too-many-items.
  • Media is analysed to the end of its longest track, whatever duration its file declares, and the browser-safe file CalmLens makes from it is no longer than what was analysed.
  • Video is sampled once per second. Sampled frames that show something new are judged in groups of up to eight consecutive frames, and their moderation also reads visible text. How the whole clip frames what they show, such as news reporting, fiction or education, is then judged once from up to eight frames spread across the clip and its speech transcript. A frame that shows nothing new, in brightness or colour, since the previous one isn't analysed again.
  • Every frame of a video is checked for scenes too brief to be sampled, such as a flash between samples or a quick cut. A frame of each one is judged as well, in groups of up to eight frames. Video with more of these scenes than it has seconds fails with too-many-items.
  • Audio is mixed to one channel for analysis, unless mixing would lose a channel's content, as with channels in opposite phase or carrying different sounds. Each channel of that stretch of the media is then analysed and transcribed on its own.
  • Sexual sounds are found from longer stretches of sound: a single sound lasting a few seconds can be missed. A clip that has them scores in Sexual with no qualifier scores, because sound alone shows no context.
  • Small text, ambiguous sounds and changes too gradual to start a new scene can be missed. Context spanning different evidence ranges may also be missed. Whether flashing or strobing could trigger seizures in people with photosensitive epilepsy isn't assessed; check for it yourself if your users can upload such video.
  • Evidence locations are approximate ranges, not word-level timestamps. Scores are not probabilities of correctness; see Reading classification results.
  • Unsupported, corrupt or over-limit media, or a failure to complete analysis, ends with classification.status failed. Unsupported, corrupt and over-limit media fail without retrying, and classification.failureReason says why (see Failure reasons); temporary failures are retried automatically first. A partial result never approves the asset, and media that fails isn't billed. Follow Recover from processing failure before retrying or replacing it.

Long audio and video

Long audio and videoPreview

With billing set up, media longer than 120 seconds is analysed in sections of 30 seconds, each starting one second before the previous one ends, with the same analysis a shorter upload gets. The speech transcript is moderated once for the whole media, and how the media frames what it shows is judged across all of it.

While sections run, classification.status is processing and classification.progress reports completedSections of totalSections; it is null for other assets and once analysis ends. The asset.progress-updated event reports the same numbers every tenth of the sections or 30 seconds, whichever comes first. The decision follows, with its usual event, once every section is done.

A section the media processor rejects, such as one it can't decode, fails the whole asset with its reason in classification.failureReason. Other failures are retried automatically, and a section that still can't be analysed fails the asset with processing-error. Usage limits lists how much long media each organisation can analyse at once and each day, and how spend limits apply.

Findings timeline

Findings timelinePreview

A decided audio or video asset has a findings timeline: segments that each give the scores for one stretch of the media. classification.moderation.timeline.segmentCount says how many there are, and GET /projects/:projectId/assets/:assetId/timeline (client.assets.listTimeline({ assetId })) pages through all of them in time order. classification.moderation.timeline is null for other assets and before there are findings.

for await (const segment of client.assets.listTimeline({ assetId, pageSize: 100 })) {
  console.log(segment.source, segment.startSeconds, segment.endSeconds);
}
sourceCovers
clipA section's sounds: sexual sounds, or what audio with no speech holds.
frameOne group of up to eight frames that show something new, extended over the following samples that show nothing new, or a group of frames from scenes too brief to be sampled.
speechThe whole speech transcript.
frame-textThe media's subtitles, across the whole media, and a project's test phrases read from frames.

Start and end times are in seconds from the start of the media and locate evidence approximately. The timeline is replaced when the asset is analysed again, kept when its content is removed, and deleted with the asset. While a safety hold is on, the endpoint returns 423 asset/held, and while a copyright hold is on, it lists nothing. The portal shows the same segments in the asset's analysis timeline.

Reports, retention and usage

The transcript is available as content.extractedText when the upload sets processingOptions.retainContent. Purging removes retained originals and transcripts, subject to safety holds. Analysis samples are not available as child assets.

Billing covers image moderation for each group of up to eight sampled frames that show something new or frames from brief scenes, plus one for the media's framing when its frames or speech find something whose framing your policy reads; text moderation for listening to each section of up to 30 seconds, with a minimum of 250 tokens per section; and text moderation for the speech transcript of each channel analysed. Sections with no audible sound aren't listened to or billed for it. The cost per hour depends on how often the picture changes. Frames are not charged for OCR.

Long media is billed once, when every section is done. Media that fails isn't billed.

See Pricing for rates and free allowances.

Tested audio formats include WAV, MP3, FLAC, AAC, M4A (AAC/ALAC), Ogg/Vorbis, Opus, AIFF and WMA. Tested video formats include MP4 with H.264/HEVC, MOV with H.264, WebM with VP8/VP9/AV1, Matroska, AVI, MPEG, MPEG-TS and WMV. Upload with the appropriate concrete audio/* or video/* MIME type; changing a filename or MIME type cannot make an unsupported codec decodable.

Show audio and video in your app

Browser-safe media, posters and waveformsPreview

After moderation finishes for an audio or video asset whose content is kept, CalmLens prepares a browser-safe file at rendered and a still image at preview. SDK decision waiters such as waitForDecision() can return while this work is still running. Subscribe to asset.media-ready to find out when the file and preview are ready, then retrieve the asset for their delivery metadata and any audio peaks. The asset’s moderation and delivery settings still apply. Adaptive HLS has its own readiness status.

Typerenderedpreview
VideoMP4 with H.264 video and AAC audio, scaled down to fit 1080p. An upload that is already H.264 and AAC in MP4 or QuickTime, up to 1080p, is served as uploaded.A poster: the frame on screen one second in, as moderation sampled it, or the first frame of shorter video.
AudioAAC in M4A. MP3, AAC, M4A and Opus in Ogg uploads are served as uploaded.A waveform image.

content.rendered and content.preview are null until they are made. content.rendered.kind is video or audio, and audio's content.rendered.peaks holds up to 512 loudness peaks from 0 to 1, evenly spaced over the audio, so you can draw your own waveform and its progress. The rendered file answers Range requests, so players can seek; the original stays available at original. The preview takes lenses and transforms like any image, and its thumbhash and averageColor make a placeholder while the player loads. See What the CDN serves for every asset type.

For a private asset, sign its asset URL on your server and send it to the browser; the rendered file and the preview are paths beneath it:

// One signed asset URL covers every resource beneath it: the displayable file, such as
// browser-safe video, and the still image that stands for it.
const { url } = await client.cdn.signAssetUrl({ assetId, expiresIn: 900 });
const rendered = `${url}/rendered`;
const preview = `${url}/preview`;
console.log(rendered, preview);

Then use the rendered URL as a <video> or <audio> source and the preview as the video's poster. The JavaScript SDK's asset component does this for you: it plays video with its poster and audio under its waveform, and fetches a fresh signed asset URL from your server when the one in use expires.

To adapt playback to each viewer's connection, or to embed media in other sites, turn on streaming: CalmLens then also prepares an adaptive HLS stream from the browser-safe file, and serves an embed page for iframes.

Animated images

Animated GIF, WebP and PNG (APNG) images, and AVIF and HEIF image sequences, are uploaded as images, and their frames are moderated like video frames. An animated PNG is moderated as an animation whatever its MIME type, even when it has only a single frame. The image itself, its still, is moderated as an image; the first frame is moderated again when it shows something else, such as a PNG's default image that isn't part of its animation, or a sequence's first track that differs from its still. Every track of an image sequence is moderated.

Every frame of an animation that shows something new, in brightness or colour, is judged when there are up to 120 of them. A longer animation is moderated by what it shows at every half second of display time, which includes every frame shown for half a second or more, and by a frame of each scene too brief to be on screen at one of those moments; frame delays of 10 ms or less count as 100 ms, as browsers show them. An animation that needs more than 120 frames this way is too large to sample. Frames are judged in groups of up to eight. Each frame judged is also checked for your project's test images. Processing features, such as OCR and link detection, and hash matching use the still only.

The image's decision covers every frame it judged, and its report merges their findings. Animations too large to sample, such as those whose frames hold more than 400 million pixels in all or that need more than 120 frames judged, fail with classification.status failed.

Last updated

Cookies on CalmLens

We use essential cookies for sign-in and security. With your permission, functional cookies remember your preferences and Google Analytics measures website use and signups. Optional ad measurement cookies link Google ad clicks to signups. Personalised advertising stays off. Manage cookies