Tech Tip: Drag and Drop Caption Insertion

Darg and drop caption insertion

Easy insertion of captions into a MPEG stream

PixelTools products Expert-Caption and MPEGRepairHD can easily add captions to one or more MPEG file(s) by simply dragging the .MPG file(s) onto the Expert-Caption Icon. Expert-Caption will launch, find the associated .SCC file containing the captions, and insert the captions into the MPEG file without re-encoding.

Demo of drag and drop Caption Insertion

Download the DragAndDrop.zip file to obtain a demo of the drag and drop capability.  Unzip the file and drag the Sample.mpg file onto the EC Icon to start the process.  Expert-Caption can also be used to verify that captions have been inserted into the SampleCC.mpg video by launching Expert-Caption, browsing to the captioned file and selecting Analyze to obtain the caption properties or depress the de and then Run buttons to view the captions over the decoded video.

Adding Captions Using Drag and Drop

To use the Drag and Drop mode of ExpertCaption (or MPEGRepairHD), your MPEG file must have a .MPG extension and must be in the same directory as the .SCC file that contains your captions. The .SCC file must have the same name as the .MPG file. If your uncaptioned source file is ZXY123.mpg for example, the captions must be contained in a file called ZXY123.scc. 

Launch Expert-Caption by dragging the .MPG file onto the EC icon as depicted below.
That’s all there is to it.

Click to see larger image

Expert Caption

Once Expert-Caption has launched, it first tries to read the appropriate .SCC file.  If the .SCC file cannot be found, the program exits and saves an error message in the decode.log file.  Expert-Caption next analyzes the .MPG file to discover the multiplexing bit-rate and type: Transport, Program, System, or None, and the type of audio. The tool then extracts the elementary video, inserts captions defined in the .SCC file at the corresponding GOP time in the video stream, and extracts the elementary audio.  Finally, the tool remultiplexes the elementary Video Bit Stream (.vbs) now containing the captions with the elementary Audio Bit Stream (.abs) into a new stream of the original multiplexing format and bit-rate. The new file containing captions will have CC.Mpg at the end of the name.

Advanced Operations

Closed Captioning Format:
Expert-Caption defaults to inserting captions per the standards CEA-608, CEA-708, and SCTE20.  Each line of captioning is inserted three times; once compliant for each of the standards. This is the most popular format and works on most captioning systems. Other caption options may be appropriate for some situations.  To set the drag and drop captioning to another default, launch Expert-Caption, depress Configure | Fix Stream and select the appropriate Closed Captioning Format from the drop down menu. Save this to the default profile by depressing the Save As button and over write the ExpCap.ini file in the folder where Expert-Caption is located.  Subsequent drag and drop operations will use this updated closed captioning format.

Running MPEGRepairHD in Caption Drag and Drop
MPEGRepairHD can be used just like Expert-Caption with drag and drop by updating one configure setting.  To cause MPEGRepairHD to default to run in the Drag and Drop Captioning mode, launch MPEGRepairHD, depress the Decode Function Enable | Configure | Fix Stream  and check the Add Closed Captions or Commands from File option. Depress the OK button to approve the settings. Save the settings as the MPEGRepairHD default by depressing the Base Encoding Profile | Save As button and over write the MPEGRep.ini file in the folder where MPEGRepairHD is stored.

Verifying appropriate captioning channel(s) in a MPEG file
Launch Expert-Caption (or MPEGRepairHD) and browse for your MPEG file in the “File to Decode or Analyze” edit box.  Depressing the Analyze button will bring up a dialog box that details the types of closed captioning channels found in addition to other salient MPEG parameters.  This does not verify that captioning data itself is present, but rather that the closed captioning channel exists in this video. See example below:

NAB closed caption demo

Verifying actual captions in a MPEG  file
Launch Expert-Caption (or MPEGRepairHD) and browse for your MPEG file in the “File to Decode or Analyze” edit box. Open the decode window by depressing the de button on the top of the interface.  Depressing the Run button should cause the decoded video frames to be displayed in the decode window with the captioning text displayed over the appropriate frames.

Verifying 708 and 608 captions
Launch Expert-Caption (or MPEGRepairHD) and browse for your MPEG file in the “File to Decode or Analyze” edit box. Open the decode window by depressing the de button on the top of the interface.  Depressing the Run button should cause the decoded video frames to be displayed in the decode window with the captioning text displayed over the appropriate frames.  Selecting the menu item on top of the decode window Text Overlays | Closed Captioning will show Field1, Field2, and CEA-708 options checked by default. You can select just Field1 to display only the NTSC CEA-608 captions or select just the CEA-708 option to display only the CEA-708 captions.

Verifying captions with the VLC player.
The open source VideoLan (www.videolan.org) player can often be used to verify the captions along with audio in real time playback. The current version of the tool, (1.1) needs to have audio multiplexed with the video for the captions to work.  When the file is being decoded, select the Video | Subtitles Track | Closed captions 1. Captions will be displayed as they are detected.  The captions will not necessarily be displayed in the proper locations that they will be displayed on the TV screen.  The captions are displayed using the VLC stylized approach and not the Pop-On, Roll-Up, or Paint-On modes specified in the CEA-608 captioning specification.

If captions are not displayed in VLC and ExpertCaption.
It could be the caption times are not aligned with the GOP time code in the .MPG file. The MPEG GOP time can be viewed by decoding the .MPG file and depressing the Progress TC radio button.  The .SCC time code can be viewed by opening the .SCC file in a text editor. Quite often the .MPG starts at time code 00:00:00:01 and the .SCC file starts at 01:00:00:01.  This can be easily rectified by setting the Configure | Fix Stream | Offset to the difference in starting time between the MPEG file and the .SCC file to -3600 (60 seconds per minute x 60 minutes per hour).

It is also useful to open the statistics window (depress the st button at the top of the interface) while Expert-Caption is running. At the start of the statistics file, you should see the frame number at which the first captions will be inserted.  If this is a large number, you probably have a mismatch between SCC and MPEG timecodes. If captions are being embedded into the video, you should see lines indicating that captioning is being inserted as follows:

Frame For SCC Parameter Change:36
Add User Text: Writing 9426 9426 94ad 94ad 9470 9470 43ec ef73 e564 2043 6170 f4e9 ef6e e96e 6720 496e  73e5 f2f4 e9ef 6e20 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Found Selected Hex User Data Frame:6  GOP Time Code: 0:0:0:0   PendingFrames:16
Found Selected Hex User Data Frame:9  GOP Time Code: 0:0:0:0   PendingFrames:15

This information is also stored in the decode.log file when the process has terminated.

Captions defined as text and time code
Expert-Caption can accept captions defined in a text file with time code or frame number and the corresponding caption text. To make text files work with the drag and drop operation, the text files must have a .scc extension. Expert-Caption will recognize that the captions are in text format (not SCC format) and process them appropriately.

The time in the text files can be time code or frame number.
The text files must be of one of the following formats:

FRAME 6
CLOSEDCAPTION
This is a demo of the

FRAME 36
CLOSEDCAPTION
Closed Captioning Insertion

Or
FRAME  00:00:00:06
CLOSEDCAPTION
This is a demo of the

FRAME  00:00:01:06
CLOSEDCAPTION
Closed Captioning Insertion

Other Drag and Drop Operations using  ExpertCaption.
Expert-Caption can be set up to insert ADF flags, update the aspect ratio, re-stripe time code, or any of the Decode Fix operations using the Drag and Drop approach.  To enable one or more of these operations via drag and drop, select the Configure | Fix Stream dialog and select the operations(s) that you wish Expert-Caption to accomplish when launched using drag and drop.  Depress the Save As button and save the settings over the ExpCap.ini file in the folder where Expert-Caption is stored.

Helpul Tips

For Caption Insertion:

  • Do not launch Expert-Caption before dragging the .MPG file
  • Do not drag the .SCC file onto the Expert-Caption Icon; just drag the .MPG file
  • You can drag multiple .MPG files onto the EC icon to insert captions in all files

For Caption Analysis and Viewing:

  • The video will not be decoded in real time.  Frames will be displayed as fast or as slow as the computer.
  • No audio will be heard using Expert-Caption
  • The captions will not be displayed in the location, font, and color that they will on the TV screen. 


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

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

| Contact Us

 
© 2013 PixelTools| Privacy Policy | Site Map