Tech Tip - Closed Captioning

Easy insertion of closed captioning formats into and out of an MPEG stream

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
x
x
x
x
Add 708, 608, SCTE20, SCTE21, ATSC Captioning to Exiting stream
x
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
x
Transcode between CC formats
x
x
x
x
Automate using Batch mode
x
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 functionality

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 captioning 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).

Displaying closed captioning on PC products

The MPEGRepair Decoder can extract and display closed captioning information in several formats.

Hex User Data

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


Thank you for your interest in PixelTools

 

| Contact Us

 
© 2012 PixelTools| Privacy Policy | Site Map