SDK Sample Applications
Batch Splitter sample application
This C++ console application demonstrates frame accurate trimming, joining or transcoding of media files with help of the Video Editing Engine. It illustrates one of the engine features - supporting batch of media files trimming. All media files trimming configurations must be described within a batch file (*.xtl) to be an input parameter of the BatchSplit sample application.
For more info please see SDK Batch file structure
For an batch file (*.xtl) examples see XTL Batch Samples
Binaries:
{SDK dir}/bin/smm_batchsplit
Source codes:
{SDK dir}/samples/cpp/smm_batchsplit/
To build the smm_batchsplit you should execute the following commands in a shell:
cd {SDK dir}/samples/cpp/smm_batchsplit/
mkdir build
cd build
cmake ../
cmake -build .
MPEG-TS to MP4 smart remux console utility
This utility converts the input MPEG-TS (containing AVC video and AAC audio) file or its part into an MP4 file with the additional option of adding AAC audio.
Binaries:
{SDK dir}/bin/smm_ts2mp4
MP4 transcoding console utility
The utility transcodes the input MP4 file (containing HEVC or AVC video and AAC audio) in accordance with the reference file's compression parameters.
Binaries:
{SDK dir}/bin/smm_mp4transc
HTML5 Video Editor online
Redirects to the online version of the HTML5 Video Editor - a full-featured tool for the online video editing that uses Video Editing SDK for smart rendering.
Binaries:
{SDK dir}/bin/html5editor_online/
HTML5 Video Editor docker
Docker scripts that run HTML5 Video Editor server locally.
Binaries:
{SDK dir}/bin/html5editor_docker/
Please use the following guide to correctly run it:
Install docker:
apt-get install docker-composeReplace
MASTER_SERVER_IPvariable from the config.sh to a real IP address (127.0.0.1 and localhost will not work)Replace
EDIT_ENGINE_KEYvariable to actual key that should be requested by e-mail support@solveigmm.comFor the server instance there should be ports exposed and accessible for
MASTER_SERVER_IP- 9092 - kafka
- 27017 - mongodb
- 80 - nginx front
Please expose it before running the server
Run the server:
cd ./master ./docker_run.shThe Editor should be available by URL (Google Chrome browser is recommended): http://localhost
Stop the server:
cd ./master ./docker_stop.sh
You can also check the HTML5 Video Editor's API.
Python Samples
SolveigMM Video Editing Engine Python
Python 3.9 or later is required to use this sample.
Install SolveigMM Video Editing Engine:
python -m pip install https://solveigmm.com/files/python/smm_edit_engine-7.0-cp39-abi3-manylinux_2_35_x86_64.whl
Run sample:
python ./test.py ../../media/batch_xtl_samples/trimming-h264-mp4.xtl
The sample demonstrates trimming a fragment from an MP4 media file.
Other operations can be performed by changing the xtl input parameter.
For more information on the XTL format, see SDK Batch file structure
For XTL examples, see XTL Batch Samples
Source code:
{SDK dir}/samples/python/smm_video_editing_engine/test.py
####################################################################################################
# used to install smm_edit_engine module:
# windows:
# python -m pip install https://solveigmm.com/files/python/smm_edit_engine-7.0-cp39-abi3-win_amd64.whl
# linux:
# python -m pip install https://solveigmm.com/files/python/smm_edit_engine-7.0-cp39-abi3-manylinux_2_35_x86_64.whl
#
# this sample processes an xtl file given as the first argument:
# python test.py <path to xtl file>
#####################################################################################################
import argparse
import os
import re
import time
import smm_edit_engine
PROGRESS_TIME = 0.1 # seconds
ACTION_KEY = "BC342AC510A3DD6697019CA8901B7F1E995EB6130090A1FF681CCE96B494CB53D7ADAEF9E7B42434D3EBDCC5FF275CE641F19D84C093B3AE24C21EFA685638D97411AFCA1631B4777A6CEA5F01EBC03634ECC427F65D3256A7E4FC48F3F3C6A95A2A8F764296F6588A6755503EED871992756AB5570C035C722E12C12A992FF982DD9C49FD6AF2A0F077BFF0720BF5B1E529B77EF47D3B020C65435387084F4F4509B28685606BC13540A0C068A9390E1A90A75AB4A9450F900C1472F86BCE18210113453D470A64E5901B0CA0A49CB520DE9DF99D86C8663EE17AE56CF9FA3376A057BC7E297F95DEAB1A71FD67239DDF78EBA995D58E28D3A3EE8D4AE08108AA9CE8D427872DC91B47C5B12D6B4ED8E2800646AC0996BC75AD0E509CBAE0F8D3DEA64E5767593797AE8EBECA835F46229691E55C8F3E48B7BFF6312E9B44FECC485F2681212917AD2F563B632957F8796B0087D919DE0869DDC6BD22728F5CEAFD15C9512CA99DC108E97FECAD6C5009D56D39C6F40CA6C09C7EB23F00CADCB1B873F3455BB210685A258D82A154EF306341B7E5C31786FD1C727D4C107C1A0C895137D7378773532690B889DC4E953D48F46EACE9E3F8E6439DDA564A31119DB6E715EAF0CD13B890B5BF215BF46B93FAA671D1C6D867E5871F15EBC4DBEF3AD90D443BC11507CB36F414E40D0F5091381BEFA189400DB93EFAC41CE20E0816586845414CF51EEEECF36EDF4C5E68B0CB892F60A7CC3199D23FD136C041D1E0FC90CC5526E90A65DE131006EEF9D2"
CODECS_PROFILE = "dmx<type:MKV>_SM__mux<type:MKV>_SM__dmx<type:HLS>_GS__dmx<type:MXF>_NB__mux<type:MXF>_NB__dmx<type:MP4>_SM__mux<type:MP4>_SM__dmx<type:TS>_NB__mux<type:TS>_SM__dec<type:AVC>_AV__enc<type:AVC>_VL__dec<type:AVC;fmt:MXF>_NB__enc<type:AVC;fmt:MXF>_NB__dec<type:MPEG2>_NB__enc<type:MPEG2>_NB__dec<type:HEVC>_AV__enc<type:HEVC>_MW__prs<type:HEVC>_GS__dec<type:AV1>_VL__enc<type:AV1>_IN__prs<type:AV1>_SM__dmx<type:DASH>_SM__mux<type:DASH>_SM";
def display_progress(engine):
progress = engine.getProgress()
if not engine.complete:
print(f'progress:{progress:.2f}%')
time.sleep(PROGRESS_TIME)
display_progress(engine)
def make_absolute_path(value, base_dir):
path = value.replace('\\', os.sep) if os.sep == '/' else value.replace('/', os.sep)
if os.path.isabs(path):
return os.path.normpath(path)
return os.path.normpath(os.path.join(base_dir, path))
def load_xtl(xtl_path):
if not os.path.isfile(xtl_path):
print(f'xtl file not found: {xtl_path}')
return None
with open(xtl_path, 'r', encoding='utf-8') as xtl_file:
xtl = xtl_file.read()
base_dir = os.path.dirname(os.path.abspath(xtl_path))
return re.sub(r'(?i)\b(src|output)="([^"]*)"',
lambda match: f'{match.group(1)}="{make_absolute_path(match.group(2), base_dir)}"',
xtl)
def make_test(xtl_path):
print('starting operation')
engine = smm_edit_engine.EditEngine()
codecs_profile = CODECS_PROFILE
err = engine.SetCodecsProfile(codecs_profile)
if err:
print(f'failed to SetCodecsProfile hr= {err}')
return
action_key = ACTION_KEY
err = engine.SetActionKey(action_key)
if err:
print(f'failed to SetActionKey hr= {err}')
return
xtl = load_xtl(os.path.abspath(xtl_path))
if xtl is None:
return
err = engine.SetXTLString(xtl)
if err:
print(f'failed to SetXTLString hr= {err}')
return
def on_start():
print('onStart')
def on_stop():
print('onStop')
engine.complete = True
engine.Destroy()
def on_error(hr, msg):
print(f'onError hr: {hr} msg:{msg}')
engine.complete = True
engine.Destroy()
engine.SetCallBacks(on_start, on_stop, on_error)
engine.complete = False
err = engine.Start()
if err:
print(f'failed to Start hr= {err}')
return
display_progress(engine)
def main():
parser = argparse.ArgumentParser(description='process the given xtl file')
parser.add_argument('xtl', help='path to an xtl file to process')
args = parser.parse_args()
make_test(args.xtl)
main()
Open HTML5 Video Editor sample script
A sample script that uses an HTML5 Video Editor's API to open the online version of the editor and load a file in it.
Source codes:
{SDK dir}/samples/python/open_html5editor/open_html5editor.py
