This web-site uses "cookie" files, which help us make it more usable for you. If you continue using this web-site, you give your consent for using cookies in accordance with the Privacy Policy.
Accept and close
How to Edit Fragmented MP4 HLS streams (M3U8) with the Video Editing SDK

Video Editing SDK 4.2

SolveigMM Video Editing SDK is a software development kit to enable programmers to develop applications for advanced digital video/audio data editing of various formats (AVCHD, MP4, MKV, MOV, MPEG-1, MPEG-2, WAV, ASF/WMV/WMA, AVI, MP3) using Solveig Multimedia components.

File info: 120.38 Mb, 2018 Oct 08


With the newly released version 4.2, Solveig Multimedia's Video Editing SDK extends the suported formats.
Current version is generally focused on the online-based stream formats.

Video Editing SDK v.4.2 supports the following formats:

  • Fragmenred MP4 HLS streams
  • HTTP hosted MP4 files
  • YouTube online videos

In this article you'll find the demonstration of the Fragmented MP4 HLS streams support.

Fragmented MP4 HLS streams support

Video Editing SDK v.4.2 support the following features for Fragmented MP4 HLS streams:


You can easily open the Fragmented MP4 HLS M3U8 stream and work with it just like with the local files. You can navigate through the file as well as play it back. Only parts necessary for preview of the stream will be downloaded to your PC.

To preview the Fragmented MP4 HLS stream, you can build the following graph:


The graph contains a SolveigMM HLS Source as a source filter and Elecard AVC Video Decoder as a video decoder filter. Both filters shipped with the SDK.

Use the SMM Trim C++ Sample Application to test the support of the Fragmented MP4 HLS streams playback and trimming.
The following video demonstrates how you what you can do with the Fragmented MP4 HLS streams by means of the Video Editing SDK v.4.2:


Video Editing SDK is now capable of trimming of the Fragmented MP4 HLS streams. Video Editing Engine is the main component in charge. What you need to do is configure the Video Editing Engine, specify the XTL, describing your current task, then run it and wait for the completion.

Video Editing Engine is a COM component, exposing the ITrimmerObjControl, and you create it as follows:

hr = ::CoCreateInstance( CLSID_TrimmerObjControl, NULL, CLSCTX_INPROC, IID_ITrimmerObjControl, (void**)&m_pITrimmerObjControl );

To configure the Editing Engine you sould use the IModuleConfig interface:

hr = m_pITrimmerObjControl->QueryInterface(IID_IModuleConfig, (void **)&m_pModuleCfgEditObj);

You must use the obtained interface to set an XTL string, containing your trimming task, and optionally specify the callback to track the operation progress:

VARIANT var1 = {0}, var2 = {0};

var1.vt = VT_BSTR;
var1.bstrVal = ...; //task string in XTL format
hr = m_pModuleCfgEditObj->SetValue( &SMAT_XTLString, &var1 );

var2.vt = VT_BYREF|VT_UI1;
var2.pbVal = (BYTE*) &m_xCTrimmerObjControlCB; //pointer to the callback class
hr = m_pModuleCfgEditObj->SetValue( &SMAT_Callback, &var2 );

VARIANT var_res = {0};
hr = m_pModuleCfgEditObj->CommitChanges(&var_res);

You start the trimming process by invoking the ITrimmerObjControl::Start() method:

hr = m_pITrimmerObjControl->Start();

And during the trimming process you can ask the Editing Engine for a progress value:

VARIANT var = {0};
hr = m_pModuleCfgEditObj->GetValue( &SMAT_Progress, &var );

When the processing is done the Editing Engine invokes the ITrimmerObjControlCB::OnStop() from the callback.

Below you can see the XTL sting example, that contains a trimming task:


The source file in this XTL is the Fragmented MP4 HLS file, hosted on Two intervals (represented by 'clip'-tags) will be saved from the source file to the output file:

  • 160413589 - 229542097 UNITS (or 16.041 - 22.954 sec) and
  • 469719350 - 572525849 UNITS (or 46.971 - 57.252 sec)

If the source file contains multiple streams (e.g. for different bitrate values), the source structure will be recreated.
The test file contains 2 different streams with different bitrate values (see the picture below).


After trimming the output folder (C:\hls) will contain 2 subfolders with both streams and the M3U8 playlist file (output.m3u8) with the description of streams configurations. The following picture shows the structure of the trimmed HLS:


The structure of the output M3U8 file:




The trimmed file can be found by the following link:

Please refer to the SMM Trim C++ Sample Application source codes for the detailed description on how to configure and run the Video Editing Engine to perform trimming operation. | Site map | Privacy Policy | Terms of Use
Copyright 2004-2018 © Solveig Multimedia
All rights reserved