The LEADTOOLS Elementary Stream Source and Writer Filters allow developers to create applications that use multiple physical machines to transcode a single file, reducing the total conversion time. The process of splitting the source file into multiple pieces, transcoding each of those pieces on a separate machine, and merging those transcoded files back into a single file is done seamlessly without any gaps at the split points or loss of audio/video synchronization.
The filters are included as part of the LEADTOOLS Multimedia Suite.
Perform the following steps to create a multi-machine transcoding application:
Creating the split files
Obtain an instance of the LEAD Elementary Stream Writer filter using the ConvertCtrl.GetSubObject method and set the following properties:
Set the TargetFile to
Start the conversion. When complete, you should have several split files (determined by the settings in the Writer Filter), and a catalog file.
Transcoding each split file
In a typical scenario, each split file would be copied to a separate machine and the file would be transcoded as described below:
The above process should be repeated for the audio stream as well. See Notes on stream types below for more information.
Merging the split files
Once all split files have been transcoded, you will be ready to merge all the individual clips back together. The source path of all transcoded clips (audio and video) should match the paths of the corresponding clips in the original catalog file:
The above process should be repeated for the audio stream as well. See Notes on stream types below for more information.
LTESC Format
The LTESC format (LEADTOOLS Elementary Stream Catalog) is used as an index file and contains XML which represents all information necessary to merge all split files back together. Below is an example of a LTESC file.
<?xml version="1.0" encoding="utf-8" ?>
<ltesCatalog>
<stream id="stream 1" type="{73646976-0000-0010-8000-00AA00389B71}" >
<clip src="test-1-c1.ltes" start="0" duration="100100001" />
<clip src="test-1-c2.ltes" start="0" duration="100100111" />
<clip src="test-1-c3.ltes" start="0" duration="100100111" />
<clip src="test-1-c4.ltes" start="0" duration="100100111" />
<clip src="test-1-c5.ltes" start="0" duration="20020000" />
</stream>
<stream id="stream 2" type="{73647561-0000-0010-8000-00AA00389B71}" >
<clip src="test-2.ltes" start="0" duration="419635001" />
</stream>
</ltesCatalog>
Stream - This represents a stream in the catalog file. Since audio streams usually convert very quickly, the audio stream is never split. Only the video stream is split.
Type - Represents the Guid of the stream major type. In most cases, this is audio or video but other stream types are supported as well. As stated above, only video streams will be split.
Clip - Each stream contains a collection of clips. These are the individual files which were split from the source file, transcoded, then merged back together.
Src - The file path for the corresponding clip.
Start - The start time for the corresponding clip.
Duration - The length of the corresponding clip.
When merging the split files back together, it is important that the path to all transcoded split files is updated in the catalog file. You can either update the catalog file directly, or create a separate catalog file which is a copy of the original, but with updated file paths.
The transcoding process for the video stream is the most CPU-intensive part of transcoding and it is responsible for the majority of the transcoding time. The transcoding process for an audio stream is much faster and less CPU intensive. As a result, the LTES writer only splits the video stream. Any other stream (like the audio), can still be transcoded, but the entire stream will be transcoded at once.
Known issues
The Microsoft MPEG4 decoder will occasionally drop the last frame of a conversion. Synchronization will not be lost in the merged video, but the last frame of each split file will be lost. To resolve this issue, we recommend using the LEAD MPEG4 Decoder. You can do this by either increasing the merit of the LEAD Decoder, or setting the SetPreferredFilter Property to the LEAD MPEG4 Decoder.
LEADTOOLS Elementary Stream Source LEAD Elementary Stream Writer