Skip to main content

TrFile_GetFileStructure (function reference)

Troi File Plug-in > Functions reference > TrFile_GetFileStructure
Troi File Plug-in for FileMaker Pro

TrFile_GetFileStructure

Returns the file structure of a (movie) file.

SyntaxFunction badge

TrFile_GetFileStructure ( switches ; filePath )

Parameters

switches these determine the metadata that is returned
filePath the path to the file

Switches

You need to add the following switch:

-GetMovieBoxes gets the moviebox structure of the movie

With an extra -Format switch you can specify how the movie structure is returned:

-Format=List (default) format the result as a readable list
-Format=XML format the result as XML

You can also add this switch:

-Verbose add extra information to the result

Returned Result

Data type returned

Text

Result

the requested structure as list or XML.

Returned error codes can be:

$$-4290 kErrFormatNotSupported cannot get the file structure (not supported)
$$-43 fnfErr file not found

Originated in

Troi File Plug-in 10.0

Compatibility

FileMaker Pro 16 to FileMaker Pro 2023

Considerations

This function can analyze a movie file (.mov) and return a list of all movie boxes (formerly known as atoms) in the movie. The movie boxes are indented to visualize the tree structure of the boxes. The result can be formatted as XML or as a more readable list of movie boxes. It can also return the structure of a ISOBMFF (ISO base media file format), for example MP4 or HEIC.
From the movie structure you can for example determine how many tracks a movie has.

Example

Set Variable [ $Result ; TrFile_GetFileStructure ( "-GetMovieBoxes" ; "MacHD:IMG_4200,MOV" ) ]

This will get the movie structure in a readable list format. The result will look like this:

Moviebox ftyp of size: 32
Moviebox moov of size: 83491
	Moviebox mvhd of size: 108
	Moviebox trak of size: 34983
	...
	Moviebox udta of size: 42
		Moviebox WLOC of size: 12
		Moviebox SelO of size: 9
Moviebox mdat of size: 22649590

Example 2

Set Field [ result ; TrFile_GetFileStructure ( 
                          "-GetMovieBoxes -Format=XML -Verbose" ;  $FilePath ) ]

This will return the structure as XML. The result will look like this:

<movie>
   <box>
      <type>ftyp</type>
      <size>32</size>
      <field>
         <name>mayor brand</name>
         <value>qt  </value>
      </field>
      <field>
         <name>minor version</name>
         <value>2005.3.0</value>
      </field>
   </box>
   <box>
      <type>mdat</type>
      <size>22649590</size>
   </box>
   <box>
      <type>moov</type>
      <size>83491</size>
      <box>
         <type>mvhd</type>
         <size>108</size>
      </box>
      <box>
         <type>trak</type>
         <size>34983</size>
      ...
      </box>
   </box>
</movie>

Used in example file

GetStructure.fmp12

Related functionFunction badge

TrFile_GetMetaData

Related topics

Troi File Plug-in online help (overview)


Online Help Page for Troi File Plug-in for 16 to 2023 –> TrFile_GetFileStructure (filep4319) 2023-0601 15:33:26