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.


Comments (2)
  1. Hi,

    Is there any way to add subtitles/text to a stream while live encoding to a publishing point (Smooth streaming)? What I want to achive is that while live encoding for instance a soccer game, I want to be able insert text into the stream when someone scores a goal or similar.

    I have looked at the script commands, but didn't get it to work and the only documentation I found was for EE 3 and didn't really apply.

    I have EE 4 PRO SP1.

    Is this possible? Are there any guides for achieving this out there? Please advise.

    Many thanks,


  2. Eric Juteau says:

    Hi Anne,

    Your question should be posted to our forum: social.expression.microsoft.com/…/expressionstudio

Comments are closed.

Skip to main content