Tech Tips - Stream Header Replacement

Overview

MPEGRepairHD can be used to modify stream headers including time code, aspect ratio, pan and scan, etc. and can insert Closed Captioning and CGMS flags all without decoding and re-encoding the original MPEG stream.

 

Demo

A demonstration of the steam header replacement process can be obtained at headerupdate.zip.   Download this file, unzip the directory structure and perform the sample header update as detailed in the ReadMe.txt file.  The demo includes a sample MPEG encoded file. The ReadMe instructs you to
1. Analyze the sample MPEG and note its aspect ratio
2. Run the update aspect ratio process
3. Analyze the updated MPEG stream and note its updated aspect ratio.

 

Header Update using the MPEGRepairHD GUI

The MPEGRepair decode section includes the ability to update stream headers without re-encoding.  The Decode | Configure | Fix Stream dialog controls the stream update process.

configure screen
Click on image to see larger size

Selecting any of the above update options enables the associated option state and enables the Save Fixed File edit box.  Once you have selected the option(s) you wish to update, just select the new flag state that you wish to update in the stream, enter or browse the Save Fixed File that will save the original file including the new fixes, and depress the Decode Run button.   Depressing the Monitor Disable button in the center of the tool bar menu will speed up the replacement process.

 

Stream header replacement using the WorkShop SDK

The Expert WorkShop SDK can be used update headers in existing MPEG file using the SDK’s decode section.  The decode fix options, analogous to the GUI options, are set in the ExpDecFix_str structure in VidDecodeParams_struc structure presented in the ExpDecodeConfigure API call.  Once the fixed items, fixed item states, and fixed output file name have been set, a sequence of calls to ExpDecodeNextFrame will cause the updated stream to be written to the fixed output file.

Specifications

The Decode Fix operation can be used to set or clear the following flags:

top_first
repeat_first
low_delay
prog_frame
prog_seq
constr_par
closed_GOP.

The Decode Fix operation can be used to modify the following header options:

aspect_ratio
frame_rate
level
profile
video_input
matrix_coefficient
Pan and Scan frame size

The Decode Fix operation can be used to reset ALL of the time code stamps in the elementary GOP headers.  You can enter the time code of the first frame in the fix options and select the drop_frame option if needed.  The Decode Fix will calculate the appropriate time codes for all of the GOP headers and replace the existing time code with this newly calculated time code.

The Decode Fix can be use to add user_data containing CGMS and APS flags as extended user data.   This user data is added throughout the stream at 2 second intervals.

The Decode Fix can also be used to add Pan and Scan frame offsets at each frame and/or closed captioning data at selected frames. 

 

Refer to the MPEGRepairHD users manual or the Expert WorkShop SDK manual for additional details on the updateable headers.

 

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

©1998-2009 PixelTools Corporation