Skip to main content

CC Embed CLI

cc-embed is a command-line tool that extracts closed captions from video files and embeds them back without re-encoding. It reads and writes CEA-608/708 captions and OP-47 teletext subtitles in MOV, MP4, MXF, and MPEG-TS/PS, and only the caption data changes: every original picture and sound byte is copied as it is.

It is the same engine that runs the API's embed and extract jobs, packaged as a single binary for Windows, macOS, and Linux. Use it where media can't leave your network, or to embed and extract on your own machines in bulk.

Licensed

The CC Embed CLI is licensed separately from the Closed Caption Converter subscription and the ccconverter CLI. Contact sales for a license and the download.

What It Reads and Writes​

Containerextract readsembed writes
MOV / MP4A QuickTime caption track (c608/c708), or A/53 SEI in H.264/HEVC videoA QuickTime caption track (default), or A/53 SEI with --carriage sei
MXF (OP1a, frame-wrapped)ST 436 ANC (608/708 and OP-47), VC-3 (DNxHD) frame header ANC, or line 21 in D-10 (IMX) picturesAn ST 436 ANC track: 608/708 from MCC, OP-47 teletext from EBU STL, or both
MPEG-TS / MPEG-PSA/53 SEI (H.264/HEVC) or MPEG-2 user dataA/53 SEI (H.264/HEVC) or MPEG-2 user data in every picture

Caption files are MCC (608/708) and EBU STL (OP-47 teletext, 25 fps, MXF only).

Other caption formats

cc-embed embed takes MCC or EBU STL. To embed an SRT, SCC, WebVTT, iTT, or any other format, convert it to MCC (macCaption) or EBU STL (ebuStl) first with the ccconverter CLI or the API. An API embed job does that conversion for you, in the same job.

Likewise, cc-embed extract writes one MCC with every 608 channel and 708 service in it. Splitting channels into separate SRT, WebVTT, or SCC files is an API feature (extract_options.channels), or convert the MCC once per channel with ccconverter.

Installation​

The CLI is a single executable, cc-embed (cc-embed.exe on Windows), with no dependencies. On macOS and Linux, make it executable and optionally move it to a directory on your PATH:

chmod +x cc-embed
mv cc-embed /usr/local/bin/cc-embed

Check the version and your license:

cc-embed --version
cc-embed 0.2.0 (Licensed to Your Company, expires 2027-06-30)

After the expiry date every command exits with code 9 (license_expired). --help and --version still work. Contact sales to renew.

Every command takes a local file. The Linux build also accepts an http:// or https:// URL, such as a pre-signed S3 or GCS URL, wherever it takes an input file. The file is read in place with Range requests, and nothing is copied. Redirects aren't followed, so pass the final URL. A URL's query string (a pre-signed URL's signature) is left out of every message and summary.

Commands​

CommandWhat it does
probeIdentifies the container and where captions are carried.
extractExtracts 608/708 captions to MCC, or OP-47 teletext subtitles to EBU STL.
embedAdds captions from an MCC or EBU STL file, without re-encoding.
conformRe-times an MCC file to another frame rate.
verifyChecks that an embed output preserves its input.

Run cc-embed <command> --help for every flag.

probe​

cc-embed probe master.mxf
cc-embed probe episode01.mp4 --json

Prints the container, the video's frame rate and start timecode, and every caption carriage found. Use it before an extract to see where the captions are, or before an embed to see whether the file already has captions.

extract​

cc-embed extract master.mov -o master.mcc
cc-embed extract master.mxf --teletext-page 801 -o master.stl
cc-embed extract programme_imx50.mxf --carriage line21 -o programme.mcc
cc-embed extract input.mov --start-tc "00:59:50;00" --json
FlagDescription
-o, --output <PATH>The output file. Default: the input with .mcc, or .stl for OP-47.
--start-tc <TIMECODE>The timecode of the first video frame, overriding the file's own. HH:MM:SS:FF, or HH:MM:SS;FF for drop frame.
--teletext-page <PAGE>Extract this OP-47 page (such as 801) to EBU STL, even when 608/708 captions are present. Without it, OP-47 is extracted only when the file has no 608/708 captions. MXF only.
--carriage <CARRIAGE>Where to read when the file carries captions in more than one place: auto (default), anc, vc3, line21, track, or sei.
--jsonPrint a JSON summary on stdout.
--progress jsonReport progress on stderr as newline-delimited JSON events.

The MCC holds every 608 channel and 708 service in the file; the summary's channels lists those with captions.

If the media is damaged or truncated after some captions were read, extract keeps the captions read before the damage, exits 0, and sets "salvaged": true in the summary. Check it and warn that the captions may be incomplete. A failed extract never leaves a partial file.

embed​

cc-embed embed master.mov --captions subs.mcc -o out.mov --verify          # caption track
cc-embed embed master.mp4 --captions subs.mcc -o out.mp4 --carriage sei # A/53 SEI
cc-embed embed master.mxf --captions subs.mcc -o out.mxf # ST 436 ANC
cc-embed embed master.ts --captions subs.mcc -o out.ts --replace # SEI / user data
cc-embed embed master.mxf --captions subs.stl -o out.mxf # OP-47 teletext
FlagDescription
--captions <MCC|STL>The captions: an MCC file at any frame rate, conformed to the video, or a 25 fps EBU STL file for OP-47 (MXF only). The STL is recognised by its content, whatever its extension. Required.
-o, --output <PATH>The output file. Required, and must not be the input. - writes to stdout (the JSON summary then goes to stderr, and --verify isn't allowed).
--replaceReplace the file's existing captions. Without it, a file that already has captions is refused with usage (2). For OP-47, only teletext is replaced: 608/708 captions in the same ANC track stay.
--carriage <track|sei>MOV/MP4 only. track (default) adds a QuickTime caption track; sei inserts A/53 SEI into every H.264/HEVC access unit.
--start-tc <TIMECODE>The timecode of the first video frame, which the captions are aligned to. Default: the file's own start timecode, else 00:00:00:00. Captions before it are dropped.
--source-rate <RATE>MCC only. The MCC's frame rate, when its data doesn't say (23.976 vs 24).
--teletext-page <PAGE>OP-47 only. The teletext page, 100 to 8FF. Default: 801.
--verifyAfter writing, compare every original sample with the output (reads both files in full). A mismatch exits 1 and leaves no output.
--jsonPrint a JSON summary.
--progress jsonReport progress on stderr as newline-delimited JSON events.

The output is written to a temporary file and renamed at the end, so a failed run leaves nothing behind. OP-47 needs 25 fps video, and the STL's timecodes are used as they are.

embed also takes an HLS master or media playlist (.m3u8) of MPEG-TS segments on disk. -o is then an output folder, and the master playlist gets a CLOSED-CAPTIONS rendition for CC1 (--cc-name, default English; --cc-language, default en).

conform​

cc-embed conform subs.mcc --rate 25 -o subs_25.mcc
cc-embed conform subs.mcc --rate 59.94 --json

Re-times an MCC file to another frame rate. Every 608 pair and the 708 byte stream stay in order; only how they are packed into frames changes. embed does this automatically, so conform is for delivering an MCC at a particular rate.

FlagDescription
--rate <RATE>The target frame rate: 23.976, 24, 25, 29.97, 30, 50, 59.94, or 60. Required.
-o, --output <PATH>The output MCC. Default: the input with the rate added, such as subs.59_94.mcc.
--source-rate <RATE>The source's frame rate, when its data doesn't say (23.976 vs 24).
--start-tc <TIMECODE>The target timecode of the first caption. Default: the same timecode at the new rate.
--ndfUse non-drop-frame timecode at 29.97 and 59.94.
--jsonPrint a JSON summary.

verify​

cc-embed verify master.mxf out.mxf --json

Runs the checks of embed --verify on an output that was already written, for example one streamed with -o - to storage. Either file can be a URL on the Linux build. It exits 0 when every original picture and sound byte is unchanged, and 1 (internal) with the mismatches otherwise. --carriage track|sei (MOV/MP4) says how the captions were embedded when it can't be told from the files.

JSON Output​

With --json, a successful run prints one JSON summary. These are its main fields; more may be added, so ignore fields you don't recognise.

extract

FieldDescription
input, outputThe paths (URLs without their query string).
formatmcc or stl.
infoThe container, carriage, frame_rate, drop_frame, start_timecode, and available_carriages.
frames_written, first_timecode, last_timecodeWhat was written.
channelsMCC: each 608 channel and 708 service with captions: id (CC1–CC4, T1–T4, service1…), standard, characters, first_timecode, last_timecode, and language when the file says.
teletext_pages, subtitles_written, teletext_pageSTL: the subtitle pages in the file, and what was written.
missing_frames, duplicate_frames, invalid_cdps, …Warnings, all 0 for a clean file.
salvaged, input_errortrue and the error, when the input was damaged after some captions.

embed

FieldDescription
input, captions, outputThe paths.
videoThe video's container details, frame_rate, and frame_count.
start_timecode, timecode_sourceThe first video frame's timecode, and where it came from (user option, the file, or default).
frames_written, first_timecode, last_timecodeThe captions written.
statsCaption data dropped before the first frame (dropped_before_origin) or left over at the end (left_over).
rewrapWhat changed in the file, including output_bytes.
verifyWith --verify: what was compared, and mismatches (empty). Otherwise null.

On failure the document is an error object instead, and the process exits with the matching code. Switch on code or the exit code, not the message:

{
"error": {
"code": "no_captions",
"exit_code": 6,
"message": "extracting from in.mxf: no captions: no CEA-608/708 captions found in the first 300 content packages",
"causes": [
"extracting from in.mxf",
"no captions: no CEA-608/708 captions found in the first 300 content packages"
]
}
}

With --progress json, progress events go to stderr, one JSON object per line: start, info (extract), progress (with percent, which never goes down, and for embed a phase), then done or error. Skip stderr lines that don't parse as JSON.

$ cc-embed extract in.ts -o out.mcc --progress json --json
{"event":"start","input":"in.ts","output":"out.mcc","total_bytes":12355548}
{"event":"progress","percent":8.4,"frames":0,"bytes":1048576}
...
{"event":"done","output":"out.mcc","frames_written":3000,"elapsed_ms":16}

Exit Codes​

Exit codes never change meaning, so scripts can rely on them.

ExitcodeMeaning
0Success.
1internalAn unexpected error, or a --verify / verify mismatch. Report it with the message.
2usageBad arguments. For embed, also: the file already has captions and --replace wasn't given, or -o is the input.
3ioThe input couldn't be read: not found, permission denied, or (URLs) 404, 403, or connection failures.
4unsupported_containerNot MOV/MP4, MXF, or MPEG-TS/PS, or a caption file that isn't MCC or EBU STL.
5unsupportedA feature not handled yet: clip-wrapped VC-3, fragmented MP4, variable frame rate, a video codec other than MPEG-2/H.264/HEVC, OP-47 into video that isn't 25 fps, or a URL whose server doesn't support Range requests.
6no_captionsNo 608/708 captions or OP-47 subtitles to extract, or (embed) no caption data within the video's timecode range.
7corrupt_inputThe media or caption file is corrupt or truncated.
8outputThe output couldn't be written (disk full, permission denied).
9license_expiredThe license has expired.

Getting Help​

Run cc-embed --help or cc-embed <command> --help for every flag. For licensing, deployment, or a file that doesn't extract or embed as expected, contact sales and support.