Main Menu

H264 MDPM tags

Started by HD65, June 05, 2011, 05:54:29 AM

Previous topic - Next topic

HD65

I have a question on the way the MDPM tags are stored.

Based on the great work here and elsewhere I created a small tool that extracts time/date/GPS info from H264 video streams and converts it to an SRT subtitle file.

See http://forum.videohelp.com/threads/316229-Export-AVCHD-frame-specific-metadata-to-subtitles

Tags usually start with 0x18 for date/time and then some. Each tag is followed by four bytes with data, as explained perfectly on https://exiftool.org/TagNames/H264.html#MDPM

But sometimes the tag is 0x00 or 0x01. So far, I just skip these, because the real tags+data simply seems to continue after it.

Is just skipping it correct? What is the meaning of these? Exiftools seems to know what to do with it...

Here is a dump from one of my video segments, with the bytes in question in red:

00000000  17 ee 8c 60 f8 4d 11 d9 8c d6 08 00 20 0c 9a 66 ...`.M...... ..f
00000010  4d 44 50 4d 1f 18 10 20 11 04 19 02 11 32 05 70 MDPM... .....2.p
00000020  ff 01 1f 7f 71 df 1f 0a ff 73 7f ff ff d3 7f 00 ....q....s......
00000030  00 a3 82 a1 00 c8 00 64 b0 02 02 00 00 b1 4e 00 .......d......N.
00000040  00 03 00 b2 00 04 00 01 b3 00 0b 00 01 b4 db 69 ...............i
00000050  03 e8 b5 45 00 00 03 00 b6 00 72 00 01 b7 00 00 ...E......r.....
00000060  03 00 01 b8 70 a7 03 e8 b9 00 00 03 00 00 ba 04 ....p...........
00000070  87 00 0a bb 00 03 00 01 bc 00 20 00 01 bd 17 70 .......... ....p
00000080  03 e8 be 41 00 00 03 00 bf 33 00 00 03 00 c1 4b ...A.....3.....K
00000090  00 00 03 00 c2 00 00 03 00 0a c3 54 00 00 03 00 ...........T....


Phil Harvey

It looks like you aren't properly processing the NAL unit to convert the 0x000003's.

See the exiftool H264.pm source code for details. (It is included in all distributions, but easiest to find in the full distribution: lib/Image/ExifTool/H264.pm)

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

HD65

Ahh! So since 0x000000 and 0x000001 have special meaning in H264 they need to be encoded. If I simply replace all 0x000003 by 0x0000 (like your code seems to do) I should be fine.

I am no real expert in H264 as you can tell. Hope there aren't any other recodings required - H264.pm does not seem to have more either.

Thanks.