Audio Silence Analysis
If you want to ensure that your audio content has no extended periods of silence, then this is the analysis type you’ll want to use. You may also be interested in detecting black video, which you can learn more about here: Black Video Analysis
Our API Docs list all options, but here is a summary:
duration_sec
- minimum:
1
, maximum:3600
, default:10
- Black video must exceed this duration for triggering detection.
- minimum:
noise_db
- The audio level must be above this value for being detected as a true audio signal.
- minimum:
-90
, default:-60
Sample Usage
The sample json below is set to detect audio silence with
{
"uid": "analyze_task",
"kind": "analyze",
"payload": {
"general_properties": {
"enabled": true
},
"deep_properties": {
"audio": {
"silence": {
"enabled": true,
"is_optional": true,
"noise_db": -60,
"duration_sec": 1
}
}
}
}
}
Analyzer Results
NOTE: In Hybrik version 1.217, we introduced a change to the structure of the analyzer results that have timed events. The new result version can be activated by setting "response_version": 2
in your analyzer's options. The default version will become version 2 in a future release.
{
"uid": "analyze_task",
"kind": "analyze",
"payload": {
"options": {
"response_version": 2
},
...
}
Results from running this analysis on a file with black sections will be reported in the job summary json, in the “analyzer / deep_properties” section of the job result:
"audio": [
{
"silence": {
"settings": {
"enabled": true,
"noise_db": "-60dB",
"duration_sec": 1
},
"response_version": 2,
"events": [
{
"begin": 2.8187,
"end": 3.84,
"duration": 1.0213
},
{
"begin": 6.1467,
"end": 8.192,
"duration": 2.0453
},
{
"begin": 13.3787,
"end": 14.4427,
"duration": 1.064
},
{
"begin": 16.7493,
"end": 18.7947,
"duration": 2.0453
},
{
"begin": 36.632,
"end": 37.6747,
"duration": 1.0427
},
{
"begin": 39.9813,
"end": 43.0293,
"duration": 3.048
}
],
"total_sec": 10.2666,
"max_sec": 3.048,
"leading_sec": 0,
"trailing_sec": 0
}
}
]
Here are the explanations for each result parameter:
Parameter Name | Type | Description |
---|---|---|
leading_sec | number | This is the duration in seconds of silence at the start of the media file. This will only report silence that exceeds the “duration_sec” in settings. |
trailing_sec | number | This is the duration in seconds of silence at the end of the media file. This will only report black that exceeds the “duration_sec” in settings. This value will appear even if the event array is capped before it reaches the end of the media. |
max_sec | number | This is the duration in seconds of the detected silence listed in “events” with the longest duration. |
total_sec | number | This is the sum of all detected silence durations in seconds. |
events | array | “silence” has turned from an array to an object to support the additional parameters, and this array is where the previous contents of the “silence” array will go. |
max_events_exceeeded | boolean | This parameter will be true if the size of the “events” array exceeds the maximum value for reporting. 100 events |
settings | object | This contains all of the parameters that were used to configure the silence detection analyzer. |
QC Task
These results can be used in a QC condition, for example “does this audio file have any periord of silence that is 5 seconds or more?” which would look like this:
{
"uid": "qc_task",
"kind": "qc",
"task": {
"retry_method": "fail"
},
"payload": {
"tests": [
{
"conditions": [
{
"condition": "deep_properties.audio[0].silence.events.size() == 0 || deep_properties.audio[0].silence.max_sec <= 5",
"message_pass": "PASS: Longest audio silence is shorter than 5 seconds.",
"message_fail": "FAIL: At least one audio silence is longer than or equal to 5 seconds: {deep_properties.audio[0].silence.max_sec}"
}
]
}
]
}
}
For more details on the QC task and other checks you can make, see our Analyze and QC Tutorial.