- Updating Time Code in MPEG streams
PixelTools’ MPEGRepairHD can reset
the time code throughout an existing MPEG stream. The process is
fast and simple: you specify the starting time code and the tool
updates the time codes in all of the GOP headers. This process
works on MPEG2 and MPEG1 transport, program, system, and elementary
Demo of Time Code Update
Download the timecodeupdate.zip file to obtain
a demo of MPEGRepair that updates time code to an existing stream.
Just unzip the file and run the TimeCodeUpdate demo to launch the
demo. The demo includes a sample MPEG program stream (called
Source.mpg) that starts with Time code 00:00:00:01. The MPEGRepairHD
will come up running in the batch mode to update the time code to
start with 01:02:03:04 and save the file as TimeCodeUpdate.mpg. You
then can compare the time codes using MPEGRepairHD. Just click
launch MPEGRepair, Browse the “File to Decode or Analyze” on
the .MPG file you wish to explore, and depress the “Analyze” button. The
Starting Time Code and Ending Time Code of the Elementary Video component
of your stream will be displayed.
Updating Time Code with MPEGRepairHD
To update the GOP
time code of any MPEG stream, launch MPEGRepairHD and browse to
your MPEG stream with the File to Decode or Analyze button. Next, depress the Decode | Configure button and select
the Fix Stream tab. Check the “Reset MPEG Time Code” box
on the lower right of this dialog. This enables the Hour, Minute,
Second, and Frame edit boxes. Enter the time code that you
wish to be set in the first GOP header of your stream. Check
the “Drop Frame” check box if you want the calculations
to include drop frames. Next, enter or browse the full path
name of the file you wish to store the updated MPEG file in the upper
left “Save Fixed File” edit box. If your source
file is multiplexed as a TransPort, Program, or System stream, you
can cause the output to be an exact duplicate of the source stream
multiplexing structure by checking the “Save Multiplexed Format” check
box. Selecting OK to close the dialog box and depressing the Control
Decode | Run button will cause MPEGRepairHD to process the MPEG file.
The first GOP header will contain the time code you specified. Subsequent
GOP headers will be stamped with the time code appropriate for the
frame number, frame rate, and drop frame options you have selected.
Note that you can speed up this process
by depressing the small
button with the red line running through the monitor to disable display
of each frame. Click on image to see larger screen.
Updating Time Code with Expert WorkShop SDK
The SDK can be set up to replace time
code in a source file and save the result as a new file. Set up the Decode
section as illustrated in the sample source code. Before calling
the ExpDecodeConfigure function, set the following parameters in
the ExpDecFix_str structure:
EnSetTimeCode to true to cause time code update during decode
DecodeFixName to contain the name of the file you wish to
save the updates to.
int TimeCodeHour; to the appropriate starting time code
SaveAsMuxedFile true if your source
is multiplexed and you want the original multiplexing format implemented
in the updated file. Set this value to false if your source
is an elementary stream or you want your multiplexed source file
saved as an elementary stream with the updated time code.
To run the time code update operation, call ExpDecodeNextFrame
for the length of the source video.
MPEGRepair can update the time code throughout
the entire stream.
The time code is stored in each GOP header in the video elementary
The starting time code can be specified
in terms of Hour, Minute, Second, and Frame.
Subsequent GOP time codes will be updated
with the values based on the starting time code and appropriate to
the source’s frame
rate, frame number, and DropFrame settings.
The operation occurs in the elementary
MPEGRepair can retain the multiplexed
structure in Transport, Program, VOB, and System stream if the Save
As Muxed File option is selected. If the Save As Muxed
File option is not selected, the resultant updated stream will be
an elementary video stream.
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