Tech Tips - Drop and Drag Closed Captioning

Overview

PixelTools products MPEGRepairHD and Expert-Caption can insert captioning into an existing MPEG stream or set of MPEG streams by dragging the stream(s) onto the MPEGRepairHD or the Expert-Caption Icon. The tools will insert captioning defined by the .SCC file located in the same folder as the MPEG file and having the same name as the associated MPEG file. The specific captioning format can be stored in the tool’s default configuration.

Demo of Drop and Drag Captioning

View demo of drap and drop closed captions insertion.

If you have trouble viewing the demo - try this link for easy Drag And Drop Captioning.

Adding closed captioning to an existing MPEG file couldn’t be simpler.  Just download the demo (DragExpCap.zip), unzip it into a folder, and drag the included MPEG file onto the ExpertCap icon.  Expert-Caption will automatically launch, add the appropriate captioning into the elementary video, save the elementary audio, and re-multiplex the captioned video with the extracted audio into a file of the same format and bit-rate as the original file.

Once you have the newly captioned file, you can analyze and view the captions. 

To analyze the captioned file (or any MPEG file), select the file in the File To Decode or Analyze edit box and depress the Analyze button.  An analysis dialog box should come up listing all of the captioning formats found on the right hand side of the Elementary Video Stream section.

Drop and drag closed captions

You can view the captioning over the decoded video by selecting your captioned video, open the decode window by depressing the de button on the top of the interface, and depressing the Decode | Run button.  You can enable and disable the variety of overlay types by selecting your desired option in the Decode Windows Menu Items:  Text Overlays | Closed Captioning

You can also view the captioning commands and codes in the Decode Statistics window. Select your source video, depress the St button to open the Decode Statistics Window, and then select your desired captioning display in the Video | Video Statistics | Digital Captioning menu item closed captions

drop and drag cc

You can also view the captioning commands and codes in the Decode Statistics window. Select your source video, depress the St button to open the Decode Statistics Window, and then select your desired captioning display in the Video | Video Statistics | Digital Captioning menu item

Drop and Drag Captioning Insertion

One or more MPEG Transport, Program, or Elementary video streams can be dropped onto the MPEGRepairHD or Expert-Caption Icons to launch the tool. The tool configures itself with the parameters stored in the appropriate ini file (MpegRepair.ini for MPEGRepairHD or ExpCap.ini for Expert-Caption).  If the MPEG file has an extension of .mpg, .mpv, .mpt, .vbs, or .mp2, the tool automatically runs the closed captioning processing.

drop and drap cc

The closed captioning processing starts by analyzing the source file to determine its multiplexed characteristics.  The tool then attempts to open a .SCC file with the same name as the .MPG file in the same folder as the MPEG file. The tool will return an error message and exit if the associated .SCC file is not found.  The tool next processes the file through its decoder to insert the .SCC captioning into the elementary video and concurrently extracts the audio track.  Once the captioned elementary video stream and audio stream have been extracted, the tool re-multiplexes the elementary video and audio streams into a format identical to that of the source file.  This process continues for all MPEG files that have been dropped onto the tool icon.

Tool can add captioning in a variety of different format/specifications.  If no Closed Captioning Format has been selected, the SCTE20 CEA708 NTSC format is used.  This format is the most common format option.  If you require another captioning format, you can enter that value in the Decode Configure | Fix Stream | Closed Captioning Format and save the new configuration as the default ini (MPEGREP.INI or EXPCAP.INI) in the folder where the tool is located.

It is important that the time codes in the .SCC file correspond with the time code in the MPEG file. If the two time codes do not correspond, you can add a Seconds Offset in the Fix Stream | Offset to make the .SCC time correspond with the MPEG time.  If your MPEG file starts at time 00:00:00:01 and your .SCC time code starts at time 01:00:00:01 for example, you can add a second offset of –3600.

You can easily ascertain the first time code of the first caption line by opening the .SCC file using a text editor. The time code of the first captioning line should appear at the top of the file.
You can also easily ascertain the first time code of the video by entering the file name in the File to Decode or Analyze edit box.  Select the Time Code  (TC) radio button in the Progress section below the tool’s mini-monitor.  The Mini-Monitor needs to be enabled (depress the monitor icon without the red line if it is grayed).  The decoder needs to be enabled: Uncheck the Decode | Configure | Disable Decode check box.  Running the decoder will cause the stream’s time code to be displayed in the time code monitor just below the mini-monitor.

Using the above verification procedures, you can easily verify that your captioning has been inserted properly.

It is recommended that you open the decode statistics window (depress the St button at the top of the interface) when inserting captioning for the first times. You should see indications of the frame number at which each captioning pair is inserted in this window. You should also see indications when each captioning section is actually being inserted.

Specifications

Closed Captioning Types supported in Expert-Caption and MPEGRepairHD (Decode) include:

CEA608
ATSC / CEA 608
DVD
CEA 708 DTV
CEA 708 NTSC
CEA 708 DTV & NTSC
SCTE20
SCTE20 & CEA 708 NTSC

Input Captioning Formats supported

.SCC
.CAP
Analog Input

Note that closed captioning can be transcoded from Analog Captioning.  Check the Xcode Analog Captioning from line:  and enter the line number where the analog captioning exists on your source video.  (You can ascertain the line number containing the analog captioning using the Analyze function).  The two bytes from each line can be transcoded into any one of the above supported formats.

Specifications supported:

CEA-608-C
CEA-708-B
ANSI/SCTE20 2004
ANSI/SCTE21 2001
ATSC A53
DVD

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.

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

©2011 PixelTools Corporation