Batch processing
SolveigMM Video Editing SDK performs different tasks made as Batch files.
Batch file structure
Batch files to be supported by SolveigMM Video Editing SDK are Extensible Markup Language (XML) with *.xtl extension and structure based on Direct Show Editing Services XTL format. This section documents the XTL elements and attributes.
Note:
All the elements and attributes are case-sensitive. The values must be quoted(""). For an examples see Batch Samples.
This table contains the basic elements of the XTL file:
Element | Description |
timelines | The timelines element is the root XML node |
timeline | The timeline element describes particular timeline |
engine | The engine element specifies the engine to be used for editing |
group | The group element defines output files parameters |
track | The track element is container for clip elements it defines common attributes for clips if it is not set |
clip | Specifies a media source file |
task | The task element defines operation that is applied to timeline |
effect | The effect element defines the effect that is applied to the track |
transition | The transition element defines that given track element will be combined with previous with some parameters |
param | The param element specifies the value of a property on a clip or track |
additional_param | The additional_param element specifies the additional params to the preceding tag |
Element timelines
The timelines element is the root XML node
Parent/Child information
Parent | Children |
None, this is the root element | timeline |
Attributes:
Attribute | Possible values | Obligation presence | Description |
version | 2 | Yes | Specifies current version of XTL format |
Element timeline
The timeline element describes particular timeline
Parent/Child information
Parent | Children |
timelines | group |
Attributes:
no attributes specified
Element engine
The engine element specifies the engine to be used for editing
Parent/Child information
Parent | Children |
timelines, timeline | None |
The element can exist inside the timelines and inside the timeline tags at the same time. In this case the value of the engine element from the timeline tag overrides the value of the one from timelines tag for the specified timeline.
Attributes:
Attribute | Possible values | Obligation presence | Description |
type | See engine types | Yes | Specifies the type of engine to process files |
Engine types:
directshow - Microsoft DirectShow engine/components will be used for editing gstreamer - GStreamer engine/component swill be used for editing auto - Automatically choose the most preferrable engine for the specified operation
Element group
The group element defines output files parameters
Parent/Child information
Parent | Children |
timeline | track |
Attributes
Attribute | Possible values | Obligation presence | Description |
output | string with file path name | No | Specifies an output filename with a path |
out_type | see Output file types | No | Specifies output file type. Note: This parameter should be set depending on input format and video audio codec. |
outdir | string with file path | No | Specifies the output files' path for tasks with multiple files output |
outmask | see Output file mask format | No | Specifies the output files' mask for task with multiple files |
compatibility | see Compatibility types | No | Specifies the output files compatibility |
Output file types:
avi - Audio Video Interleave asf,wmv - Window Media Video wma - Windows Media Audio mpa, mp3, mp1 - MPEG audio mpg_ts - MPEG2 transport stram mpg_ps - MPEG2 program stream mpg_ves - MPEG2 video elementary stream mpg1_sys - MPEG1 system stream mpg1_ves - MPEG1 video elementary stream avc_ves - AVC video elementary stream wav - Waveform Audio matroska - Matroska mp4 - MPEG-4 Part 14 file format flv - Flash Video gif - Animated GIF yuv - I420 YUV raw - Raw format
Compatibility types:
original - Ordinary file GeoVision - GeoVision RemoteView compatible file BlueSonicF008 - DVR BlueSonic F008 file
Output file mask format:
[source] uses the name of the source file for the target.
[n] macros automatically numbers the (one or more) target. Target will automatically be numbered, if parameter is set, even if source name is not used.
[n:4] macros is the current number of fragment with defined minimum number of characters printed. Zeros are added to the left of the values.
[time] macros is intended for defining the current date time of the output file name.
To add the required macros just click on the button with the macros name and then change it in the Mask of the output files names field if needed.
You can change the order of this macroses to get the files with names that will be suitable for you.
To reset the mask to initial view, just click on the Reset to defaults button. Below please find examples of mask templates and the output files names.
Admit we have the Video.avi input file and would like to save three fragments from the file. We make this operation on September 25, 2012 at 18:50:30.
The mask template | The output file name |
[n] | 1.avi 2.avi 3.avi |
[source]_[n] | Video_1.avi Video_2.avi Video_3.avi |
[source]_[n:2] | Video_01.avi Video_02.avi Video_03.avi |
[source]_[n]_[time] | Video_1_2012_09_25_18_50_30.avi Video_2_2012_09_25_18_50_30.avi Video_3_2012_09_25_18_50_30.avi |
Element track
The track element is container for clip elements it defines common attributes for clips if it is not set.
Parent/Child information
Parent | Children |
group | clip |
Attributes
Attribute | Possible values | Obligation presence | Description |
video | [-1, n] | No | Specifies stream number of video ("-1" - means all streams, "0" - means disable stream) |
audio | [-1, n] | No | Specifies stream number of audio ("-1" - means all streams, "0" - means disable stream) |
text | [-1, n] | No | Specifies stream number of audio ("-1" - means all streams, "0" - means disable stream) |
obey_sample_time | [0, 1] | No | The obey_sample_times attribute specifies whether an alternative synchronization algorithm should be used: 0 = Do not use obey_sample_time 1 = Use obey_sample_time By default, obey_sample_time equals to 0 |
accuracy | [frame,gop] | No | Specifies accuracy type in trimming operaion: frame - Frame accuracy gop - K-frame (GOP) accuracy |
compatibility | see Compatibility types | No | Specifies graph compatibility option for operation |
flags | see Trimm flags | No | Specifies coma separated options used in trimming operation. |
Trimm flags:
audio_silence - audio will be muted on fragment
interlaced_fields_alignment - enable navigation to interlaced fields on AVC vid
mpeg2_padding - enable padding on MPEG2 streams
keep_mpeg_closedcaptions - saving MPEG2 closed captions data on re-encoded frames
keep_mpeg2ts_pids - keep MPEG TS PIDs
singlethread_mpeg2encoder - enable single thread mode in elecard mpeg2 encoder
write_rtp_hint_tracks - MP4 files streaming made compatible with Darwin Streaming Server by creating RTP hint tracks
keep_rtp_hint_tracks - MP4 files streaming made compatible with Darwin Streaming Server by keeping RTP hint tracks
Element clip
The clip element specifies media source files and start/stop positions of fragments to be kept.
Parent | Children |
track | None |
Attributes
Attribute | Possible values | Obligation presence | Description |
src | string with file path name | Yes | Specifies the path name of the input media file |
index | string with index file path name | Yes | Specifies the path name of the input media file' index |
video | [-1,n] | No | Specifies the number of video stream. The 0 value means no video stream. The -1 value means - all video streams |
audio | [-1,n] | No | Specifies the number of audio stream. The 0 value means no audio stream. The -1 value means - all audio streams |
text | [-1,n] | No | Specifies the number of text stream. The 0 value means no audio stream. The -1 value means - all text streams |
start | time string | No | The start time of the fragment. See time format types for details |
stop | time string | No | The stop time of the fragment. See time format types for details |
length | time string | No | Alternative description of the time. This description is the same as start="00:00:00:00", stop="length". Should present either start/stop or length. |
timeFormat | [100ns_units, time10ms, position,bytes,parts] | No | Specifies the format of "start" and "stop" attributes. If not specified - time10ms |
flags | see Trimm flags for details | No | Specifies coma separated options used in trimming operation. See Trimm flags for details |
Time format types:
100ns_units - Value is interpreted as 100ns Units ( 1 sec = 1e7 UNITS)
time10ms - Value is set in format "HH:MM:SS.mS", where mS = milliseconds / 10; eg. 0.125 sec = 12 mS
position - Value is set using key words: "begin", "end"
bytes - Value is interpreted as bytes count
parts - Value is interpreted as parts count
Element task
The task element defines operation that is applied to timeline
Parent/Child information
Parent | Children |
group | None |
Attributes
Attribute | Possible values | Obligation presence | Description |
type | joining, indexation, autosplit | No | Specifies the task type. See Task types for details |
time | time string | No | Specifies the time parameter for task |
timeFormat | 100ns_units, time10ms, parts, bytes | No | Specifies how to interpret value specified in time attribute. See time format types |
Task types:
joining - Join should be applied to timeline
indexation - Indexation operation should be applied to clip
autosplit - Slicing by time, by size, into parts should be applied to timeline
Element effect
The effect element defines the effect that is applied to the clips in the current track
Parent/Child information
Parent | Children |
track | param |
Attributes
Attribute | Possible values | Obligation presence | Description | type | See effect types | Yes | Specifies the effect type by name. |
start | time string | Yes | Specifies the effect start time. |
stop | time string | Yes | Specifies the effect stop time. |
timeFormat | See time format types. | No | Specifies how to interpret value specified in time attribute. By default timeFormat equals to time10ms. |
Effect types:
transparency - Applied to the video stream of the parent track tag. Must contain additional param tags. Available params:
alpha
<param name="alpha" value="val">
The parameter's value attribuate is interpreted as a transparency and stores the initial value of the transparency. This type of param tag must include a child tag with a description of the value variation function, which will also contain the destination value of the parameter that the initial value will be changed to. Available values: (0 - 255)
bkcolor
<param name="bkcolor" value="val" />
The parameter's value attribuate is interpreted as a name of the backgroung color. Available values: "transparent", "black"
chroma_key - Applies Chroma key effect to the video stream of the parent track tag. Must contain additional param tags.
Available params:
r,g,b
<param name="r" value="val"/> <param name="g" value="val"/> <param name="b" value="va"/>
Defines the main key color RGB components for the effect
Available values: (0 - 255)
similarity
<param name="similarity" value="val"/>
Defines the threshold applied when compare source pixels with the main key color. Higher value will remove more pixels.
Available values: (0 - 1000)
smoothness
<param name="smoothness" value="val"/>
Defines the smoothness for the pixels that are neighbors to removed pixel. Lower values leave hard edges around removed pixels; higher values soften the edge of removed areas
Available values: (0 - 1000)
spill
<param name="spill" value="val"/>
Specifies how aggressively to remove traces of the key color around the edge of other colors (for example, green pixels around a subject's hair)
Available values: (0 - 1000)
opacity
<param name="opacity" value="val"/>
Sets the opacity of the resulted opaque pixels after key color remove. 0 - transparent; 255 - is opaque
Available values: (0 - 255)
brightness, contrast, gamma
<param name="brightness" value="val"/> <param name="contrast" value="val"/> <param name="gamma" value="val"/>
Changes the brightness, contrast, gamma parameters of the resulted opaque image.
Available values: (0 - 100)
volume - Applied to the audio stream of the parent track tag. Must contain additional param tags. Available params:
volume
<param name="volume" value="val">
The parameter's value attribuate is interpreted as a volume value in percent of original value Available values: (0 - 1000)
transition Element
The transition element defines the type of transition that is applied to the track
Parent/Child information
Parent | Children |
track | none |
Attributes
Attribute | Possible values | Obligation presence | Description | type | See transition types | Yes | Specifies the transition type by name. |
start | time string | Yes | Specifies the effect start time. |
stop | time string | Yes | Specifies the effect stop time. |
timeFormat | See time format types. | No | Specifies how to interpret value specified in time attribute. By default timeFormat equals to time10ms. |
Transition types:
mix - Affected tracks will be mixed together. Streams to be mixed are specified in the transition's parent track tag. Available params:
- audio
the parameter's value attribute is interpreted as an ordered number of the audio stream trom the main track where current audio will be mixed. Available values: (1 - Total Audio Streams)<param name="audio", value="val">
pip - one of the affected tracks will be overlaid on the other. Requires the destination rectangle description in child param tags.
Available params:
x, y
<param name="x", value="val"> <param name="y", value="val">
the parameter's value attribute is interpreted as a position in pixels.
width, height
<param name="width", value="val"> <param name="height", value="val">
the parameter's value attribute is interpreted as dimensions in pixels.
Element param
Parent/Child information
Parent | Children |
group, transition, effect | None |
Attributes
Attribute | Possible values | Obligation presence | Description |
name | string | Yes | Specifies the parameter name |
value | string | Yes | Specifies the parameter value |
Available values are listed in the related parent tags.
Value variation functions
Specifies the type of function to be applied for the values variations.
Parent/Child information
Parent | Children |
param | None |
Only the linear function is supported:
<linear attribute="value">
Attributes
Attribute | Possible values | Obligation presence | Description |
value | [0, 255] | Yes | Specifies the destination value of the parent pamameter's tag |
start | time string | No | The start time of the fragment. See time format types for details. The default value represents the beginning of the media file. |
stop | time string | No | The stop time of the fragment. See time format types for details. The default value represents the end of the media file. |
length | time string | No | Alternative description of the time. This description is the same as start="00:00:00:00", stop="length". Should present either start/stop or length. |
timeFormat | 100ns_units, time10ms, position |
No | Specifies the format of "start" and "stop" attributes. If not specified - time10ms |
Element additional_param
Parent/Child information
Parent | Children |
Any | None |
This tag is applied to the preceding tag and extends its parameters. Currently applied to the track tag.
Attributes
Attribute | Possible values | Obligation presence | Description |
video | [1, n] | No | Specifies the additional video stream number to be processed |
audio | [1, n] | No | Specifies the additional audio stream number to be processed |
text | [1, n] | No | Specifies the additional text stream number to be processed |
Batch samples
All XTL samples located in C:\Program Files\Solveig Multimedia\SolveigMM Video Editing SDK\Samples\Media\Batch XTL Samples
.
To run the samples you should use the command line console utility SMM_BatchSplit.exe. The full XTL file's path should be passed.
SMM_BatchSplit.exe "C:\Program Files\Solveig Multimedia\SolveigMM Video Editing SDK\Samples\Media\Batch XTL Samples\trim_mp4_avc.xtl"
In case of Windows 7 and higher the command-line should be run "As Administrator", otherwise the resulting files would be stored in VirtualStore folder.
Trimming
Samples\Media\Batch XTL Samples\trim_mp4_avc.xtl
<timelines version="3">
<timeline>
<engine type="directshow"/>
<group output="..\output\sample_mp4_hd_0001.mp4">
<track video="1" audio="1" accuracy="frame" >
<clip src="..\mp4\sample_mp4_hd.mp4" start="00:00:00.40" stop="00:00:01.32" />
</track>
</group>
</timeline>
</timelines>
As a result, the file sample_mp4_hd_0001.mp4
will be created from the source media mp4\sample_mp4_hd.mp4
containing selected fragment - 0.4 to 1.32 seconds. Trimming accuracy is frame.
Multiple intervals trimming
Samples\Media\Batch XTL Samples\trim_multiple_clips.xtl
<timelines version="3" >
<engine type="directshow"/>
<timeline>
<group output="..\output\sample_multiple_clips_0001.mp4">
<track video="1" audio="1" accuracy="frame" >
<clip src="..\mp4\sample_mp4.mp4" start="00:00:00.00" stop="00:00:05.00" />
<clip src="..\mp4\sample_mp4.mp4" start="00:00:10.00" stop="00:00:15.00" />
</track>
</group>
</timeline>
<timeline>
<group output="..\output\sample_multiple_clips_0002.mp4">
<track video="1" audio="1" accuracy="frame" >
<clip src="..\output\sample_multiple_clips_0001.mp4" start="00:00:00.00" stop="00:00:10.00" />
<clip src="..\mp4\sample_mp4.mp4" start="00:00:00.00" stop="00:00:10.00" />
</track>
</group>
</timeline>
</timelines>
Remarks:
As a result for the first timeline group the file sample_multiple_clips_0001.mp4
should be created from the source media mp4\sample_mp4.mp4
containing two selected fragments - 0 to 5 seconds and 10 to 15 seconds. Trimming accuracy is frame.
The second timeline group task will create sample_multiple_clips_0002.mp4
file that will contain first 10 seconds from the sample_multiple_clips_0001.mp4
file created from the first timeline, and the first 10 seconds from the the original file mp4\sample_mp4.mp4
HLS-FMP4 trimming
Samples\Media\Batch XTL Samples\trim_m3u8.xtl
<timelines version="3">
<timeline>
<engine type="directshow"/>
<group output="..\output\output.m3u8" >
<track video="1" audio="1" text="0" accuracy="frame" flags="" >
<clip src="http://smarteditingonline.solveigmm.com/files/test_multibitrate.m3u8" video="1" audio="1" text="1" start="11000000" stop="600000000" timeFormat="100ns_units" />
</track>
</group>
</timeline>
</timelines>
Remarks:
A sample of the online HLS file trimming. The general files structure described in the input m3u8 file will be recreated in the specified output folder. The output m3u8 file will contain the trimmed file structure description.
HLS-TS with MP4 remux trimming
Samples\Media\Batch XTL Samples\trimming_hls2mp4.xtl
<timelines version="3">
<timeline>
<engine type="gstreamer"/>
<group output="..\output\output_hls_to_mp4.mp4" out_type="mp4">
<track video="1" audio="1" text="0" accuracy="frame" flags="" >
<clip src="http://devimages.apple.com/iphone/samples/bipbop/gear4/prog_index.m3u8" start="30000000" stop="100000000" timeFormat="100ns_units" />
</track>
</group>
</timeline>
</timelines>
Remarks:
As a result, the file "hls_ts_output.mp4" will be created out of the source stream from 3s to 10s. Trimming is frame accurate.
Joining
Samples\Media\Batch XTL Samples\joining.xtl
<timelines version="3">
<timeline>
<engine type="directshow"/>
<group output="..\output\sample_mkv_Joined.mkv" out_type="matroska">
<task type="joining" />
<track video="-1" audio="-1" >
<clip src="..\mkv\sample_mkv.mkv" />
<clip src="..\mkv\sample_mkv.mkv" />
</track>
</group>
</timeline>
</timelines>
Remarks:
As a result the file sample_mkv_Joined.mkv
should be created that will repeat sample_mkv.mkv
twice. Output media will contain all video audio streams that present in input.
Indexation
Samples\Media\Batch XTL Samples\indexation.xtl
<timelines version="3">
<timeline>
<engine type="directshow"/>
<group output="..\mpeg1-ss\sample_mpeg1_sys.mpg.mlmix">
<task type="indexation"/>
<track>
<clip src="..\mpeg1-ss\sample_mpeg1_sys.mpg"/>
</track>
</group>
</timeline>
</timelines>
Remarks:
As a result the index file sample_mpeg1_sys.mpg.mlmix
should be created for mpeg media sample_mpeg1_sys.mpg
that will be used for accurate seeking and navigation.
Extract video
Samples\Media\Batch XTL Samples\extract_video.xtl
<timelines version="3">
<timeline>
<engine type="directshow"/>
<group output="..\output\sample_mpeg2_ts_0001.mpg" out_type="mpg_ves" >
<track video="1" audio="0" accuracy="frame" >
<clip src="..\mpeg2-ts\sample_mpeg2_ts.mpg" index="..\mpeg2-ts\sample_mpeg2_ts.mpg.mlmix" start="00:00:00.00" stop="00:00:15.92" />
</track>
</group>
</timeline>
</timelines>
Remarks:
As a result the file sample_mpeg2_ts_0001.mpg
should be created containing only video track from source media smaple_mpeg2_ts.mpg
. The output file will be saved as Video Elementary Stream.
Extract audio
Samples\Media\Batch XTL Samples\extract_audio.xtl
<timelines version="3">
<timeline>
<engine type="directshow"/>
<group output="..\output\sample_avi_0001.mp3" out_type="mpa">
<track video="0" audio="1" accuracy="gop" >
<clip src="..\avi\sample_avi.avi" start="00:00:00.00" stop="00:00:12.84"/>
</track>
</group>
</timeline>
</timelines>
Remarks:
As a result the file sample_avi_0001.mp3
should be created that contains audio track from sample_avi.avi
. Output format is set to mpeg audio.
Slicing into parts
Samples\Media\Batch XTL Samples\slicing.xtl
<timelines version="3">
<timeline>
<engine type="directshow"/>
<group outdir="..\output\" outmask="[source]_[n:4]" >
<task type="autosplit" time="3" timeFormat="parts" />
<track video="1" audio="1" >
<clip src="..\avi\sample_avi.avi" start="begin" stop="end" timeFormat="position" />
</track>
</group>
</timeline>
</timelines>
Remarks:
This sample splits input source sample_avi.avi
into 3 parts.
Multiple audio tracks trimming
Samples\Media\Batch XTL Samples\trim_mkv_multiple_audio.xtl
<timelines version="3" >
<timeline>
<engine type="directshow"/>
<group output="..\output\multiaudio.mkv" >
<track video="1" audio="1" text="0" accuracy="frame" >
<clip src="..\mkv\sample_mkv_3_audio.mkv" start="40000000" stop="70000000" timeFormat="100ns_units" />
</track>
<additional_param audio="3"/>
</group>
</timeline>
</timelines>
Remarks:
The source media contains 3 audio tracks (MP3, AAC, PCM). The output media will contain video and 1-st, 3-rd audio tracks (MP3, PCM)
External subtitles trimming
Samples\Media\Batch XTL Samples\trim_avi_srt_subtitles.xtl
<timelines version="3" >
<timeline>
<engine type="directshow"/>
<group output="..\output\sample_avi_sub.avi" >
<track video="1" audio="1" text="0" accuracy="frame" >
<clip src="..\avi\sample_avi.avi" start="30000000" stop="50000000" timeFormat="100ns_units" />
</track>
</group>
<group output="..\output\sample_avi_sub.srt" >
<track video="0" audio="0" text="1" >
<clip src="..\avi\sample_avi.srt" start="30000000" stop="50000000" timeFormat="100ns_units"/>
</track>
</group>
</timeline>
</timelines>
Remarks:
The Batch task saves fragment from media file sample_avi.avi
and external srt subtitle file sample_avi.srt
. After trimming 2 files will be created: sample_avi_sub.avi
and sample_avi_sub.srt
accordingly.
Voice over (separate track)
Samples\Media\Batch XTL Samples\audio_mux_separate_track.xtl
<timelines version="3">
<timeline>
<engine type="directshow"/>
<group output="..\output\audio_mux_separate_track.mp4" >
<track video="1" audio="0" accuracy="frame" >
<clip src="..\mp4\sample_mp4.mp4" start="00:00:00.00" stop="00:00:15.00"/>
</track>
<track audio="1" >
<clip src="..\m4a\audio.m4a" start="00:00:00.00" stop="00:00:05.00" flags="audio_silence"/>
<clip src="..\m4a\audio.m4a" start="00:00:00.00" stop="00:00:04.00" />
<clip src="..\m4a\audio.m4a" start="00:00:00.00" stop="00:00:06.00" flags="audio_silence"/>
</track>
</group>
</timeline>
</timelines>
Remarks:
The output file will contain video track from sample_mp4.mp4
and audio track from audio.m4a
with the duration of 4 seconds, starting from the 5th second. The rest audio intervals are silent.
Voice over (mix track)
Samples\Media\Batch XTL Samples\audio_mix_mp3.xtl
<timelines version="3">
<timeline>
<engine type="gstreamer"/>
<group output="..\output\audio_mix.mp4">
<track video="1" audio="0" text="0" accuracy="frame">
<clip src="..\mp4\sample_mp4.mp4" start="00:00:00.00" stop="00:00:15.00" />
</track>
<track video="0" audio="1" text="0" accuracy="frame">
<clip src="..\mp4\sample_mp4.mp4" start="00:00:00.00" stop="00:00:15.00" />
</track>
<track audio="1">
<clip src="..\mp3\mp3_single.mp3" length="00:00:02.00" flags="audio_silence" />
<clip src="..\mp3\mp3_single.mp3" start="00:00:00.00" stop="00:00:10.00" />
<clip src="..\mp3\mp3_single.mp3" length="00:00:03.00" flags="audio_silence" />
<transition type="mix" start="00:00:02.00" stop="00:00:12.00">
<param name="audio" value="1"/>
</transition>
</track>
</group>
</timeline>
</timelines>
Remarks:
The output audio_mix.mp4
file will be rendered independently from the video track of the file mp4\sample_mp4.mp4
and the audio track from the same file. Additionally, the audio track will have 10 seconds of a sound from the mp3\mp3_single.mp3
that will be mixed to the other audio starting from the time of 2 seconds.
Mute audio
Samples\Media\Batch XTL Samples\audio_mute.xtl
<timelines version="3">
<timeline>
<engine type="directshow"/>
<group output="..\output\audio_mute.mp4">
<track video="1" audio="1" text="0" accuracy="frame">
<clip src="..\mp4\sample_mp4.mp4" start="00:00:00:00" stop="00:00:05.00" flags="audio_silence"/>
<clip src="..\mp4\sample_mp4.mp4" start="00:00:05:00" stop="00:00:10.00" />
<clip src="..\mp4\sample_mp4.mp4" start="00:00:10:00" stop="00:00:15.00" flags="audio_silence"/>
</track>
</group>
</timeline>
</timelines>
Remarks:
The audio in the output audio_mute.mp4
file will be muted in intervals 0 to 5 sec and 10 to 15 sec.
Audio volume effect
Samples\Media\Batch XTL Samples\audio_volume_effect.xtl
<timelines version="3">
<timeline>
<engine type="gstreamer"/>
<group output="..\output\audio_volume_effect.mp4">
<track video="1" audio="0" text="0" accuracy="frame">
<clip src="..\mp4\sample_mp4.mp4" start="00:00:00.00" stop="00:00:15.00" />
</track>
<track video="0" audio="1" text="0" accuracy="frame">
<clip src="..\mp4\sample_mp4.mp4" start="00:00:00.00" stop="00:00:15.00" />
<effect type="volume" start="00:00:00.00" stop="00:00:15.00">
<param name="volume" value="10"/>
</effect>
</track>
</group>
</timeline>
</timelines>
Remarks:
As a result the file "audio_volume_effect.mp4" should be created where the audio volume is decreased (10% from source value)
Remux MXF to MOV
Samples\Media\Batch XTL Samples\remux_mxf_mov.xtl
<timelines version="3">
<timeline>
<engine type="directshow"/>
<group output="..\output\remux_mxf_mov.mov" out_type="mov">
<track video="1" audio="-1" text="0" accuracy="gop" flags="stream_copy">
<clip src="..\mxf\sample_xavc_1920x1080_422_10bit_25p_50M.mxf" start="begin" stop="end" timeFormat="position"/>
</track>
</group>
</timeline>
</timelines>
Remarks:
The source file sample_xavc_1920x1080_422_10bit_25p_50M.mxf
has MXF type. It will be converted to the remux_mxf_mov.mov
file which is MOV.
Smart transcoding
Samples\Media\Batch XTL Samples\smart_transcoding.xtl
<timelines version="3">
<timeline>
<engine type="gstreamer"/>
<group output="..\output\sample_mp4_smart_transcoded.mp4">
<param name="reference_file" value="..\mp4\sample_mp4_hd.mp4"/>
<track video="1" audio="-1" text="0" accuracy="frame">
<clip src="..\mp4\sample_mp4_hd.mp4" start="10000000" stop="20000000" timeFormat="100ns_units"/>
<clip src="..\mp4\sample_mp4.mp4" start="10000000" stop="20000000" timeFormat="100ns_units"/>
<clip src="..\mp4\sample_mp4_hd.mp4" start="10000000" stop="20000000" timeFormat="100ns_units"/>
<clip src="..\mp4\sample_mp4.mp4" start="10000000" stop="20000000" timeFormat="100ns_units"/>
</track>
</group>
</timeline>
</timelines>
Remarks:
As a result the file sample_mp4_smart_transcoded.mp4
should be created with video and audio parameters identical to the reference file sample_mp4_hd.mp4
.
Image overlay
Samples\Media\Batch XTL Samples\image_overlay.xtl
<timelines version="3">
<timeline>
<engine type="gstreamer"/>
<group output="..\output\image_overlay.mp4">
<track video="1" audio="1" text="0" accuracy="frame">
<clip src="..\mp4\sample_mp4.mp4" start="00:00:00.00" stop="00:00:15.00" />
</track>
<track video="1">
<clip src="..\png\logo.png" length="00:00:02.00" flags="blank" />
<clip src="..\png\logo.png" length="00:00:05.00" />
<clip src="..\png\logo.png" length="00:00:08.00" flags="blank" />
<transition type="pip" start="00:00:02.00" stop="00:00:07.00">
<param name="x" value="110"/>
<param name="y" value="100"/>
<param name="width" value="100"/>
<param name="height" value="28"/>
</transition>
</track>
</group>
</timeline>
</timelines>
Remarks:
The transition tag defines that image should be mixed with the video in specified interval and rectangle. As a result for this xtl the file image_overlay.mp4
should be created which consists of the source video file and a logo, placed in a specified rectangle (x,y,width,height parameters) over the video.
Image to video
Samples\Media\Batch XTL Samples\image_to_video.xtl
<timelines version="3">
<timeline>
<engine type="gstreamer"/>
<group output="..\output\image_to_video.mp4" out_type="mp4">
<task type="transcoding">
<param name="vcodec" value="type=h264,fps_n=25,fps_d=1,width=1920,height=1080,profile=baseline,bitrate=1000"/>
</task>
<track video="1" audio="0" text="0">
<clip src="..\png\attractive.png" length="00:00:04.00" />
</track>
</group>
</timeline>
</timelines>
Remarks:
As a result the file image_to_video.mp4
compressed with the specified parameters should be created from the png\attractive.png
source picture.
Chroma key
Samples\Media\Batch XTL Samples\chromakey_video_with_bg_image.xtl
<timelines version="3">
<timeline>
<engine type="gstreamer"/>
<group output="..\output\chromakey_video_with_bg_image.mp4" out_type="mp4">
<param name="reference_file" value="..\mp4\chromakey.mp4"/>
<track video="1">
<clip src="..\jpg\ocean.jpg" length="00:00:10.000"/>
</track>
<track video="1" audio="0" text="0" accuracy="frame">
<clip src="..\mp4\chromakey.mp4" start="00:00:00.000" stop="00:00:10.000" />
<effect type="chroma_key" start="00:00:00.000" stop="00:00:10.000">
<param name="r" value="0"/>
<param name="g" value="255"/>
<param name="b" value="0"/>
<param name="similarity" value="400"/>
<param name="smoothness" value="80"/>
<param name="spill" value="100"/>
<param name="opacity" value="255"/>
<param name="brightness" value="0"/>
<param name="contrast" value="100"/>
<param name="gamma" value="100"/>
</effect>
<transition type="mix" start="00:00:00.000" stop="00:00:10.000"/>
</track>
</group>
</timeline>
</timelines>
Remarks:
As a result for this xtl the file "chromakey_video_with_bg_image.mp4" should be created where green background in video "chromakey.mp4" is replaced by "ocean.jpg" image. (see chroma_key effect for parameters description)
A transcoding will be applied to create an output file with the original video "chromakey.mp4" file parameters.
Dissolve transition
Samples\Media\Batch XTL Samples\transition_dissolve.xtl
<timelines version="3">
<timeline>
<engine type="gstreamer"/>
<group output="..\output\transition_dissolve.mp4">
<track video="1" audio="1" text="0" accuracy="frame">
<clip src="..\mp4\sample_mp4.mp4" start="00:00:00.00" stop="00:00:15.00" />
<clip src="..\mp4\sample_mp4.mp4" start="00:00:03.00" stop="00:00:15.00" />
<effect type="transparency" start="00:00:12.00" stop="00:00:15.00">
<param name="bkcolor" value="black" />
<param name="alpha" value="255">
<linear length="00:00:03.00" value="0"/>
</param>
</effect>
</track>
<track video="1">
<clip src="..\mp4\sample_mp4.mp4" length="00:00:12.00" flags="blank" />
<clip src="..\mp4\sample_mp4.mp4" start="00:00:00.00" stop="00:00:03.00"/>
<clip src="..\mp4\sample_mp4.mp4" length="00:00:12.00" flags="blank" />
<effect type="transparency" start="00:00:12.00" stop="00:00:15.00">
<param name="bkcolor" value="transparent" />
<param name="alpha" value="0">
<linear length="00:00:03.00" value="255"/>
</param>
</effect>
<transition type="mix" start="00:00:12.00" stop="00:00:15.00"/>
</track>
</group>
</timeline>
</timelines>
Remarks:
The first track of the XTL is built to represent the entire output file structure and duration. It contains all files that will present in the output file. In addition, it contains the effect tag, to describe the timings for each of the dissolves. The number of effect tags should be the same as the number of dissolves and each one should describe the "fade out" on the first of two files affected by the current dissolve. Additional track is required for each second of two affected files. Such tracks must specify the following info:
- stream to which the transition will be applied (Type and number. Only one type of stream should be specified.)
- effect tag, that describes the "fade in" on the second file
- transition tag, showing that the current track will be processed according to that tag and added to the output file.
As a result for this xtl the file transition_dissolve.mp4 should be created which consists of 2 equal videos and 1 dissolve transition between them for a duration of 3 seconds.
Fade-in and fade-out transitions
Samples\Media\Batch XTL Samples\transition_fadeout_fadein.xtl
<timelines version="3">
<timeline>
<engine type="gstreamer"/>
<group output="..\output\transition_fadeout_fadein.mp4">
<track video="1" audio="1" text="0" accuracy="frame">
<clip src="..\mp4\sample_mp4.mp4" start="00:00:00.00" stop="00:00:15.00" />
<clip src="..\mp4\sample_mp4.mp4" start="00:00:00.00" stop="00:00:15.00" />
<effect type="transparency" start="00:00:12.00" stop="00:00:15.00">
<param name="bkcolor" value="black" />
<param name="alpha" value="255">
<linear length="00:00:03.00" value="0"/>
</param>
</effect>
<effect type="transparency" start="00:00:15.00" stop="00:00:18.00">
<param name="bkcolor" value="black" />
<param name="alpha" value="0">
<linear length="00:00:03.00" value="255"/>
</param>
</effect>
</track>
</group>
</timeline>
</timelines>
Remarks:
The sample contains 2 files, described in the clip tags and 2 effect tags - the first one describes the "fade out" and the second one describes the "fade in". effect tags also contain additional parameters in param tags - a background color and a transparency value and variation function.
As a result for this xtl the file transition_fadeout_fadein.mp4
should be created which consists of 2 equal videos - the first video will have a "fade out" effect in its end and the second file will have a "fade in" effect in its beginning.
Common transitions
Samples\Media\Batch XTL Samples\transitions.xtl
<timelines version="3">
<timeline>
<engine type="gstreamer"/>
<group output="..\output\transitions_avc_mp4.mp4">
<!--specify compression parameters for the transcoding-->
<param name="reference_file" value="../mp4/test_video_1.mp4"/>
<!--add common output file structure, work only with the video stream-->
<track video="1" audio="0" accuracy="frame">
<clip src="..\mp4\test_video_1.mp4" start="00:00:00.00" stop="00:00:02.00" />
<clip src="..\mp4\test_video_1.mp4" start="00:00:01.00" stop="00:00:02.00" />
<--declare a fade-in on the beginning of the first file-->
<effect type="transparency" start="00:00:00.00" stop="00:00:01.00" >
<param name="bkcolor" value="black" />
<param name="alpha" value="0">
<linear length="00:00:01.00" value="255" />
</param>
</effect>
<!--prepare the fade-out part of the dissolve transition between 2 files, the rest part is in the separate track below-->
<effect type="transparency" start="00:00:01.00" stop="00:00:02.00" >
<param name="bkcolor" value="black" />
<param name="alpha" value="255">
<linear length="00:00:01.00" value="0" />
</param>
</effect>
<!--declare a fade-out on the ending of the second video file-->
<effect type="transparency" start="00:00:02.00" stop="00:00:03.00" >
<param name="bkcolor" value="black" />
<param name="alpha" value="255">
<linear length="00:00:01.00" value="0" />
</param>
</effect>
</track>
<!--finalize the dissolve effect by specifying a fade-in part on the second file and declaring a mix transition-->
<track video="1">
<clip src="..\mp4\test_video_1.mp4" length="00:00:01.00" flags="blank" />
<clip src="..\mp4\test_video_1.mp4" start="00:00:00.00" stop="00:00:01:00" />
<clip src="..\mp4\test_video_1.mp4" length="00:00:01.00" flags="blank" />
<effect type="transparency" start="00:00:01.00" stop="00:00:02.00">
<param name="bkcolor" value="transparent" />
<param name="alpha" value="0">
<linear length="00:00:01.00" value="255" />
</param>
</effect>
<transition type="mix" start="00:00:01.00" stop="00:00:02.00"/>
</track>
<!--declare a picture overlay-->
<track video="1">
<clip src="..\png\attractive.png" length="00:00:01.00" flags="blank"/>
<clip src="..\png\attractive.png" length="00:00:01.00" />
<clip src="..\png\attractive.png" length="00:00:01.00" flags="blank"/>
<transition type="pip" start="00:00:01.00" stop="00:00:02.00">
<param name="x" value="0"/>
<param name="y" value="0"/>
<param name="width" value="184"/>
<param name="height" value="112"/>
</transition>
</track>
<!--add audio from the same input files-->
<track video="0" audio="1" accuracy="frame">
<clip src="..\mp4\test_video_1.mp4" start="00:00:00.00" stop="00:00:02.00" />
<clip src="..\mp4\test_video_1.mp4" start="00:00:01.00" stop="00:00:02.00" />
</track>
<!--declare mixing of the additional audio from the separate mp3 file-->
<track audio="1">
<clip src="..\mp3\mp3_single.mp3" length="00:00:00.50" flags="audio_silence"/>
<clip src="..\mp3\mp3_single.mp3" start="00:00:00.00" stop="00:00:02.00" />
<clip src="..\mp3\mp3_single.mp3" length="00:00:00.50" flags="audio_silence"/>
<transition type="mix" start="00:00:00.50" stop="00:00:02.50"/>
</track>
</group>
</timeline>
</timelines>
Remarks:
As a result for this xtl the file transitions_avc_mp4.mp4
should be created where threre are different transitions demonstrated:
- Fade-in on the first file for a duration of 1 second starting at 0sec.
- Dissolve between the first and the second files for a duration of 1 second starting at 1 sec.
- Fade-out on the second files end for a duration of 1 second, starting at 2 sec.
- Overlaying image for the duration of 1 second, starting at 1 sec.
- Adding audio tracks separately from the same source files
- Mixing audio from the external mp3 file for a duration of 2 seconds, starting at 0.5 sec.
A transcoding will be applied to create an output file with the parameters specified in the test_video_1.mp4
reference file.