AVCHD metadata are stored in an SEI message of type 5 (user data unregistered). These messages start with a GUID (indicating the type of the data). The rest is not specified in the H.264 spec. For AVCHD metadata the data structure is as follows:
1. The 16 byte GUID, which consists of the bytes
0x17 0xee 0x8c 0x60 0xf8 0x4d 0x11 0xd9 0x8c 0xd6 0x08 0x00 0x20 0x0c 0x9a 0x66
2. 4 bytes
0x4d 0x44 0x50 0x4d
which are "MDPM" in ASCII.
3. One byte, which specifies the number of tags to follow
4. Each tag begins with one byte specifying the tag type followed by 4 bytes of data.
The date and time are stored in tags
0x18
and 0x19
.Tag
0x18
starts with an unknown byte. I saw values between 0x02
and 0xff
in various files. It seems however that it has a constant value for all frames in a file. The 3 remaining bytes are the year and the month in BCD coding (0x20 0x09 0x08
means August 2009).The 4 bytes in tag
0x19
are the day, hour, minute and second (also BCD coded).There are more informations stored in this SEI message, check here for a list.
If you want to make further research on this, you can download gmerlin-avdecoder from CVS, open the file
lib/parse_h264.c
and uncomment the following line (at the very beginning):// #define DUMP_AVCHD_SEI
Then you can use
bgavdump
on your files. It will decode the first 10 frames from the file. If you want to decode e.g. 100 frames, usebgavdump -nf 100 your_file.mts