Working with heavy MXF video files, you may encounter a problem that they take up to several minutes to be loaded – usually the ones with a missing index table. MFormats SDK and MPlatform SDK have a feature of indexing heavy MXF video files. This significantly increases the speed of their subsequent opening and playback.
The indexing feature is as follows – the SDKs will generate the index tables in the background, which will allow us to start playback the files almost right away. In addition to that, we will save these index tables, so next time we won't have to generate them again.
Common information
First, it's needed to understand that the first opening of a large MXF video file for which an index file has not been generated will always take significantly longer. As soon as the MXF video file will be opened once, the index file will be generated and all subsequent openings of the MXF video file will be much faster.
Secondly, some MXF video files have their own built-in indexing file. But if you have enabled indexing feature, the index file will be created for them as well. MFormats SDK and MPlatform SDK read the MXF file header to load the video, and it will be loaded faster if sufficient parameters are available in the file header.
There are 3 possible places where the index table can be stored after creation:
- As an alternate data stream (ADS) in the NTFS file system. As long as you don't copy the file to a FAT file system or send it over a network, the index table will always be available locally. You can learn more about ADS in NTFS_Alternate article on Wikipedia. It is very important that the original MXF file will not be modified. This stream does not affect the source file in any way (i.e. you can then submit it to any server, etc.), but as we mentioned before, copying the MXF file to FAT32, uploading it to a website, archiving, sending by e-mail, etc. the stream may be lost (which actually isn't a problem, since the index file will be recreated again).
- As a separate file in the same folder where the original MXF file is stored. The index file has the same name as the original MXF file and *.idx file extension. For example: file_name.mxf.idx.
- As a separate file in a specified folder. The index file has the same name as the original MXF file and the extension *.idx. For example: file_name.mxf.idx.
The logic of finding the right index file for the selected MXF video file is simple. The video SDKs check the index file by its name and size. If at least one condition does not match, the indexing file will be recreated. But if both the file name and size match, but this index file isn't for the original MXF file, then SDKs will not detect the substitution and this may cause some problems.
Enabling indexing MXF
To enable this feature in the SDK, you must fulfill a number of requirements by changing prop values in the registry. Firstly, since this feature is available only in the SDK-implementation of the logic for working with MXF files, it's needed to set "mxf.force_ffmpeg" prop as "false".
Prop "mxf.hidden_index" specifies the preferred storage location for index files. If you set the prop value as "true", the SDK will store the index as a hidden compartment of the original MXF file. If you set the prop value as "false", the SDK will store the index as a separate file in the same folder where the original MXF file is stored.
If you need to specify the exact folder where the index files should be stored, "mxf.index_path" prop is in charge of it. Please note that this prop is hidden up to version 2.8.1.13852 of the SDKs inclusive. In a case you don't see it in your registry, just create it manually. The props are located in the following registry branches:
MFormats SDK → Computer\HKEY_CURRENT_USER\SOFTWARE\MediaLooks\MFormats\MFReader
MPlatform SDK → Computer\HKEY_CURRENT_USER\SOFTWARE\MediaLooks\MPlatform\MFile\MFileFFM
As soon as you set all the props as in the screenshots above, the MXF index files will be moved to the specified folder if these files were created earlier or the files will be created from scratch is a case they were missing. The index file will not be created if the MXF file takes less than 100 milliseconds to open.
Also note, that the index files might be hidden. To see them, it's needed to enable the display of hidden files on your system.