A rather complete description of MP4Box functionalities and various switches.
Documentation of GPAC specific handling of MPEG-4 scene description textual formats: BT and XMT-A.
Generic multiplexing languages to manipulate any media format with GPAC and MP4Box.
Description of 3GPP/MPEG-4 Timed Text tracks for subtitles, tickers ...
Encrypting and decrypting content according to ISMA E&A and OMA DRM 2.0 specifications.
BT stands for BIFS Text and is an exact textual representation of the MPEG-4 BIFS scene. Its syntax is the same as the VRML/X3D (.wrl and .x3dv files) ones for the scene description part, and it has been extended for other MPEG-4 tools (OD, OCI, IPMP).
You will find plenty of example BT files in the tutorial and regression test suite, and we strongly recommend using these to get more familiar with the BT syntax.
The BT language has been originally developped at ENST as the textual format of the late MP4Tool. The format is still enhanced at ENST for GPAC needs, but we try not to mess up too much with it to keep VRML compatibility.
There are 3 major parts in a BT file:For example, RAP AT 1000 IN 20 { ... } means that the access unit is a random access point, its timing is 1000 (in stream timescale) and it happens in stream whose ES_ID is 20.
The syntax of the 'AT TIMING' element has been extended to support differential timing to enable authors to specify relative
time between commands rather than absolute timing. The differential timing is signaled by using a capital D before the timing itself.
For example, AT D2000 { ... } means that this access unit occurs 2000 time ticks after the preceding access unit.
MP4Box uses a specific descriptor for stream importing called MuxInfo. This descriptor is not normative (although used by MP4Tool and all tools from MPEG-4 Systems Reference Software). It is never encoded in the file. The modifications made to this descriptor are backward compatible with other tools using this descriptor. The current syntax is:
| MuxInfo { |
| fileName |
| streamFormat |
| GroupID |
| startTime |
| duration |
| frameRate |
| useDataReference |
| noFrameDrop |
| SBR_Type |
| compactSize |
| textNode |
| fontNode |
| } |
fileName : specifies location of stream to import. Optional for BIFS/OD streams, required for others. Supported formats are the same as those supported by MP4Box:
streamFormat : optional, one of "AVI", "MP3", "JPEG", "PNG", "MP4", "NHNT", "SRT" depending on input type. This should not be needed as MP4Box uses the file extension to figure out the media format, it is kept for old BT compatibility.
GroupID : optional integer, specifies the multiplexing order in the final mp4. Media tracks are interleaved by groups, the group with the lowest ID being written first to disk. Using groups may greatly improve http streaming of the file.
startTime : optional integer, specifies the DTS/CTS of the first sample - by default the first sample imported has CTS/DTS 0. Expressed in milliseconds.
duration : optional integer, specifies run-time of media data (from source start) to import. Expressed in milliseconds.
Note : When creating OCR tracks in MP4, you must use the muxInfo.duration to specify the desired duration of the OCR track, otherwise the OCR track won't have any associated duration and will never stop (looping not possible).
useDataReference : optional boolean, specifies that media data shall not be copied in the final MP4 but only referenced. This may not be supported depending on input data framing. cf '-dref' option in MP4Box.
frameRate : overrides the source media framerate when possible (same as MP4Box -fps).
noFrameDrop : optional boolean for AVI import only, specifies that video shall be imported at constant frame rate, eg non coded frames in AVI file shall be kept in MP4. cf '-nodrop' option in MP4Box.
SBR_Type : optional string for AAC-SBR import only, either "implicit" or "explicit" - cf MP4Box -sbr and -sbrx options.
compactSize : optional string, either "TRUE" or "FALSE", indicating if sample sizes should be stored in a compact way or not.
textNode, fontNode : required string identifier for SRT importing, ignored for other streams. SRT importing is done by creating a BIFS animation stream carrying the text and fonts modifications (sample available in regression test suite).
There is no standard element in XMT-A allowing to describe multiplexing parameters for MP4. In order to do this MP4Box uses an XML representation of MuxInfo in the StreamSource sub elements (encoding hints) called MP4MuxHints.
The complete syntax is:| <StreamSource url="filename" > |
| <MP4MuxHints GroupID="..." startTime="..." duration="..." useDataReference="..." noFrameDrop="..." SBR_Type="..." frameRate="..." compactSize="..." textNode="..." fontNode="..." /> |
| </StreamSource> |
The streamFormat parameter is not represented in XMT-A.
Note When decompressing an mp4 file to bt (XMT-A), a MuxInfo (MP4MuxHints) is automatically generated for all streams other than BIFS and OD in order to keep track of media location in the original MP4. You can then simply modify and reencode the BT or XMT file without specifying the media data location.
| RAP AT time IN esID { .... } |
| <par begin="time" atES_ID="esID" isRAP="yes" > ... </par> |
| REPLACE nodeName.fieldName BY newValue |
| <Replace atNode="nodeName" atField="fieldName" value="newValue" /> |
| REPLACE nodeName.fieldName BY NodeDeclaration {... } |
| <Replace atNode="nodeName" atField="fieldName" > |
| <NodeXXX /> |
| </Replace> |
| REPLACE nodeName.fieldName[idx] BY newValue |
| <Replace atNode="nodeName" atField="fieldName" position="idx" value="newValue" /> |
| REPLACE nodeName.fieldName BY [value1 ... valueN] |
| REPLACE nodeName.fieldName BY [Node { ... } ... Node { ... }] |
| <Replace atNode="nodeName" atField="fieldName" value="value1 ... valueN" /> |
| <Replace atNode="nodeName" atField="fieldName" > |
| <NodeXXX>...</NodeXXX> |
| <NodeXXX>...</NodeXXX> |
| </Replace> |
| DELETE nodeName |
| DELETE nodeName.fieldName |
| <Delete atNode="nodeName" /> |
| <Delete atNode="nodeName" atField="fieldName" /> |
| DELETE nodeName.fieldName[idx] |
| <Delete atNode="nodeName" atField="fieldName" position="idx" /> |
| INSERT AT nodeName.fieldName[idx] newValue |
| APPEND TO nodeName.fieldName newValue |
| <Insert atNode="nodeName" atField="fieldName" position="idx" value="newValue" /> |
| INSERT AT nodeName.fieldName[idx] Node { } |
| APPEND TO nodeName.fieldName Node { } |
| <Insert atNode="nodeName" atField="fieldName" position="idx" > |
| <NodeXXX>...</NodeXXX> |
| </Insert> |
| REPLACE ROUTE routeName BY nodeName1.fieldName1 TO nodeName2.fieldName2 |
| <Replace atRoute="routeName"> |
| <ROUTE fromNode="nodeName1" fromfield="fieldName1" toNode="nodeName2" toField="fieldName2" /> |
| </Replace> |
| INSERT ROUTE nodeName1.fieldName1 TO nodeName2.fieldName2 |
| <Insert> |
| <ROUTE fromNode="nodeName1" fromfield="fieldName1" toNode="nodeName2" toField="fieldName2" /> |
| </Insert> |
When encoding an interaction stream descriptor, MP4Box must find at least:
When encoding a regular ES_Descriptor, MP4Box must find at least:
For systems streams, if the SLConfigDescriptor is not found, MP4Box uses a stream timescale of 1000, otherwise it uses SLConfigDescriptor.timestampResolution as stream timescale.
When the InitialObjectDescriptor is not found in the BT file, MP4Box will create one for you.
The macro must be defined on a single line as follows:
| #define MACRO_NAME REP LAC E MENT STR ING |
The BT parser will simply replace any occurence of the macro by its value.
Here is an example of a BT macro:| #define MYAPP Appearance { material Material2D { emissiveColor 1 0 0 filled TRUE} } |
| #define MYCOORDS 200 20 |
| Transform2D { |
| translation MYCOORDS |
| children [ |
| Shape { |
| appearance MYAPP |
| geometry Rectangle { size 20 20 } |
| } |
| ] |
| } |
(C) 2000-05 JLF / (C) 2005-0X ENST - $Date: 2007/08/30 13:19:19 $ - Webmaster