Main Menu

H264-metadata support?

Started by FactFinder, February 08, 2016, 10:17:13 AM

Previous topic - Next topic

FactFinder

Hi there,

H.264, like some other video encoding standards, has some metadata fields that may contain user-defined, readable data. An example for H264 is the data in the 'Supplemental enhancement information' (with NAL unit type = 6). This can contain readable strings with interesting (to some) information.
An example would be an mp4-video recorded with Instagram, which uses Lavf55.19.104 for encoding, and leaves all sorts of info in the 'Supplemental enhancement information', like the encoder version etc (eg: x264 - core 142 r2 956c8d8 - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - http://www.videolan.org/x264.html, and more).

Would it by any chance be possible to impement such custom fields into ExifTool?


At any rate, keep up the great work, it is appreciated!

Phil Harvey

ExifTool can decode metadata from H264 in a M2TS container.  I have looked into decoding this in MP4 video streams, but haven't yet been able to find a good source describing how this is formatted.  It appears sufficiently different from the H264 stream in M2TS files.  It is on my list of things to do, but will take some effort to figure this out.

- 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 ($).

FactFinder

#2
The main difference I know of is that M2TS or raw H.264-streams use the Byte Stream Format, which means each NAL unit is preceded by a start code prefix (0x000001 or 0x00000001), and 3GP/MP4/MOV does not. In 3GP/MP4/MOV the start code prefix is replaced by a 4-byte length field (can also be 1 or 2 bytes, but usually it is 4). Reference to the Byte Stream Format can be found in ISO 14496-10, chapter 6.1, and I've found reference to the other type at https://msdn.microsoft.com/en-us/library/windows/desktop/dd757808(v=vs.85).aspx.
Also, in 3GP/MP4/MOV you may find the required Sequence Parameter Set and Picture Parameter Set headers in a separate place, being in the avcC box (AVC Decoder Configuration) as specified in ISO 14496-15, in stead of as a part of the frame data in the mdat box.

Don't know if this is what you mean..?

Phil Harvey

These are some good hints, thanks.  I'll see what I can do.

- 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 ($).

FactFinder

 :D

You're welcome, of course, and: great! Your tool really saved me a lot of time so far, so I very much appreciate all your work.

Phil Harvey

I can now decode the H264 video data stream in MOV/MP4 videos, so I have the ability to extract this information now but none of my samples contain a NAL unit type 6.  If you give me a sample I will see what I can do.

- 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 ($).