Ruben Laguna’s blog

How to Read Title in Sony PSP MP4 Files

If you had tried to read the title of a Sony PSP MP4 file with Ruby’s mp4info or Perl’s MP4::Info you probably noticed that the title is not stored in the NAM tag where it should be.

Those two libraries cannot access the title info in Sony PSP files because title info is stored in a propierary way in a custom uuid atom called USMT (User Media Tags).

Inside this atom there is child atom called MTDT (Meta Data) that lists meta data entries, one of them is the title. I found all this information in the movenc.c file from ffmpeg

+     PSP USMT->MTDT meta info block format  (some guessing)
+        - Note that clips play fine without this block.
+     int32    : size of MTDT block
+     char[4]  : "MTDT"
+     int16    : Number of sub-data blocks (payloads)
+                    0x0001 EOT markers have 1 block
+                    0x0004 is the most I've seen in an information block (title, date, etc)
+     Some number of data blocks, which take the form of:
+        int16   : size of sub-data block
+        int32   : block type ID  (possibly 2 int16s:  unk & type )
+                    0x01 = Title
+                    0x03 = Timestamp (date format = "+%Y-%m-%d %k:%M:%S")
+                    0x04 = Creator Name
+                    0x0A = End of Track Marker
+                    0x0B = UNKNOWN (appears in info MTDT blocks)
+        int16   : ?flags? - generally 0x55c4 or 0x15c7, seen 0x2a0e, possibly font or language?)
+                    - Timestamp seems to always have 0x55c4
+        int16   : type of payload that follows?  (int, string, etc..?)
+                    - Unicode strings have 0x0001
+                    - short[] data has 0x0000
+        data[]  : Payload (strings are UTF16-BE short[] with 0x0000 terminator)
+        BLOCK IDs
+           0x000A - Appear at end of tracks
+                - flags always = 0x55c4
+                - Payload looks like: 0x0000 0x0100 0x0000 0x0000
+           0x000B - Appears in meta data
+                - Payload looks like: 0x0000 0x?????  
+                - (0x???? probably flags- seen 0x1c02, 0x5cfe.  Maybe something with aspect ratio or frame rate?)

Currently neither mp4info nor MP4::Info are capable of decoding this USMTMTDT block. I’m looking into MP4::Info in order to add support for it. I will post something here if I got it working.UPDATE: I got it working read post