Subtitle Detection
Module Description
The Subtitle Detection module detects the appearance of burned-in subtitles, its position, language and the actual text content of the subtitle.
Module ID: subtitle_detection
Module Parameters
Name | Type | Default | Description |
---|---|---|---|
text_similarity_threshold | number | 0.05 | Threshold to compare texts of two frames, decreasing this value results in obtaining text duplicates. |
text_region_buffer_threshold | number | 0.85 | Threshold to extract the text outside the text intensive region. |
dump_heatmap | boolean | false | Dump a heatmap of all subtitles as an artifact. |
Example
Send the following JSON as request body via POST to the /jobs/
endpoint:
{
"sources": [
"{url-to-your-video}"
],
"modules": {
"subtitle_detection": {
"dump_heatmap": true
}
}
}
When requesting the job via GET on the /jobs/{JOB_ID}/
endpoint, the response looks like this:
{
"id":"4b4334de-120c-445b-a241-0d4d935f0c16",
"tag":"",
"state":"completed",
"sources":[
"https://www.youtube.com/watch?v=CKt-CtirxE0"
],
"modules":{
"subtitle_detection":{
"text_similarity_threshold":0.85,
"text_region_buffer_threshold":0.05,
"dump_heatmap":true,
"state":"completed",
"progress":1
}
},
"errors":[],
"progress":1.0,
"duration":88.71,
"time_created":"2023-08-04 10:10:27.037000",
"time_started":"2023-08-04 10:13:56.758000",
"time_completed":"2023-08-04 10:15:25.468000",
"media_type":"video",
"result":{
"summary":[
{
"source":"https://www.youtube.com/watch?v=CKt-CtirxE0",
"media_type":"video",
"info":{
"fps":29.97002997002997,
"resolution":[
1920,
1080
],
"total_frames":1031,
"duration":35.55172413793103
},
"items":[
{
"type":"language",
"label":"english",
"module":"subtitle_detection"
}
]
}
],
"detailed_link":"https://api.deepva.com/api/v2/jobs/4b4334de-120c-445b-a241-0d4d935f0c16/detailed-results/",
"summarized_link":"https://api.deepva.com/api/v2/jobs/4b4334de-120c-445b-a241-0d4d935f0c16/summarized-results/"
}
}
The above response tells you the state of the job.
In order to get the subtitle segments with its meta-data you can request the /jobs/{JOB_ID}/detailed-results/
endpoint, the response looks like this:
{
"total":8,
"offset":0,
"limit":100,
"next":null,
"prev":null,
"data":[
{
"id":"2b321c87-0c77-4e45-aa39-10be7add9456",
"media_type":"video",
"frame_start":90,
"frame_end":90,
"source":"https://www.youtube.com/watch?v=CKt-CtirxE0",
"module":"subtitle_detection",
"meta":{
"boxes":[
[
[
492.0,
678.0
],
[
805.0,
678.0
],
[
805.0,
709.0
],
[
492.0,
709.0
]
]
],
"texts":[
"By A Brilliant Filmmaker"
],
"scores":[
0.9871765971183777
],
"language":"english"
},
"thumbnail":null,
"detections":[],
"time_start":3.0,
"time_end":3.0,
"tc_start":"00:00:03:00",
"tc_end":"00:00:03:00"
}
]
}
Since the parameter dump_heatmap
was set to true
, you can download the heatmap as an artifact. Request the /jobs/{JOB_ID}/artifacts/
endpoint, the response is an image which looks like this: