Embed & Extract Examples
Ready-to-send requests for caption embedding and extraction. For every field and option, see embed and extract.
Each request uses the API's usual headers: x-api-key and username (see Getting Started). Every example uses a JSON body, since media is always passed by URL or Storage Access Provider. Replace YOUR_API_KEY, you@example.com and the provider_ids with your own. Provider IDs come from Storage Access Providers in the web app; see Access Providers.
Embed and extract jobs are available through the API and the licensed CC Embed CLI. The Subtitle Converter web app converts sidecar caption files in the browser; it doesn't embed captions into video or extract them.
Before you start
- Media is read in place. Give a pre-signed HTTPS URL (S3, GCS, Azure SAS, Backblaze)
in
media_path, or name a Storage Access Provider inmedia_options. The media is never uploaded to us, so files of any size work. The URL must support Range requests and stay valid for the whole job: allow at least 24 hours for very large files. - Embed takes any caption format, in one job. MCC (608/708 captions) goes into any
supported container as it is, and EBU STL is sent as OP-47 teletext into 25 fps MXF only.
Any other format the converter reads (SRT, WebVTT, SCC, iTunes Timed Text, ...) is converted
in the same job, at the same price: to MCC, or to EBU STL when the media is MXF and you set
embed_options.teletext_page. Setsource_profilewhen the file's extension doesn't name its format. - Embed output goes to your storage, in a processing region. Every embed job needs
delivery_optionsnaming an S3 or GCS Storage Access Provider whose bucket is in a region we process in.GET /regionslists them. Azure, Backblaze B2 and S3-compatible destinations are refused. See Where Jobs Run. - No surprise egress on your media. An embed whose media is stored in another cloud or
region than its delivery bucket is refused with a
400, unless the job sets"allow_egress": true. When the media's location can't be verified, the job runs and the response carriesegress_warnings. - Billing: jobs need an active Closed Caption Converter subscription. Each embed or extract job costs $0.50. An extract that returns several channels (several files) is still one job at $0.50.
- Embed and extract jobs always run in the background. Poll
GET /jobs/{id}, or setwebhook.
1. Extract 608/708 captions to MCC (pre-signed URL)
curl -X POST https://api.closedcaptionconverter.com/jobs \
-H "x-api-key: YOUR_API_KEY" \
-H "username: you@example.com" \
-H "Content-Type: application/json" \
-d '{
"job_type": "extract",
"media_path": "https://your-bucket.s3.us-east-1.amazonaws.com/masters/episode01.mxf?X-Amz-Algorithm=...&X-Amz-Signature=...",
"webhook": "https://example.com/hooks/cc"
}'
Response (always queued):
{
"jobId": "1b0e6f1a-6a7e-4c1e-9d0b-3f5f7c2a9e11",
"id": "1b0e6f1a-6a7e-4c1e-9d0b-3f5f7c2a9e11",
"target": false,
"qcReport": false,
"qc_status": null,
"qc_errors": null,
"status": "queued",
"statusMsg": "Job enqueued for background processing. Poll GET /jobs/1b0e6f1a-6a7e-4c1e-9d0b-3f5f7c2a9e11 for results.",
"progress": 5,
"processing_region": "aws-us-east-1"
}
processing_region is where the job runs: next to the media for an extract, next to the
delivery bucket for an embed.
2. Extract and convert to SRT or SCC
Any target_profile other than MCC converts the extracted captions, with the same options as
a convert job.
curl -X POST https://api.closedcaptionconverter.com/jobs \
-H "x-api-key: YOUR_API_KEY" \
-H "username: you@example.com" \
-H "Content-Type: application/json" \
-d '{
"job_type": "extract",
"media_path": "https://storage.googleapis.com/your-bucket/episode01.mp4?X-Goog-Signature=...",
"target_profile": "SubRip Video Subtitle Script",
"extract_options": { "start_tc": "01:00:00:00" }
}'
For SCC, use "target_profile": "Scenarist V1.0". A GCS signed URL doesn't say which region
the bucket is in, so the response has egress_warnings; use media_options (example 4) to
let us check.
3. Extract OP-47 teletext subtitles from MXF to EBU STL
curl -X POST https://api.closedcaptionconverter.com/jobs \
-H "x-api-key: YOUR_API_KEY" \
-H "username: you@example.com" \
-H "Content-Type: application/json" \
-d '{
"job_type": "extract",
"media_path": "https://youraccount.blob.core.windows.net/masters/programme.mxf?sv=...&sig=...",
"extract_options": { "teletext_page": "801" }
}'
Without teletext_page, OP-47 is chosen when the file has no 608/708 captions.
4. Extract from a Storage Access Provider (no pre-signed URL)
curl -X POST https://api.closedcaptionconverter.com/jobs \
-H "x-api-key: YOUR_API_KEY" \
-H "username: you@example.com" \
-H "Content-Type: application/json" \
-d '{
"job_type": "extract",
"media_options": {
"provider_id": "YOUR_S3_PROVIDER_ID",
"provider_options": { "bucket": "your-bucket", "region": "us-east-1", "key": "masters/episode01.mov" }
}
}'
provider_options by provider: S3 bucket, region, key; GCS projectId, clientEmail, bucket, fileName; Azure container, blobName; Backblaze bucketName, fileName, endpoint, region.
5. Choose caption channels: 708 services 1 and 2 to SRT
extract_options.channels picks the channels to return, one file per channel. Names are
not case-sensitive: CC1–CC4 (608), service1–service6 (708) and teletext:NNN
(OP-47 pages).
curl -X POST https://api.closedcaptionconverter.com/jobs \
-H "x-api-key: YOUR_API_KEY" \
-H "username: you@example.com" \
-H "Content-Type: application/json" \
-d '{
"job_type": "extract",
"media_path": "https://your-bucket.s3.us-east-1.amazonaws.com/masters/episode01.mxf?X-Amz-Signature=...",
"target_profile": "subRip",
"extract_options": { "channels": ["service1", "service2"] },
"delivery_options": {
"provider_id": "YOUR_S3_PROVIDER_ID",
"provider_options": { "bucket": "your-bucket", "region": "us-east-1", "key": "captions/episode01.srt" }
}
}'
The job returns two files: targets in GET /jobs/{id} has one signed URL per channel
(see example 11). They are delivered as captions/episode01_service1.srt and
captions/episode01_service2.srt (without a key, <jobId>_service1.srt and so on). The
price is still $0.50.
6. 608 CC1 and CC3 from line 21 (D-10/IMX MXF)
carriage picks where captions are read when the media has them in more than one place:
auto (the default), anc, vc3, line21 (or line21_vbi), track or sei.
curl -X POST https://api.closedcaptionconverter.com/jobs \
-H "x-api-key: YOUR_API_KEY" \
-H "username: you@example.com" \
-H "Content-Type: application/json" \
-d '{
"job_type": "extract",
"media_path": "https://your-bucket.s3.us-east-1.amazonaws.com/masters/programme_imx50.mxf?X-Amz-Signature=...",
"target_profile": "scenerist",
"extract_options": { "channels": ["CC1", "CC3"], "carriage": "line21_vbi" }
}'
If CC3 has no captions, the job still passes with the CC1 file, channels_missing is
["CC3"], and warning says so. If none of the channels has captions, the job fails with
no_captions and isn't billed.
7. Every channel that has captions
curl -X POST https://api.closedcaptionconverter.com/jobs \
-H "x-api-key: YOUR_API_KEY" \
-H "username: you@example.com" \
-H "Content-Type: application/json" \
-d '{
"job_type": "extract",
"media_path": "https://your-bucket.s3.us-east-1.amazonaws.com/masters/episode01.mov?X-Amz-Signature=...",
"target_profile": "webVtt",
"extract_options": { "channels": "auto" }
}'
auto returns every CC1–CC4 and service1–service6 with captions. Services above 6 aren't
supported: they're listed in channels_unsupported. Without a target_profile, an
extract returns one MCC file, which holds every channel, and channels_found lists them.
For OP-47, list the pages: "channels": ["teletext:801", "teletext:888"] returns one EBU
STL (or converted file) per page.
8. Embed MCC captions into an MXF master, delivered to S3
The MCC can be a URL (as here) or a file upload (-F "source=@captions.mcc" -F 'config={...}').
curl -X POST https://api.closedcaptionconverter.com/jobs \
-H "x-api-key: YOUR_API_KEY" \
-H "username: you@example.com" \
-H "Content-Type: application/json" \
-d '{
"job_type": "embed",
"source": "https://your-bucket.s3.us-east-1.amazonaws.com/captions/episode01.mcc?X-Amz-Signature=...",
"source_profile": "macCaption",
"media_path": "https://your-bucket.s3.us-east-1.amazonaws.com/masters/episode01.mxf?X-Amz-Signature=...",
"embed_options": { "replace": true, "start_tc": "10:00:00:00" },
"delivery_options": {
"provider_id": "YOUR_S3_PROVIDER_ID",
"provider_options": { "bucket": "your-delivery-bucket", "region": "us-east-1", "key": "captioned/episode01.mxf" }
},
"webhook": "https://example.com/hooks/cc"
}'
The media and the delivery bucket are both in S3 us-east-1, so the job runs there and nothing is billed for egress.
9. Embed an SRT (or any caption format) in one job
The SRT is converted to MCC (608 CC1 and 708 service 1) as part of the embed: one job, one
charge. captionsConvertedFrom in GET /jobs/{id} records the conversion.
curl -X POST https://api.closedcaptionconverter.com/jobs \
-H "x-api-key: YOUR_API_KEY" \
-H "username: you@example.com" \
-H "Content-Type: application/json" \
-d '{
"job_type": "embed",
"source": "https://your-bucket.s3.us-east-1.amazonaws.com/captions/episode01.srt?X-Amz-Signature=...",
"source_profile": "subRip",
"media_path": "https://your-bucket.s3.us-east-1.amazonaws.com/masters/episode01.mp4?X-Amz-Signature=...",
"embed_options": { "verify": true },
"delivery_options": {
"provider_id": "YOUR_S3_PROVIDER_ID",
"provider_options": { "bucket": "your-delivery-bucket", "region": "us-east-1", "key": "captioned/episode01.mp4" }
}
}'
An iTunes Timed Text file works the same way: "source_profile": "iTunesTimedText" with an
.itt source. The convert options (source_frameRate, incode, offset,
decoding_options, ...) apply to the conversion. The captions keep their timecodes: if they
start at 00:00:00:00 and the media's timecode starts at 01:00:00:00, set
embed_options.start_tc to "00:00:00:00" or use offset.
When the job is done, GET /jobs/{id} includes:
{
"status": "passed",
"cost": 50,
"captionsConvertedFrom": { "profile": "subRip", "extension": "srt", "events": 812, "frameRate": 29.97, "dropFrame": true },
"deliveredTo": "s3://your-delivery-bucket/captioned/episode01.mp4"
}
A caption file of 2,000 or more captions is converted in the background before the embed starts; the job is queued either way.
10. Embed into MOV (caption track) and verify, delivered to GCS
verify re-reads the media and the delivered output after the upload, and fails the job
unless every original video and audio sample is unchanged. It roughly doubles the job time
and the read traffic on your storage. The captioned bucket must be a single-region GCS
bucket in a region from GET /regions, and the media bucket should be in the same region.
curl -X POST https://api.closedcaptionconverter.com/jobs \
-H "x-api-key: YOUR_API_KEY" \
-H "username: you@example.com" \
-H "Content-Type: application/json" \
-d '{
"job_type": "embed",
"source": "https://storage.googleapis.com/your-bucket/captions/promo.mcc?X-Goog-Signature=...",
"source_profile": "macCaption",
"media_options": {
"provider_id": "YOUR_GCS_PROVIDER_ID",
"provider_options": { "projectId": "your-project", "clientEmail": "sa@your-project.iam.gserviceaccount.com", "bucket": "masters", "fileName": "promo_prores.mov" }
},
"embed_options": { "carriage": "track", "verify": true },
"delivery_options": {
"provider_id": "YOUR_GCS_PROVIDER_ID",
"provider_options": { "projectId": "your-project", "clientEmail": "sa@your-project.iam.gserviceaccount.com", "bucket": "captioned", "fileName": "promo_prores_cc.mov" }
}
}'
11. Embed into H.264/HEVC MP4 as A/53 SEI, delivered to S3
curl -X POST https://api.closedcaptionconverter.com/jobs \
-H "x-api-key: YOUR_API_KEY" \
-H "username: you@example.com" \
-H "Content-Type: application/json" \
-d '{
"job_type": "embed",
"source": "https://your-bucket.s3.us-east-1.amazonaws.com/captions/ep01.mcc?X-Amz-Signature=...",
"source_profile": "macCaption",
"media_path": "https://your-bucket.s3.us-east-1.amazonaws.com/masters/ep01.mp4?X-Amz-Signature=...",
"embed_options": { "carriage": "sei", "replace": true },
"delivery_options": {
"provider_id": "YOUR_S3_PROVIDER_ID",
"provider_options": { "bucket": "your-delivery-bucket", "region": "us-east-1", "key": "captioned/ep01_cc.mp4" }
}
}'
MPEG-TS and PS work the same way (ep01.ts). Captions go in as A/53 SEI for H.264 and
HEVC, or as MPEG-2 user_data. carriage applies to MOV/MP4 only.
12. Embed OP-47 teletext subtitles (EBU STL) into an MXF master
The STL's subtitles go in as OP-47 teletext (RDD 8) in the MXF's ANC track, on page 801
unless teletext_page says otherwise. The STL must be 25 fps (STL25.01), and its
timecodes are taken as they are: no conforming. With replace, existing OP-47 packets are
replaced, while any 608/708 captions in the same ANC track stay.
curl -X POST https://api.closedcaptionconverter.com/jobs \
-H "x-api-key: YOUR_API_KEY" \
-H "username: you@example.com" \
-H "Content-Type: application/json" \
-d '{
"job_type": "embed",
"source": "https://your-bucket.s3.eu-west-1.amazonaws.com/subtitles/programme.stl?X-Amz-Signature=...",
"source_profile": "ebuStl",
"media_path": "https://your-bucket.s3.eu-west-1.amazonaws.com/masters/programme.mxf?X-Amz-Signature=...",
"embed_options": { "teletext_page": "801", "replace": true, "verify": true },
"delivery_options": {
"provider_id": "YOUR_S3_PROVIDER_ID",
"provider_options": { "bucket": "your-delivery-bucket", "region": "eu-west-1", "key": "subtitled/programme.mxf" }
}
}'
To embed OP-47 from an SRT or another format, send it with its source_profile and set
teletext_page: it is converted to a 25 fps EBU STL in the same job. Pricing is the same as
for any embed.
13. Media in another region: source_egress and allow_egress
An embed runs in the region of its delivery bucket. Here the media is in S3 eu-west-1 and the delivery bucket in S3 us-east-1, so reading the media would cost you egress:
curl -X POST https://api.closedcaptionconverter.com/jobs \
-H "x-api-key: YOUR_API_KEY" \
-H "username: you@example.com" \
-H "Content-Type: application/json" \
-d '{
"job_type": "embed",
"source": "https://your-bucket.s3.us-east-1.amazonaws.com/captions/episode01.mcc?X-Amz-Signature=...",
"source_profile": "macCaption",
"media_path": "https://your-eu-bucket.s3.eu-west-1.amazonaws.com/masters/episode01.mxf?X-Amz-Signature=...",
"delivery_options": {
"provider_id": "YOUR_S3_PROVIDER_ID",
"provider_options": { "bucket": "your-delivery-bucket", "region": "us-east-1", "key": "captioned/episode01.mxf" }
}
}'
The job is refused before it starts (source_egress), with 400 and a plain-text body:
Your media is in Amazon S3, eu-west-1, and this embed runs in Amazon S3, us-east-1 (N. Virginia), where its output is delivered. Reading the whole media file from there would incur egress charges from your storage provider, about the file's size. Store the media in Amazon S3, us-east-1 (N. Virginia), or set "allow_egress": true on the job to accept those charges.
Either deliver to a bucket in the media's region, or add "allow_egress": true to accept the
egress charges from your storage provider. The job then runs, and the response warns:
{
"status": "queued",
"processing_region": "aws-us-east-1",
"egress_warnings": [
"allow_egress is set: your storage provider may charge egress for reading the media from Amazon S3, eu-west-1 into Amazon S3, us-east-1 (N. Virginia)."
]
}
allow_egress never lets an embed's output leave its region. A delivery bucket outside every
processing region is refused (delivery_region) whatever the job sets.
processing_region chooses where an extract runs, such as "processing_region": "aws-eu-west-1". For an embed it can only be the delivery region or "auto". GET /regions (no authentication) lists the region IDs:
curl https://api.closedcaptionconverter.com/regions
14. Check a job
curl https://api.closedcaptionconverter.com/jobs/JOB_ID \
-H "x-api-key: YOUR_API_KEY" \
-H "username: you@example.com"
While it runs, statusMsg shows the stage ("Preflight: checking the media and
captions...", "Processing (write): 42.0%", "Verifying the output..."). When it's done:
{
"status": "passed",
"progress": 100,
"statusMsg": "Job completed successfully",
"cost": 50,
"outputBytes": 12400000000,
"deliveredTo": "s3://your-delivery-bucket/captioned/episode01.mxf",
"processingRegion": "aws-us-east-1",
"ccEmbedVersion": "cc-embed 0.2.0",
"ccEmbedSummary": "{...}",
"target": false
}
cost is in cents. For an extract, target is a signed download URL for the MCC or STL file
(or the converted file). Add delivery_options to an extract to also deliver that file to your
storage; deliveredTo then says where.
An extract with extract_options.channels (example 5) returns one URL per file in targets
(target is the first), and what was found:
{
"status": "passed",
"cost": 50,
"target": "https://storage.googleapis.com/...",
"targets": [
{ "channel": "service1", "format": "subRip", "extension": "srt", "url": "https://storage.googleapis.com/..." },
{ "channel": "service2", "format": "subRip", "extension": "srt", "url": "https://storage.googleapis.com/..." }
],
"channels": ["service1", "service2"],
"channels_found": ["CC1", "service1", "service2"],
"channels_missing": [],
"channels_unsupported": [],
"channel_inventory": [
{ "id": "CC1", "standard": "608", "characters": 18342, "first_timecode": "01:00:00:12", "last_timecode": "01:58:41:03" },
{ "id": "service1", "standard": "708", "characters": 18342, "first_timecode": "01:00:00:12", "last_timecode": "01:58:41:03", "language": "eng" },
{ "id": "service2", "standard": "708", "characters": 17950, "first_timecode": "01:00:00:12", "last_timecode": "01:58:40:21", "language": "spa" }
]
}
A native MCC (no target_profile) has one target, with "channel": null.
15. Cancel a job
DELETE /jobs/{id} stops a running embed or extract and aborts its upload, so no partial
file is left in your storage. The response includes "cancelled": true. Cancelled jobs are
not billed.
curl -X DELETE https://api.closedcaptionconverter.com/jobs/JOB_ID \
-H "x-api-key: YOUR_API_KEY" \
-H "username: you@example.com"
Webhooks
webhook (a public HTTPS URL) gets a POST when the job finishes.
Passed:
{ "jobId": "1b0e6f1a-...", "status": "passed", "progress": 100, "statusMsg": "Job completed successfully", "cost": 50, "finalized": true, "completedOn": { "_seconds": 1793000000, "_nanoseconds": 0 } }
An extract with channels adds "targets": 2, "channels": ["service1", "service2"]: the
number of files and their channels. Fetch GET /jobs/{id} for the download URLs.
Failed:
{
"jobId": "1b0e6f1a-...",
"status": "failed",
"progress": 100,
"statusMsg": "Job failed with message: [cc-embed no_captions (exit 6): ...]",
"error": "Job failed with message: [cc-embed no_captions (exit 6): ...]",
"ccEmbedError": { "code": "no_captions", "exit_code": 6, "message": "...", "causes": ["..."] }
}
Errors
POST /jobs refuses a job before it starts, with a plain-text body:
| HTTP | When |
|---|---|
| 400 | No media_path or media_options. A media provider that isn't S3/GCS/Azure/Backblaze. An embed without a storage delivery_options.provider_id. An embed without exactly one caption file, or whose caption file can't be converted (it doesn't decode as its source_profile, or has no captions), or declares MCC/EBU STL and is the other. An STL that isn't 25 fps. An STL with non-MXF media. A teletext_page outside 100–8FF. An unknown name in extract_options.channels, a service above 6, teletext pages mixed with 608/708 channels, or an unknown carriage. |
| 400 | Where the job would run: an embed delivery bucket outside every processing region, or whose location can't be read (delivery_region); embed media in another region without allow_egress (source_egress); a processing_region that isn't the embed's delivery region (region_conflict) or isn't a region at all (unknown_region). |
| 402 | No billing account, or no active Closed Caption Converter subscription. |
| 503 | Embed/extract isn't enabled for this account yet. |
A job that starts but then fails has status: "failed", and ccEmbedError.code says why:
code | Meaning | Billed |
|---|---|---|
io | The media URL couldn't be read: expired, 404, permission denied, or no Range support | No |
unsupported_container | Not MOV/MP4, MXF or MPEG-TS/PS | No |
unsupported | A container feature not supported yet (e.g. fragmented MP4, clip-wrapped VC-3), or OP-47 into video that isn't 25 fps | No |
no_captions | Extract: no 608/708 or OP-47 in the file, or none of the selected channels has captions. Embed: no caption data in the video's timecode range | No |
corrupt_input | The media or the caption file is damaged | No |
usage | Embed: the file already has captions and replace isn't set | No |
op47_needs_mxf | Embed preflight: an EBU STL source with media that isn't MXF | No |
captions_out_of_range | Embed preflight: every caption is before the video's first frame. Set embed_options.start_tc | No |
delivery_unwritable | Embed preflight: the delivery provider refused a test upload (credentials, bucket, permissions) | No |
internal | With verify: the output didn't match the media. Otherwise a bug: please report the job ID | No |
Failed jobs are never billed. The preflight checks run before any output is written, so these failures cost no transfer.