Diese Seite auf deutsch

Stand 28.09.03

MPEG Header Repair


This tool restores the header of MPEG sequences that have sequentially numbered file names. These numbered MPEG-sequences are generated by a hardware encoder like WinTV-PVR from Hauppauge when you set the recording to be split into blocks of a specific size. In combination with the hardware decoder XCard from Sigma Designs you can play back these blocks time shifted, while the MPEG stream is still recording.

Most hardware encoders have a timeshift mode, but it doesn’t send the video signal to the TV-out of the XCard. In contrast, if you use different applications for playback and recording, many MPEG/DVD-players have problems getting access to the MPEG stream, while it is recording.

The solution is to continue the recording periodically, for example every 10 minutes, in a new file. Then you can play back all previous blocks with a maximum time offset of 10 minutes. Especially for playback in timeshift mode you need an MPEG/DVD-player (e.g. the XCard) which does not verify the existence of each file in a play list, while opening the play list. So by preparing the right play list, the playback will run without any interruptions until the end.

For WinTV-PVR you can adjust the file size in MBytes when a new block is being started by setting the registry key ’File_Record_Size’ (REG_DWORD) – ’HKEY_LOCAL_MACHINE\SOFTWARE\Hauppauge\hcwSlipWriter’. This causes the problem that the MPEG stream is simply continued in the next file, so that  the blocks, that follow the first one, may possibly contain an incorrect MPEG header.

Unfortunately many MPEG/DVD-players have problems opening these blocks. You can ’repair’ these blocks with a hex editor by copying the correct MPEG header of the first block to the beginning of each subsequent block. The few bytes of the MPEG stream, which are lost, can be neglected.

HeaderRepair automates this procedure and verifies every 200 ms if write access exists for the current block. As soon as this occurs, HeaderRepair writes a correct MPEG header to the beginning of the current block and moves on to the next block.

The correct MPEG header is taken from the file ’header.mpeg’. You can customize it by copying the desired bytes with a hex editor into this file. HeaderRepair gets this file from the same directory and reads the header until end of file (EOF). The header has to be at least 64 bytes but less than or equal to 2048 bytes!


Download of HeaderRepair english – 26.4 KBytes

Download of HeaderRepair german – 26.4 KBytes


Comments and suggestions to info@seconis.net.


© 2003, Hendrik Utsch