Skip to content

NHML Format

jeanlf edited this page Jan 9, 2020 · 3 revisions

HOME » MP4Box » NHML

The NHML (Network Hint Markup Language) format has been developed at Telecom ParisTech in order to provide import support on media formats not natively supported by GPAC, typically for ISOBMFF file constructions. It is an XML translation and extension of a binary format called NHNT Format used during the development of MPEG-4 Systems.

The NHML format is an XML-based description of a single media stream, allowing to specify media stream properties and media samples in GPAC. This format is supported since GPAC 0.4.2.

To obtain some sample NHML files, simply use MP4Box -nhml trackID srcFile

The NHML file format

Just like any XML file, the file must begin with the usual xml header. The file encoding SHALL BE UTF-8.

The root element of an NHML file is the NHNTStream element.

Syntax

<NHNTStream baseMediaFile="..." specificInfoFile="..." trackID="..." inRootOD="..." DTS_increment="..." timeScale="..." streamType="..." objectTypeIndication="..." mediaType="..." mediaSubType="..." width="..." height="..." parNum="..." parDen="..." sampleRate="..." numChannels="..." bitsPerSample="..." compressorName="..." codecVersion="..." codecRevision="..." codecVendor="..." temporalQuality="..." spatialQuality="..." horizontalResolution="..." verticalResolution="..." bitDepth="..." >

    <NHNTSample />    
        ...    
    <NHNTSample />
    
</NHNTStream>

Semantics

  • baseMediaFile : indicates the default location of the stream data. If not set, the file with the same name and extension .media is assumed to be the source.
  • specificInfoFile : indicates the location of the decoder configuration data if any.
  • trackID : indicates a desired trackID for this media when importing to IsoMedia. Value type: unsigned integer. Default Value: 0.
  • inRootOD : indicates if the imported stream is present in the InitialObjectDescriptor. Value type: "yes", "no". Default Value: "no".
  • DTS_increment : indicates a default time increment between two consecutive samples. Value type: unsigned integer. Default Value: 0.
  • timeScale : indicates the time scale in which the time stamps are given. Value type: unsigned integer. Default Value: 1000 or sample rate if specified.
  • streamType : identifies the media streamType as specified in MPEG-4 (0x04: Visual, 0x05: audio, ...). Officially supported stream types are listed here.
  • objectTypeIndication : identifies the media type as specified in MPEG-4. For example, 0x40 for MPEG-4 AAC. Officially supported object types are listed here.
  • mediaType : indicates the 4CC media type (handler) as used in IsoMedia. Not needed if streamType is specified. Value Type: 4 byte string. Officially supported handler types are listed here.
  • mediaSubType : indicates the 4CC media subtype (codec) to use in IsoMedia. This subtype will identify the sample description used (stsd table). Not needed if streamType is specified. Value Type: 4 byte string. Officially supported codec types are listed here.
  • widthheight : indicates the dimension of a visual media. Ignored if the media is not video (streamType 0x04 or mediaType "vide"). Value Type: unsigned integer.
  • parNumparDen : indicates the pixel aspect ratio of a visual media. Ignored if the media is not video (streamType 0x04 or mediaType "vide"). Value Type: unsigned integer.
  • sampleRate : indicates the sample rate of an audio media. Ignored if the media is not audio (streamType 0x05 or mediaType "soun"). Value Type: unsigned integer.
  • numChannels : indicates the number of channels of an audio media. Ignored if the media is not audio (streamType 0x05 or mediaType "soun"). Value Type: unsigned integer.
  • bitsPerSample : indicates the number of bits per audio sample for an audio media. Ignored if the media is not audio (streamType 0x05 or mediaType "soun"). Value Type: unsigned integer.

All other parameters are used when creating custum sample description in IsoMedia (eg, not using MPEG-4 streamType and ObjectTypeIndication). Their semantics are given in the QT (and IsoMedia) file format specification.

Each access unit is then described with a NHNTSample element.

Syntax

<NHNTSample DTS="..." CTSOffset="..." isRAP="..." isSyncShadow="..." mediaOffset="..." dataLength="..." mediaFile="..." xmlFrom="..." xmlTo="..." />

Semantics

  • DTS : decoding time stamp of the sample. If not set, the previous sample DTS (or 0) plus the specified DTS_increment or the previous sample duration is used. Value type: unsigned integer. Default Value: 0.
  • duration : sets the duration of the sample. The duration set on the last sample will change the track duration. Default Value: 0.
  • CTSOffset : offset between the decoding and the composition time stamp of the sample. Value type: unsigned integer. Default Value: 0.
  • isRAP : indicates if the sample is a random access point or not. Value type: "yes", "no". Default Value: "no".
  • isSyncShadow : indicates if the sample is a sync shadow sample (IsoMedia storage only). Value type: "yes", "no". Default Value: "no".
  • mediaOffset : indicates the position of the first byte of this sample in the media source file. Value type: unsigned integer. Default Value: 0.
  • dataLength : indicates the size of this sample. Value type: unsigned integer. Default Value: 0.
  • mediaFile : indicates the media source file to use. If not set, the baseMediaFile is used.
  • xmlFrom : if the source file is XML data, indicates the location of the first element to copy fom the XML document. The location can be "doc.start", "elt_id.start" or "elt_id.end". Elements are idendified through their "id", "xml:id" or "DEF" attributes.
  • xmlTo : if the source file is XML data, indicates the location of the last element to copy fom the XML document. The location can be "doc.end", "elt_id.start" or "elt_id.end". Elements are idendified through their "id", "xml:id" or "DEF" attributes.

XML bitstream constructor in NHML

Both NHNTStream and NHNTSample may use child bitstream constructors.

These elements allow assembling bytes and files as needed to construct the sample or the sampleDescription. For an NHNTStream element, the BS elements shall be encapsulated in an DecoderSpecificInfo element. The content of the DecoderSpecificInfo element is then inserted in the ESD (MPEG-4 Systems), or after the base sampleDescription (ISOBMFF generic).

Clone this wiki locally
You can’t perform that action at this time.