Difference between revisions of "HMT File Format"

From hummy.tv Wiki
Jump to: navigation, search
m
m (Correct endian-ness of BST offset value.)
 
(7 intermediate revisions by 3 users not shown)
Line 1: Line 1:
See also update notes below
+
=== Standard .hmt file format ===
 
 
 
<pre>
 
<pre>
 
Offset Size Content
 
Offset Size Content
 
------  -----  ----------------------------------  Header Block, Size 0x1004 (4100) bytes ---------------------------------------------
 
------  -----  ----------------------------------  Header Block, Size 0x1004 (4100) bytes ---------------------------------------------
 
0x0000 2 byte 0x1701 Constant.
 
0x0000 2 byte 0x1701 Constant.
0x0000 126 byte All Nulls.Constant
+
0x0002 126 bytes All Nulls. Constant.
 
0x0080 string 254 byte max Recording file path e.g. "/media/sda1/My Video/" (not needed when creating hmt)
 
0x0080 string 254 byte max Recording file path e.g. "/media/sda1/My Video/" (not needed when creating hmt)
 
0x0180 string 256 byte max Recording  date-extended file name e.g. "The One Show_21010816_1817"
 
0x0180 string 256 byte max Recording  date-extended file name e.g. "The One Show_21010816_1817"
Line 18: Line 17:
 
bit 0 00000001 On-Disk Encrypted flag. 1 = Encrypted. 0 = Decrypted
 
bit 0 00000001 On-Disk Encrypted flag. 1 = Encrypted. 0 = Decrypted
 
bit 1 00000010 Thumbnail exists flag. 1 = Yes. 0 =  No
 
bit 1 00000010 Thumbnail exists flag. 1 = Yes. 0 =  No
 +
        bit 2 00000100 1 = Recording failed, Loss of Power (not set by firmware(?) uses 0x28C=01 instead)
 +
        bit 3 00001000 1 = Recording deleted by Auto Delete
 
0x0290  1 byte  00          Failed recording code - see table below.
 
0x0290  1 byte  00          Failed recording code - see table below.
 
0x0294 4 bytes 0x44332211 Played time in seconds (used by resume). 0x00 if unplayed or played to end.
 
0x0294 4 bytes 0x44332211 Played time in seconds (used by resume). 0x00 if unplayed or played to end.
Line 24: Line 25:
 
0x031C 4 bytes Start of bookmark table. Maximum 32  x 4 byte entries (seconds from start).  
 
0x031C 4 bytes Start of bookmark table. Maximum 32  x 4 byte entries (seconds from start).  
 
0x03DC 1 byte 0x00 Flags byte.
 
0x03DC 1 byte 0x00 Flags byte.
bit 1 00000010 'Encrypted' flag. 1 = Encrypted. Used to determine if decryption on copy to USB is allowed.
+
bit 1 00000010 'Copy Limited' flag. 0 = Unlimited copies. If set, copy count limit is in offset 0x431.
bit 2 00000100 'Copy Allowed' flag. 1 = copy allowed. (If zero, Number of allowed copies is in offset 0x431)
+
bit 2 00000100 'Encrypted' flag. 1 = Decryption allowed. Determines if decryption on copy to USB is allowed.
 
0x03E0 1 byte Media list Guidance Type - see table below.
 
0x03E0 1 byte Media list Guidance Type - see table below.
 
0x03E1  1 byte Media list Guidance Mode - see table below.
 
0x03E1  1 byte Media list Guidance Mode - see table below.
 
0x03E2 1 byte 0x15 String header (only if guide is on).
 
0x03E2 1 byte 0x15 String header (only if guide is on).
 
0x03E5 string 74 chars max. Guide text for Media list.(only if guide is on).
 
0x03E5 string 74 chars max. Guide text for Media list.(only if guide is on).
0x0431 1 byte 0x00 Number of copies allowed when Unlimited Copies' flag is zero in 0x3DC
+
0x0431 1 byte 0x00 Number of copies allowed when 'Copy Limited' flag is set in 0x3DC
0x0434 2 byte 0x2211                  Daylight Savings seconds offset. 0x100E = BST,  0x0000 = GMT
+
0x0434 2 byte 0x2211                  Daylight Savings seconds offset. 0x0E10 = BST,  0x0000 = GMT
 
0x0458 4 byte 0x44332211 Channel number.
 
0x0458 4 byte 0x44332211 Channel number.
 
0x045C 1 byte 0x15 String header.
 
0x045C 1 byte 0x15 String header.
Line 39: Line 40:
 
0X048C 2 byte 0x2211 Originating Network ID (ONID).
 
0X048C 2 byte 0x2211 Originating Network ID (ONID).
 
0x048E 2 byte 0x2211 Program Map Table (PMT) PID.
 
0x048E 2 byte 0x2211 Program Map Table (PMT) PID.
0x0490 2 bytes 0x2211 Video PID.
+
0x0490 2 bytes 0x2211 Video PID for TV recording, or Audio PID for radio recording.
0x0493 1 byte 0x20 Constant.
+
0x0492 2 bytes 0x0020 Constant.
0x0494 2 bytes 0x2211 Video PID.
+
0x0494 2 bytes 0x2211 Video PID, or 0x0020 for radio recording.
0x0498 1 byte 0x11 Video Type MPEG2=0x01, H264=0x02.
+
0x0498 1 byte 0x11 Video Type MPEG2=0x01, H264=0x02, Radio-0x00.
0x049C 2 bytes 0x2211 Audio PID.
+
0x049C 2 bytes 0x2211 Audio PID for both TV and radio recordings.
 
0x04A0 1 byte 0x00 Audio Type MPEG=0x01 AC3=0x03 AAC=0x07.
 
0x04A0 1 byte 0x00 Audio Type MPEG=0x01 AC3=0x03 AAC=0x07.
 
0x04A5 1 byte 0x20 Constant.
 
0x04A5 1 byte 0x20 Constant.
0x04AD 1 byte 0x20 Constant
+
0x04AD 1 byte 0x20 Constant.
0x04B8 1 byte 0x01 Constant??
+
0x04B8 1 byte 0x01 Recording type. 0x01=TV, 0x02=Radio.
0x04BC 1 byte 0x00 Video type flag for Media list. 0x01 = SD. 0x02 = HD.
+
0x04BC 1 byte 0x00 Video type flag for Media list. 0x01 = SD. 0x02 = HD, 0x00 = Radio.
0x04C0 1 byte 0x01 Constant ??
+
0x04C0 1 byte 0x01 Constant.
0x04C4 1 byte 0xFF Constant ??
+
0x04C4 1 byte 0xFF Constant.
 
0x04F8 4 byte 0x44332211 Program scheduled start date & time (Epoch format).
 
0x04F8 4 byte 0x44332211 Program scheduled start date & time (Epoch format).
 
0x04FC 4 bytes 0x44332211 Program scheduled duration (seconds).
 
0x04FC 4 bytes 0x44332211 Program scheduled duration (seconds).
Line 126: Line 127:
 
0x026A string 74 chars max. Guide text for iPlate (only if guide is on).
 
0x026A string 74 chars max. Guide text for iPlate (only if guide is on).
 
0x02BC 4 byte 0xC0320000 12288 (0x3000) + 704. Byte offset to start of next EPG block.
 
0x02BC 4 byte 0xC0320000 12288 (0x3000) + 704. Byte offset to start of next EPG block.
 +
</pre>
  
 +
=== Fields ===
 +
<pre>
 
Guidance Flag
 
Guidance Flag
 
-------------
 
-------------
Line 179: Line 183:
 
Additional information provided by af123 and GrahamCobb.
 
Additional information provided by af123 and GrahamCobb.
 
</pre>
 
</pre>
 +
 +
=== Custom Firmware Extensions ===
 +
 +
<pre>
 +
0x0010  1 byte                          Series number.
 +
0x0011  1 byte                          Episode number.
 +
0x0012  1 byte                          Episodes in series.
 +
0x073D 4 bytes 0x656E6700 Null terminated string 'eng'
 +
        First character 'E' indicates recording has been shrunk.
 +
        Second character 'N' indicates recording has been de-duped.
 +
        Third character 'G' indicates ad-detection has been performed.
 +
</pre>
 +
 +
=== Notes ===
  
 
Notes by escat :-
 
Notes by escat :-
  
 
*The file name field has moved from offset 017F to 0180. Both variants may be found depending on the age of the recording. Although the Humax software doesn't appear to use this field, other CF packages may do so. For example, af123 has already modified the hmt utility to accommodate this change. However, the Nicesplice package still appears to create hmt files with the old format, even when the original recording had the new format.
 
*The file name field has moved from offset 017F to 0180. Both variants may be found depending on the age of the recording. Although the Humax software doesn't appear to use this field, other CF packages may do so. For example, af123 has already modified the hmt utility to accommodate this change. However, the Nicesplice package still appears to create hmt files with the old format, even when the original recording had the new format.
*af123 also informs me that offset 073D is used to hold the character 'E' for recordings that have been stripped of their EPG frames.
 

Latest revision as of 00:11, 18 September 2018

Standard .hmt file format

Offset	Size				Content
------  -----   ----------------------------------  Header Block, Size 0x1004 (4100) bytes ---------------------------------------------
0x0000	2 byte	0x1701			Constant.
0x0002	126 bytes			All Nulls. Constant.
0x0080	string	254 byte max		Recording file path e.g. "/media/sda1/My Video/" (not needed when creating hmt)
0x0180	string	256 byte max		Recording  date-extended file name e.g. "The One Show_21010816_1817"
0x0280	4 byte	0x44332211		Recording start time (Epoch format)
0x0284	4 byte	0x44332211		Recording end   time (Epoch format)
0x0288	4 byte	0x44332211              Recording duration in seconds - set but not used by HumaxTV(?), uses End-Start instead
0x028C	1 byte	0x02			Recording 00=zero length, 01=Recording in progress/power loss, 02=valid, 03=scrambled, 04=failed
0x028D	1 byte	0x00			Flags byte.
	bit 2	00000100		'Locked' flag. 1 = Locked.
	bit 3	00001000		'New' flag.    0 = New.		
0x028E	1 byte	0x00			Flags byte.
	bit 0	00000001		On-Disk Encrypted flag. 1 = Encrypted. 0 = Decrypted
	bit 1	00000010		Thumbnail exists flag. 1 = Yes. 0 =  No
        bit 2	00000100		1 = Recording failed, Loss of Power (not set by firmware(?) uses 0x28C=01 instead)
        bit 3	00001000		1 = Recording deleted by Auto Delete
0x0290  1 byte  00           		Failed recording code - see table below.
0x0294	4 bytes	0x44332211		Played time in seconds (used by resume). 0x00 if unplayed or played to end.
0x0298	1 byte	0x00			Bookmark count
0x029A	string	48 chars max.		Program name for Media List.
0x031C	4 bytes				Start of bookmark table. Maximum 32  x 4 byte entries (seconds from start). 
0x03DC	1 byte	0x00			Flags byte.
	bit 1	00000010		'Copy Limited' flag. 0 = Unlimited copies. If set, copy count limit is in offset 0x431.
	bit 2	00000100		'Encrypted' flag. 1 = Decryption allowed. Determines if decryption on copy to USB is allowed.
0x03E0	1 byte				Media list Guidance Type - see table below.
0x03E1  1 byte				Media list Guidance Mode - see table below.
0x03E2	1 byte	0x15			String header (only if guide is on).
0x03E5	string	74 chars max.		Guide text for Media list.(only if guide is on).
0x0431	1 byte	0x00			Number of copies allowed when 'Copy Limited' flag is set in 0x3DC
0x0434	2 byte	0x2211                  Daylight Savings seconds offset. 0x0E10 = BST,  0x0000 = GMT
0x0458	4 byte	0x44332211		Channel number.
0x045C	1 byte	0x15			String header.
0x045D	string	42 chars max.		Channel name.
0x0488	2 byte	0x2211			Service ID (SID).
0x048A	2 byte  0x2211			Transport Stream ID (TSID).
0X048C	2 byte	0x2211			Originating Network ID (ONID).
0x048E	2 byte	0x2211			Program Map Table (PMT) PID.
0x0490	2 bytes	0x2211			Video PID for TV recording, or Audio PID for radio recording.
0x0492	2 bytes	0x0020			Constant.
0x0494	2 bytes	0x2211			Video PID, or 0x0020 for radio recording.
0x0498	1 byte	0x11			Video Type MPEG2=0x01, H264=0x02, Radio-0x00.
0x049C 	2 bytes 0x2211			Audio PID for both TV and radio recordings.
0x04A0	1 byte	0x00			Audio Type MPEG=0x01 AC3=0x03 AAC=0x07.
0x04A5	1 byte	0x20			Constant.
0x04AD	1 byte	0x20			Constant.
0x04B8	1 byte	0x01			Recording type. 0x01=TV, 0x02=Radio.
0x04BC	1 byte	0x00			Video type flag for Media list. 0x01 = SD. 0x02 = HD, 0x00 = Radio.		
0x04C0	1 byte	0x01			Constant.
0x04C4	1 byte	0xFF			Constant.
0x04F8	4 byte	0x44332211		Program scheduled start date & time (Epoch format).
0x04FC	4 bytes	0x44332211		Program scheduled duration (seconds).
0x0514	1 byte	0x00			Program genre code (see table).
0x0516 	3 bytes	0x106937		String header.
0x0519  string	48 byte max.		Program Name for Guide & iPlate.
0x0616 	3 bytes	0x106937		String header.
0x0619  string 252 byte max.		Program synposis text for Media list.
0x0716	2 bytes				EPG data - Event ID
0x073B	1 byte				iPlate Guidance Type - see table below.
0x073C  1 byte				iPlate Guidance Mode - see table below.
0x073D	4 bytes 0x656E6700		Null terminated string 'eng'
0x0741	1 byte 0x15			String header (only if guide is on).
0x0742	string	74 chars max.		Guide text for iPlate (only if guide is on).
0x0798	128 byte			Data block. Purpose unknown. Contains data block common to all HMT files.
Recordings not using padding (Accurate Recording) have a size of 2072 bytes so anything beyond here is not necessary to create an hmt file.
0x0818	2024 bytes		        All Nulls.Constant
0x1000	4 byte	0x44332211		Number of EPG Blocks following

------  -----   ---------------------------------- EPG Header List Block, Size 8188 bytes (starts at 0x1004) ---------------------

0x0000	32 byte	blocks			Copy of 32 byte header from EPG blocks following. One entry for each EPG block.
0x0020
0x0040					Next EPG block header (if any)
				
------  -----   ---------------------------------- EPG Block type 01, Size 192 bytes (starts at 0x3000)---------------------------

0x0000   1 byte   0x01                 Constant
0x0009   1 byte   0x30                 Constant
0x000C   1 byte   0xA0                 Constant
The remaining 160 bytes in this block mirrors those contained in the main header block at offset 0x458 to 0x4F7
0x0020   4 byte                        Channel Number
0x0024   1 byte   0x15                 String header.
0x0025  43 byte                        Channel name.
0x0050   2 byte                        Program ID (SID).
0x0052   2 byte                        Transport Stream ID (TSID)
0X0054   2 byte                        Originating Network ID (ONID).
0x0056   2 byte                        Program Map Table (PMT).
0x0058   2 byte                        Video PID.
0x005A   2 bytes 0x0020                Constant.
0x005C   2 byte                        Video PID
0x0060   1 byte                        Video Type MPEG2=0x01,  H264=0x02.
0x0064   2 byte                        Audio PID.
0x0068   1 byte                        Audio Type MPEG=0x01 AC3=0x03 AAC=0x07.
0x006D   1 byte   0x20                 Constant
0x0075   1 byte   0x20                 Constant
0x0080   1 byte   0x01                 Constant
0x0084   1 byte                        Video type flag for Media list. 0x01 = SD. 0x02 = HD.
0x0088   1 byte   0x01                 Constant
0x008C   1 byte   0xFF                 Constant

------  -----   ----- EPG Block type 02(event block) Size 704 bytes,including 32 byte header (first block starts at 0x30C0) -----

++++++ Start of 32 byte header +++++++++
0x0000	4 byte	0x02000000	
0x0004	4 byte	0x00000000		Time in seconds from start of recording to change the iPlate info to this EPG block
0x0008	4 byte	0x00300000		12288. Byte Offset to start to EPG block (increments by 704 for each EPG entry.
0x000C	4 byte	0xA0020000
0x0010 16 byte				Unused
++++++ End of 32 byte header ++++++++++
0x0020	4 byte	0x44332211		Program scheduled start date & time (Epoch format).
0x0024	4 bytes	0x44332211		Program scheduled duration (seconds).
0x0028	1 byte	0x04
0x003C	1 byte	0x11			Program genre code. (see table)
0x003E	3 byte	0X106937		String Header.
0x0041	string				Program name for EPG.
0x013E	3 byte	0X106937		String Header.
0x0141	string	252 byte max.		Program synposis text for iPlate.
0x0262	1 byte	0x11			Flag
0x0263	1 byte				Guidance Type - see table below.
0x0264  1 byte                          Guidance Mode - see table below.
0X0265  string	0x656E67		"eng".  Language for guide text.
0x0268	1 byte	0x00			Null terminator for string.
0x0269	3 byte 0x106937			String header (only if guide is on).
0x026A	string 74 chars max.		Guide text for iPlate (only if guide is on).
0x02BC	4 byte	0xC0320000		12288 (0x3000) + 704. Byte offset to start of next EPG block.

Fields

Guidance Flag
-------------
Type Mode Meaning
---- ---- -------
ff   0  Guidance off
0    *  Guidance on
1    0  General guidance on (e.g. strobe lighting)
1    1  Guidance on

Genre Code Table
----------------
0x00 = Unclassified
0x10 = Movie
0x20 = News and Factual
0x30 = Entertainment
0x40 = Sport
0x50 = Childrens
0x60 = Entertainment
0x70 = News and Factual
0x80 = News and Factual
0x90 = Education
0xA0 = Lifestyle
0xF0 = Drama

Failed Recording Codes
----------------------
 1: The disk was full
 2: Conflicted with another recording
 3: The maximum number of files per folder was reached
 4: Recording (less than 30 secs) may not be stored
 5: Lack of signal
 8: Conflicted with another recording
13: Incomplete: the disk was full
15: No storage device detected
16: Incomplete: the USB storage device was removed
17: The programme appears not to have been broadcast
18: Loss of power
19: Conflicted with higher priority recording
20: Unable to track programme

String headers (Character tables As defined in EN 300 468 Annex A.2).
--------------------------------------------------------------------
0x15     = UTF-8
0x106937 = ISO/IEC 6937 (unconfirmed use of BCD to denote format)

String header parsing
---------------------
If first byte is 0x20 or above skip 0 bytes, if 0x10 then skip 3 bytes, if 0x1F then skip two bytes, otherwise skip 1 byte.

Original file analysis by raydon
Additional information provided by af123 and GrahamCobb.

Custom Firmware Extensions

0x0010  1 byte                          Series number.
0x0011  1 byte                          Episode number.
0x0012  1 byte                          Episodes in series.
0x073D	4 bytes 0x656E6700		Null terminated string 'eng'
        First character 'E' indicates recording has been shrunk.
        Second character 'N' indicates recording has been de-duped.
        Third character 'G' indicates ad-detection has been performed.

Notes

Notes by escat :-

  • The file name field has moved from offset 017F to 0180. Both variants may be found depending on the age of the recording. Although the Humax software doesn't appear to use this field, other CF packages may do so. For example, af123 has already modified the hmt utility to accommodate this change. However, the Nicesplice package still appears to create hmt files with the old format, even when the original recording had the new format.