Captions are often delivered as a separate sidecar file next to the video. The SDK reads three kinds of sidecar files and writes two of them:
| File | Content | Read | Write |
|---|---|---|---|
.scc (Scenarist) | CEA-608 byte pairs with timecodes. Supported by most caption tools. | yes | yes |
.mcc (MacCaption) | CEA-708 CDPs with timecodes | yes | — |
.anc | SDK format that stores the caption frame data (C608, C708, GA94) of each frame. Readable only by applications built on the SDK. | yes | yes |
Playing a video with a sidecar file
When the SDK opens a media file, it looks for .scc, .mcc and .anc files with the same name
in the same folder and uses them as caption sources. For example, for C:\media\show.mp4 it loads
C:\media\show.scc if the file exists. The captions then appear on the frames as C608/C708,
as if they were inside the video, and go to the SDI output, the preview or the writer.
To use a file with another name or location, set force_cc_file to its full path. The type is taken from the
extension (.scc, .mcc or .anc). With force_cc_file set, the files with the same
name are not loaded.
MFormats
// When opening
reader.ReaderOpen(@"C:\media\show.mp4", @"force_cc_file='C:\captions\show_en.scc'");
// Or later: the reader reopens the file with the new captions
reader.PropsSet("force_cc_file", @"C:\captions\show_es.scc");
MPlatform
// MFile
m_objFile.FileNameSet(@"C:\media\show.mp4", @"force_cc_file='C:\captions\show_en.scc'");
m_objFile.PropsSet("file::force_cc_file", @"C:\captions\show_en.scc");
// An item of MPlaylist or a stream of MMixer
myItem.PropsSet("file::force_cc_file", @"C:\captions\show_en.scc");
To check what was loaded, read info::cc_type of the reader (file::info::cc_type in MPlatform), for example file(SCC).
SCC timecodes
SCC lines start with a timecode. The SDK matches it with the timecode of the video: in a file whose timecode starts at 01:00:00:00, a caption at 01:00:05:00 appears 5 seconds after the start.
Some SCC files count from 00:00:00:00 instead. If no caption in the SCC file is at or after the start timecode of the
video, the SDK treats the SCC times as positions from the start of the file. This detection is controlled by
scc.detect_timecode_offset (default true); set it to false to always use the timecode
of the video.
Writing captions to a sidecar file
MFWriter and MWriter write the captions of the recorded frames into sidecar files next to the output file:
| Property | Default | What it does |
|---|---|---|
scc_capture | true | Writes the CEA-608 data of the frames (also CEA-608 taken from CDPs) to an .scc file. The file is created when the first caption data arrives, so a recording without captions has no SCC file. |
anc_capture | false | Writes caption frame data to an .anc file. Use it to keep CEA-708 captions. |
anc_capture.tags | empty | Frame data keys to store in the .anc file, separated by commas. Empty: C608, C708, GA94. |
scc_path, anc_path | empty | Full path of the sidecar file. Empty: the output file name with the .scc or .anc extension. |
flush_anc_scc | false | Writes the sidecar data to disk at once, so that another application can read the files while recording continues. |
// MFormats
writer.PropsSet("scc_capture", "true");
writer.PropsSet("anc_capture", "true");
writer.WriterSet(@"C:\rec\capture.mov", 0, "format='mov' video::codec='mpeg2video' audio::codec='pcm_s16le'");
// Result: capture.mov, capture.scc, capture.anc
// MPlatform
m_objWriter.PropsSet("anc_capture", "true");
m_objWriter.PropsSet("scc_path", @"D:\captions\capture_cc1.scc");
m_objWriter.WriterNameSet(@"C:\rec\capture.mov", "format='mov' video::codec='mpeg2video'");
When you later play capture.mov, the SDK finds capture.scc and capture.anc automatically.
Writing sidecar files is independent of embed_cc: you can embed captions into the video, write sidecar files,
or both. MCC files are not written.
Licensing
Reading and writing caption files requires a license with the Closed Captions option.
Still have questions?
Tell us what didn’t work or what you’d like clarified.