Tidbits about Indexing
When importing certain media files like VOB, TS and M2TS files, Expression Encoder needs to parse through the file to ensure the duration and video frame timestamps are accurate by creating its own corrected table of content in memory. Without this analysis, the encoded output files could have the wrong duration (either trimmed or having extra black frames at the end) and audio video sync could not be guaranteed, especially if the file was trimmed.
This analysis operation, called indexing, is unfortunately time consuming since it requires to read and demux the whole media file and typically requires a few minutes per hour of content, mostly depending on storage speed. Because of this, it is recommended to first copy this type of media file locally before importing it to ensure maximum efficiency.
Note that while this operation is automatically executed upon import within the Encoder application, it is not executed by default when importing a media file via the SDK and needs to be explicitly called before the MediaItem constructor via the CalculateDuration member of AudioVideoFile like this:
AudioVideoFile file = new AudioVideoFile(filename);
MediaItem item = new MediaItem(file);
It is worth pointing that if the CalculateDuration method isn't called, there will still be indexing done in-line during the encoding which will fix the timestamps, but it is possible that the duration of the output file will be wrong. For this reason, we highly recommend using the code above if source files that require indexing are used.