Tech Tip - CGMS and APS Flag Insertion

Easy insertion of copy protection into and out of an MPEG stream

PixelTools products can add CGMS and APS copy protection flags during encoding or to an existing stream without re-encoding. Embedded in an MPEG stream, CGMS and APS flags instruct recording equipment to allow or deny copying the MPEG.These flags are inserted in the MPEG elementary user data.

Demo of CGMS flags

Download the CGMSDemo.zip file to obtain a demo of MPEGRepair that adds CGMS data while encoding or to an existing stream. Just unzip the zip file and run the CGMSDemo.bat file to launch the demo.   The MPEGRepairHD will encode a sort frame sequence and add the GCMS copy once flag and the APS Type 2 flags at appropriate intervals during encoding.  You can verify these flags using the Decode Section of MPEGRepairHD by depressing the St (Statistics window) speed button and selecting the Video | Video Statistics | User Data option during decoding.

Adding copy flags via MPEGRepairHD GUI

During Encoding

To enable the addition of CGMS and APS data while encoding a file, depress the Optimize Encode | Configure |  Line 21 tab.  Check the Add XDS Flags option.  Then select the appropriate CGMS flag option: Copy Freely, Copy Once, or Copy never.  Select the appropriate APS flag: off, Type 1, Type 2, or Type 3.  Depress the Apply button.

During encoding of your source video, your selected flags will be added to the elementary stream at appropriate intervals.

Add to an existing stream

To enable the addition of CGMS and APS to an existing file, depress the Decode Function Enable | Configure |  Fix Stream tab.  Check the Insert XDS flags.  Then select the appropriate CGMS flag option: Copy Freely, Copy Once, or Copy never.  Select the appropriate APS flag: off, Type 1, Type 2, or Type 3.  Enter or Browse the resultant file (containing the flags) in the Save Fixed File edit box. Depress the Apply and OK button.

Select the elementary MPEG file you wish to add the flags to in the MPEG File to Decode or Analyze Edit box using the Browse button. Depress the Control Decode | Run process to start the insertion process.  You can speed up the insertion process by depressing the Speed Button with the line through the monitor to turn off the display during encoding.

 

Adding copy flags via Expert Workshop® SDK

During Encoding

To enable the addition of CGMS and APS data while encoding a file, set the appropriate CGMS and APS values in the XdsCGMS and XdsAPS members of the Line21Params_struc. ( ptool_XDS_CGMS_Type and  ptool_XDS_APS_Type enumerate the values.) The Line21Params_struc structure is part of the ExpEncParameters_str that is used in the ExpEncodeConfigure API call.  This set up will cause the CGMS and APS data to be added as user_data at appropriate intervals during the encoding.

Add to an existing stream

To enable the addition of CGMS and APS data to an existing MPEG file, set the appropriate CGMS and APS values in the XdsCGMS and XdsAPS members of the ExpDecFix_str. ( ptool_XDS_CGMS_Type and  ptool_XDS_APS_Type enumerate the values.) Add the name of the resultant output file to the DecodeFixName member of the ExpDecFix_str. The ExpDecFix_str  is part of the VidDecodeParams_struc which is used in the ExpDecodeConfigure API call.  While decoding an MPEG elementary file, the files contents are copied to the DecodeFixName file and user_data with selected CGMS and APS values are added at appropriate intervals.

Verifying CGMS Data

CGMS is inserted in the user_data header of MPEG-2 steams.
As specified in the specification ANSI/SCTE 21 2001 page 14, the user_data will consist of

47 41 39 34 (ATSC Identifier)
03 (Type Code)
c2 (Data Count and CC code)
ff (Marker bits)
fc (Data valid)
80 80 (CC Data)
fd (CC Type)
xx xx (CGMS  Codes)

To verify that the codes have been inserted using MPEGRepairHD, open the decode Statistics Window (depress the left hand st button) and check the menu item
View | Video Statistics | User Data.

When your file has been selected in the File to Decode or Analyze edit box and the Decode Run button has been depressed, the above codes should periodically appear in the Statistics Window and will also be saved in the decode.log file.

Specification


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 ATSC A53 Digital Television, ANSI/SCTE 21 2001, and CEA 608 Standard specificatio
ns.

At the lowest level, MPEGRepairHD is capable of adding frame accurate user_data during MPEG encoding or to an already existing video elementary stream.  This will support all of the data services provided that the data is packaged in the correct format. MPEGRepairHD can add up to 128 eight bit data bytes to designated frames during encoding using an Encoding Decision List (EDL) file or to an existing MPEG stream using a Decoding Decision List (DDL) file.  These text files specify the frame number and corresponding data bytes which will be inserted in the user_data at the selected picture header.  The data bytes must be formatted appropriately per the desired usage. The encoding EDL and the decoding DDL files utilize the identical format.

At a higher level, MPEGRepairHD can add the CGMS and APS beacons periodically throughout a stream during encoding or to an existing stream.  MPEGRepairHD includes an Encode | Configure | Line 21 Data dialog that allows you to specify the CGMS and APS flags that will be added during encoding at the proper intervals.  MPEGRepairHD also includes options in the Decode | Configure | Fix Stream dialog that enable you to specify the CGMS and APS flags that will be added to an existing MPEG stream at proper intervals.

 

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-2012 PixelTools Corporation

| Contact Us

 
© 2012 PixelTools| Privacy Policy | Site Map