Parse Humax 5050C metadata files
This one is related to the post describing the workflow to transfer and transcode video files from a Humax 5050C.
This time I will describe how I read the metadata that is stored in the .hmt file on the Humax. The most important reason: to show the description of the recorded event.
Humax 5050C details
The Humax 5050C stores video files as single program transport streams (SPTS), and for each recording it also stores a metadata file (.hmt).
The structure of this file is described in great detail on the page where you can also download a Windows tool to send files from and to the Humax 5050C. It is a highly recommended read if you are interested in the nitty gritty stuff!
Structure of .hmt file
I am not going to describe it in too much detail, for that you should download the PDF from Peter.
- The file starts with static information about the date, event that we wanted to record, channel, etc.
- After this 1 or more events follow. Example: I want to record the program “yes”, but because the recording starts a bit early and stops late, the actual list of events is “no, yes, no, no”. In another case it could be “yes, no”. Etc. So by comparing the first event name with each of the names from this event list, we know which description to pick.
- Each event contains a description, which is broken up in 1 or more blocks of max 250 bytes.
The high-level structure:
0x0011 channel number
0x0120 event name
0x0220 channel name
0x1000 number of events
0x1004 first event (repeat for each event)
+0x02 unique ID of the event
+0x15 name of the event
+0x21 size of the event (to calculate start of next event)
+0x224 number of description blocks (each block max 250 chars)
+0x234 start of first description block (repeat for each block)
+0 length of this block
+3 description block
Hex editor tool
It is quite helpful to have access to a Hex editor, the one I used is 0xED. The default Mac calculator tool is also useful, you probably want to set it to Programmer mode.
Download the script
Click to view the complete script, right-click to save (remove the .txt extension).
It is written in Perl. I am not an expert Perl programmer, so it is more pseudo-code than real Perl code. 😉[Download not found]
Suggestions, thoughts, etc? Let me know and/or leave a comment.