TechTips - Closed Captioning

Comprehensive Closed Caption solution


PixelTools products can insert and extract a wide variety of closed captioning formats into and out of an MPEG stream. Our products can also add captioning during MPEG encoding and instant analysis of any MPEG streams. Currently supported formats include CEA-708, CEA-608, SCTE20, SCTE21, ATSC, DVD, and Analog. The tools include support for CC1 through CC4.

The closed captioning source can be standard closed captioning files (such as .SCC or .CAP), the actual closed captioning text strings along with their associated time code, or formatted user data to support a custom captioning format.  Our tools can convert from one caption format to another, optionally removing the existing captioning, in an existing MPEG stream without re-encoding.  Our products can also burn in open captions on an existing video or during encoding.

PixelTools products such as MPEGRepairHD and its corresponding Expert Workshop SDK include both the Encode and Decode capabilities as well as comprehensive analysis capabilities that assist in debugging closed captioned streams.

  • Insert digital closed captioning (CC) Data into user_data fields of elementary video streams during encoding or to existing encoded elementary streams
  • Embed analog closed captioning in one of the MPEG video scan lines
  • Extract and display digital and analog CC data from elementary and multiplexed streams
  • Save digital and analog captioning into a .SCC or a .TXT file
  • Print out the contents of the user_data field throughout the video
  • Encode CC data per CEA-708, CEA-608, ATSC, SCTE20, SCTE21 or DVD specifications
  • Convert Analog captioning to digital captioning without re-encoding
  • Add Open Captioning to video during encoding
  • Convert Analog Captioning to Open Captioning
  • Transcode between CC formats
  • Automate processing via batch mode


  Expert-Caption HDProQT ExpertHD MPEGRepairHD
Expert WorkShop SDK
Add 708,608,SCTE20, SCTE21,ATSC Captioning During Encoding
Add 708,608,SCTE20, SCTE21,ATSC Captioning To Exiting stream
x
x
Analyze Captioning
x
x
x
Extract Captioning stream to .SCC or .TXT
x
x
x
Print out contents of user_data
x
x
x
Transcode analog to digital captioning without re-encoding
x
x
x
Add analog captioning 
x
x
x
Transcode between CC formats
x
x
x
x
Automate using Batch mode
x
x
x
x
Add Open Captioning during encoding
x
x
x
Convert Analog Captioning to Open Captioning
x
x
x

PixelTools Encoders such as ExpertHD and HDProQT can add captioning during encoding.

PixelTools Decoder Expert-Caption® can add and transcode captioning in existing streams, extract captioning to one of the supported many formats and analyze captioned streams.

Demo of Closed Captioning

Easy Caption Insertion

Demonstration of insertion of CEA-708 and 608 closed captioning into a video using PixelTools Expert-Caption.  Captions are also verified for correct format and screen location.

Easy Caption Insertion

 

Caption Troubleshooting

Working examples of methods to troubleshoot closed captioning in a video using
PixelTools Expert-Caption analyzer and CEA-708 and 608 compliant video decoder.

Closed Caption Troubleshooting, Closed Captioning, CEA-708 decoder, CEA-608 captions, PixelTools,

Caption Troubleshooting


Caption Text Updating

Demonstration of how to change closed captioning text that is embedded in a video using a text editor and PixelTools Expert-Caption. Closed caption text is extracted, edited, re- inserted, and then verified.

Closed Caption Editing, Closed Captioning, CEA-708 decoder, CEA-608 captions, PixelTools

Caption Text Updating

Analog to Digital Caption Caption Conversion

Demonstration of how to transcode analog captions within a video to digital captions without changing the video quality using PixelTools Expert-Caption.  Analog captions are viewed, transcoded into digital captions, and saved as a .SCC and a .TXT file. Demonstration of the creation of a new custom configuration file.

Analog To Digital Caption Conversion

Extracting Captions From Video To File

Demonstration of how to extract closed captioning and save to a .SCC or .TXT file using PixelTools Expert-Caption. Demonstration of how to save all user data as a .EDL file. Extracted captions and user data are then re-inserted into the video and verified.

Closed Caption Extraction, SCC file, Closed Captioning, CEA-708 decoder, CEA-608 captions, PixelTools

Extracting Captions From Video To File

Download the closedcaptiontrial.zip file to obtain a demo version of MPEGRepairHD that is configured to illustrate some of the closed captioning insertion and display capability. Unzip the file into a directory and run the CCDemo.bat file to launch the demo.  The demo will automatically encode a file adding the closed captioning the text strings stored in the Expert.edl file.  The demo will then decode the newly encoded MPEG file so you can see the closed captioning displayed over the video.

Download the Analog2DigitalCC.zip file to obtain a demo version of MPEGRepairHD that is configured to illustrate the transcoding of analog captioning to ATSC digital captioning in existing streams. Unzip the file into a directory and run the A2DDemo.bat file to launch the demo.  The demo will automatically process a MPEG file containing analog captioning in the 18th line of the video.  The demo will convert this analog captioning to CEA-708 and SCTE20 captioning and insert it into the video.

Download the closedcaptiontrial.zip file to obtain a demo version of MPEGRepair that is configured to illustrate some of the closed captioning insertion and display capability.

Unzip the file into a directory and run the CCDemo.bat file to launch the demo.  The demo will automatically encode a file adding the closed captioning the text strings stored in the Expert.edl file.  The demo will then decode the newly encoded MPEG file so you can see the closed captioning displayed over the video.

Adding Closed Captiong During Encoding

Closed captioning insertion is controlled via an Encoding Decision List (edl) a text, .scc or .cap file. The EDL file is read during the encode operation.  The EDL file contains the closed captioning text string and the first frame number or time code where the text string will appear.   The EDL file must be named Expert.edl and must be located in the directory where your encoded MPEG file is being stored. The CLOSEDCAPTION command specifies the closed captioning text string.  An example of the format of the closed captioning is presented in the top of the sample Expert.edl provided with the product. The formatted closed captioning data is added to the appropriate frame user_data fields as requested in the Expert.edl file.

Using Raw Text as Input

The following is an example of the Edl closed captioning file commands:
FRAME 1038
CLOSEDCAPTION
The little brown cow jumped over

FRAME 1146
CLOSEDCAPTION
the moon!

Using Closed Captioning .SCC file as Input

The closed captioning EDL file can also be of popular closed caption file format (.scc) which consists of the time code followed on the same line by a sequence of sets of 4 HEX codes representing the actual closed captioning data that will be added to the video user_data.
The following is an example of the Edl with formatted closed captioning command:
00:00:00:14            9426 9426 94ad 94ad 9470 9470 9137 9137
00:00:13:06            942c 942c

Using Line 21 Hex data as Input

Also, any pre-formatted closed captioning data (using any closed captioning standard) can be added via the HEXUSERDATA edl command.  Just add the frame number or time code of the frame user data and the actual user data, up to 72 characters long, after the HEXUSERDATA command. .  An example of the format of the hex user data is presented in the top of the sample Expert.edl provided with the product.
The following is an example of the Edl raw user data file commands:

FRAME 1038
HEXUSERDATA  04 ff 29 d0 55 9f 28 44

FRAME 1039
HEXUSERDATA  05 ff 39 d4 22 9f 28 44

FRAME 1102
HEXUSERDATA  05 ff 39 d4 22 9f 28 44

Closed Captioning Format

The Closed Captioning Format selection controls the actual formatting of the text or SCC EDL and DDL commands into the MPEG user data and controls the specific user data locations. The Format selection control is located in the Encode section of MPEGRepairHD in the Optimize Encode | Configure | Line 21 property page.  Note that the insertion of closed captioning data into an existing stream using the Decode Fix process utilizes the Closed Captioning Format set in the Encode configuration.

The following Closed Captioning format options are available:

CEA 708 DTV
This option causes up to eighteen closed captioning characters to be inserted into picture header user data fields in display order.   When converting text to CEA-708 data, DTV Window 0 will be initialized and enabled.   Your closed captioning text will be written to this window at the specified frame or time code.

Analyzing the actual user data using the MPEGRepairHD Decode Statistics window will show Picture user data that will start with the Hex values: 47 41 39 34

CEA 708 NTSC
This option causes up to two closed captioning characters to be inserted into picture header user data fields in display order.   These bytes are added to the NTSC channel in the field per your Closed Captioning Style selection.  This channel was designated by the CEA to facilitate legacy closed caption processing in CEA-708 systems.

Analyzing the actual user data using the MPEGRepairHD Decode Statistics window will show Picture user data that will start with the Hex values: 47 41 39 34

CEA 708 DTV & NTSC
This option causes up to eighteen closed captioning characters to be inserted into picture header user data fields in display order and up to two closed captioning characters to be added to the NTSC channel in your selected field.   When converting text to CEA-708 data, DTV Window 0 will be initialized and enabled.   Your closed captioning text will be written to this window at the specified time.   This option causes the same closed captioning text to be written to both the CEA-708 window and the NTSC channels.

Analyzing the actual user data using the MPEGRepairHD Decode Statistics window will show Picture user data that will start with the Hex values: 47 41 39 34

CEA 608 (default)
This option causes up to two closed captioning characters to be inserted into picture header user data fields in transmission order. The characters will be entered into the Field 1 or Field 2 closed captioning field per your Closed Captioning Style selection.

Analyzing the actual user data using the MPEGRepairHD Decode Statistics window will show Picture user data that will start with the Hex values: 02 09

ATSC / CEA 608
This option causes up to two closed captioning characters to be inserted into picture header user data fields in display order. The data formatted per CEA-608 and is wrapped in a SCTE-21 and ATSC header. The characters will be entered into the Field 1 or Field 2 closed captioning fields per your Closed Captioning Style selection.

Analyzing the actual user data using the MPEGRepairHD Decode Statistics window will show Picture user data that will start with the Hex values: 47 41 39 34

DVD
This option causes up to 30 closed captioning characters to be inserted into GOP header user data fields.  The first set of user data will be inserted at the first GOP at or after the Frame number or time code set in the EDL or DDL file. The remaining user data (over the 30 character per GOP limit) will be inserted in subsequent GOP headers. The characters will be entered into the Field 1 or Field 2 closed captioning field per your Closed Captioning Style selection.

Analyzing the actual user data using the MPEGRepairHD Decode Statistics window will show user data at EVERY GOP header that will start with the Hex values: 43 43 01 f8 9e.  The GOP headers will contain the closed captioning data or will contain NULL data.

SCTE 20
This option causes up to two closed captioning characters to be inserted into picture header user data fields in display order. The data formatted per CEA-608 is inserted per the ANSI/SCTE 20 standard. The two captioning characters are not byte aligned and so will not be immediately recognizable when extracted in the MPEGRepairHD decode statistics. The characters will be entered into the Field 1 or Field 2 closed captioning fields per your Closed Captioning Style selection.

Analyzing the actual user data using the MPEGRepairHD Decode Statistics window will show 7 bytes of user_data in the Picture Headers that will start with the Hex values: 03 81.

Adding closed captioning to an existing stream

Closed captioning can be added to an existing elementary stream. This is accomplished using the PixelTools decode functionality in conjunction with a Decision List (ddl) a text, .scc or .cap file.  The DDL file contains the closed captioning text string and the first frame number or time code where the text string will appear.   The DDL file must be named Expert.ddl and must be located in the directory where your output “fixed” MPEG file is being stored. To enable processing of the Expert.ddl file, check the Decode Function Enable | Configure | Fix Stream | Use Commands in DDL file option and enter the name of the file the will include the closed captions in the Save Fixed File edit box. The CLOSEDCAPTION command in the Expert.ddl file specifies the closed captioning text string.  An example of the format of the closed captioning is presented in the top of the sample Expert.ddl provided with the product.    The formatted closed captioning data is added to the appropriate frame user_data fields as requested in the Expert.ddl file after depressing the Control Decode | Run button with your source file in the Decode MPEG File to Decode or Analyze edit box . You can speed up the process by depressing the Speed button with the slashed monitor to disable decode display.

The ddl file format is similar to that of the edl file format presented above.  In addition to the text strings supported with the CLOSEDCAPTION command, any formatted user data can be inserted via the HEXUSERDATA command.  Also, the .scc closed caption format is supported. (Be sure to rename the .scc file as Expert.ddl).

Extracting Closed Captioning

Select your file containing the digital closed captioning in the File to Decode or Analyze Edit box.  In the Decode Configure | Extract Streams dialog, check the Save Digital Data option and enter or browse the name of the file to hold your extracted data. Running the decoder will cause all user_data to be saved in your selected output file.

Extracting Analog Closed Captioning Data

Select your file containing the analog closed captioning in the File to Decode or Analyze Edit box.  In the Decode Configure | Extract Streams dialog, check the Save Analog Data option and enter or browse the name of the file to hold your extracted data.

Running the decoder will cause the two CC bytes to be extracted from the analog modulated white line at the top of each frame.  The parity bit will be stripped off of the data before it is saved.  The data in your selected analog CC file will be ASCII text which will include the CC words displayed on the screen.  The data will also include the CC control characters which will be intermixed with the readable text.

Extraction in the Statistics Log

All data displayed in the Decode Statistics Log will also be stored in the Decode.log file.  You can select between the raw user_data and the translated ASCII text and control codes using the Decode | Statistics | Video Statistics menu options.

Adding Closed Captioning using HDProQT

The QuickTime plug in for Mac and PC makes it easy to include closed captioning during your encoding process.  Just check the “Add Closed Captions From File:” check box and Choose your .SCC or .CAP file that contains your text and time codes.  Select your format and style in the adjacent selection boxes.  Make sure that the Starting Time Code on the options box matches the starting time code of your .SCC or .CAP file.

During the export process, HDProQT will read the caption file and insert the captions into user_data using the format you have selected.


Adding closed captioning via ExpertWorkshop SDK

During Encoding
To enable the addition of closed captioning data while encoding a file, create an encoding edl text file as described above using the CLOSEDCAPTION, or HEXDATA commands or use one of the supported closed captioning file format. Use the EdlFullFileName configuration parameter to point to the edl file.  During the ExpEncodeNextFrame API command, the selected edl file will be read to determine if any closed captioning data needs to be added to the user_data in the encoded frame.

The two closed captioning bytes also be added to each frame by adding them to the ClosedCaptionBuffer parameter of the calls to ExpEncodeNextFrame.  These two bytes will be stuffed into video user_data using the format and wrapper as defined in the Closed Captioning Format.

During Decoding
To enable the addition of closed captioning data while decoding a file, create a decoding ddl text file as described above using the CLOSEDCAPTION, or HEXDATA commands or use one of the supported closed captioning file format.  Store the name of the resultant MPEG file that will contain the closed captioning data in the DecodeFixName member of the ExpDecFix_str.   The ExpDecFix_str is a member of the VidDecodeParams_struc which is sent to the decoder as a member of the ExpDecConfigure API call.  During calls to ExpDecodeNextFrame, the source stream is written to the resultant MPEG stream along with the appropriate user_data containing the closed captioning text per the ddl file.

Closed Captioning Insertion Format
The Closed Captioning Format is set using the ExpEncodeConfigure call where the
ExpEncParameters_str | Line21Params_struc  CCType contains the actual format. 

CCType of:

CEA608 = 0
ATSC_CEA608 = 1
DVD_CC = 2
CEA708_DTV =  3
CEA708_NTSC = 4
CEA708_DTV_NTSC = 5
SCTE20 = 6


Specifications

The CGMS and APS flags are added to the MPEG video user data as Extended Data in the line 21 emulation of digital data as specified in the Advanced Television Systems Committee Inc (ATSC) Digital Television Standard A/53, the ISO/IEC 13818-2 MPEG video standard, the Society of Cable and Telecommunications Engineers (SCTE) ANSI/SCTE 20 2004 Methods for Carriage of Closed Captions and Non real-time Sampled Video and ANSI/SCTE 21 2001 Standard for Carriage of NTSC VBI Data in Cable Digital Transport Streams specification, and the Consumer Electronics Association CEA-708-B Digital Television (DTV) Closed Captioning specification, and the Consumer Electronics Association CEA-608-C Line 21 Data Service specification.


Supplemental Information

The term "Closed Captioning" encompasses a huge array of capabilities.  PixelTools products continue to provide an increasing array of support for many captioning processes such as output specific lines of the video file onto specific lines of the VANC data (also known as Video Ancillary data).

Captioning can be defined as text that appears over the video so that the viewer can comprehend the conversations that are taking place in the video.  Captioning can be used to assist the hard of hearing or to translate the speach into another language.

Closed captioning consists of text overlays in the video that can be disabled by the viewer.  Open captioning consists of text overlays that are "burned" into the video and cannot be disabled by the viewer. 

Subtitles are sometimes the same as Open Captioning (for translation of foreign films). The DVD standard defines subtitles as graphical text strings (bitmaps) that can be enabled and disabled by the viewer. The DVD standard also defines digital closed captioning that will be extracted by the DVD player and added in analog video line 21 in the DVD set top box.

The workflow for adding closed captioning to a movie consist of first converting the verbal conversations to computer text along with the time of the text. This can be represented in a large number of file formats including .SCC, .CAP and just a plain text with time code format.

This computer file is then converted to the desired Caption format, wrapped in the desired video packets, and then added to the video during editing, video encoding, or to an existing compressed file.

Analog broadcasting allows the insertion of two 8 bit characters every field in line 21 of the video.

There are a wide variety of ways that captioning can be added to a compressed video file.  When the MPEG standard was first released, the analog captioning (taken from line 21 of the broadcast video) was added to one of the top display lines of each video frame and encoded along with the video.  In some cases, 32 extra display lines were added at the top of each video frame so that the analog captioning does not interfere with the video content.  As MPEG systems became more defined, standards evolved that defined digital user_data captioning fields in the video itself.  The minimum user_data format supports the two characters per field data rate of analog line 21 [defined in CEA-608].  The larger user_data capacity of compressed video streams brought on the newer CEA-708 standard that provides many characters per frame along with more flexible formatting.

PixelTools products support most of the currently used standards and can facilitate transcoding of one format to another.  Our products currently do not deal with the conversion of verbal conversations in to computer text.

Historical Background

Line 21 data can have many uses and is governed by multiple overlapping specifications in support of government and industry regulations.  A little history may aid in the understanding of the features.  

Analog
In the 1970’s, extra bandwidth was exploited in the television broadcast signal that occurred in a normally dead period while the electron gun was being repositioned to start the painting of each new field.  A US federal mandate required that most broadcasts include closed captioning. It was determined that two ASCII characters could reliably be included in the vertical retrace interval (line 21) right before the first visible horizontal line.   Simple decode circuitry was mandated to be included in all TVs that would provide the extraction and storage of the line 21 data and allow the TV user to add the closed caption characters as an overlay to the video in the next fields.  Other industry users fought for access to the line 21 data.  The Copy Generation Management System (CGMS) provided a three state flag that would cause new industry and federally mandated TV decoders to prevent copying of selected video content. The flags are “Copy Freely”, “Copy Once”, and “Copy Never”.  The old Macrovision technology of interfering with the TV broadcast synchronization signals to prevent video copying was also embedded in line 21 data with Analog Protection System (APS) flags that instruct the video decoder to interfere with selected synchronization signals. Also video content rating, program type information, and program schedule data is broadcast via the line 21

Digital
The advent of MPEG compressed video brought with it more possibilities for higher bandwidth closed captioning channel and other supplementary data channels.  One of the digital constraints though was to make the new system backwards compatible with older TV technologies IE allow for just two bytes of data per field. This evolution has resulted in a large array of specifications that support the new and old capabilities. Line 21 data can be added to user_data of each frame of elementary MPEG video.  Line 21 data can also be added as a special stream within a MPEG transport stream.

Digital Television offers a variety of display sizes and aspect ratios. To accommodate these different dimensions, the CEA-708 specification includes enhanced display features as compared to the older CEA-608 specification.  CEA-608 decoders were required to place the captioning overlay in a defined section of the screen and with a specified font size.  CEA-708 decoders draw the captioning text in a user defined window anywhere on the display. The user can interactively move and re-size this captioning window. The captioning commands define anchor points that will not move when this window is resizes.  As such, CEA-708 requires quite a bit more control overhead to utilize the advanced features.  This makes CEA-608 streams not easily converted into full featured CEA-708 streams.  CEA-708 does include four optional bytes per frame which are designated as NTSC captioning bytes for backward compatibility with CEA-608 decoders.  It is possible to add both the DTV CEA-708 captioning in additional to the NTSC bytes in the sample CEA-708 headers.

Standards
The Consumer Electronics Association publishes CEA-608-C Line 21 Data Service that details data formats for closed captioning services and extended data (including CGMS and APS).  The CEA publishes CEA-708-B Digital Television Closed Captioning that details usage of a 9600 bps closed channel (ten times the bandwidth of the original channel).  The Advanced Television Systems Committee Inc (ATSC) publishes the Digital Television Standard A/53 specification that details a format for adding line 21 data to user_data of an MPEG-2 stream.  The International Organization for Standardization (ISO) publishes the ISO/IEC 13818-2 MPEG video standard that details the inclusion of user_data in compressed video streams.  The Society of Cable and Telecommunications Engineers (SCTE) publishes the ANSI/SCTE 20 2004 Methods for Carriage of Closed Captions and Non real-time Sampled Video and  ANSI/SCTE 21 2001 Standard for Carriage of NTSC VBI Data in Cable Digital Transport Streams specification that defines additional VBI services.

 

Let us know if we can help or request a free demo of our products. View our products features at a glance.

Visit our products page and check out at our PixelTools Store to purchase any of our products

MPEGRepairHD and ExpertHD are trademarks of PixelTools Corporation. All other brand names are trademarks or registered trademarks of their respected holders.


Thank you for your interest in PixelTools

 

| Contact Us

 
© 2013 PixelTools| Privacy Policy | Site Map