Batch Samples
All XTL samples located in SolveigMM_Video_Editing_SDK_Linux/samples/media/batch_xtl_samples. To run the samples you should use the command line console utility smm_batchsplit.sh. The full XTL file's path should be passed.
smm_batchsplit.sh SolveigMM_Video_Editing_SDK_Linux/samples/media/batch_xtl_samples/batch_trimming.xtl
Trimming
samples/media/batch_xtl_samples/trimming-xavc-mxf.xtl
<timelines version="3"> <timeline> <group output="../output/sample_mxf_hd_xavc_0001.mxf"> <track video="1" audio="1" text="0" accuracy="frame"> <clip src="../mxf/sample_mxf_hd_xavc.mxf" start="2400000" stop="6400000" timeFormat="100ns_units" /> </track> <additional_param audio="3" /> </group> </timeline> </timelines> |
Remarks:
As a result, the file "sample_mxf_hd_xavc_0001.mxf" will be created out of the source file 'sample_mxf_hd_xavc.mxf' from 240ms to 640ms with two audio tracks: the first and the third. Trimming is frame accurate
Trimming HLS-TS with MP4 remux
samples/media/batch_xtl_samples/trimming_hls2mp4.xtl
<timelines version="3"> <timeline> <group output="../output/hls_ts_output.mp4" out_type="mp4"> <track video="1" audio="-1" text="0" accuracy="frame"> <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.
Transcoding
samples/media/batch_xtl_samples/smart_transcodeing.xtl
<timelines version="3"> <timeline> <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.
Mute audio
samples/media/batch_xtl_samples/joining.xtl
<timelines version="3"> <timeline> <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" timeFormat="time10ms" flags="audio_silence"/> <clip src="../mp4/sample_mp4.mp4" start="00:00:05:00" stop="00:00:10:00" timeFormat="time10ms" /> <clip src="../mp4/sample_mp4.mp4" start="00:00:10:00" stop="00:00:15:00" timeFormat="time10ms" flags="audio_silence"/> </track> </group> </timeline> </timelines> |
Remarks:
As a result the file "audio_mute.mp4" should be created where the first and the last 5 seconds are silent.
Mix audio
samples/media/batch_xtl_samples/audio_mix.xtl
<timelines version="3"> <timeline> <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" timeFormat="time10ms" /> </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" timeFormat="time10ms" /> </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" timeFormat="time10ms" /> <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:
As a result the file "audio_mix.mp4" should be created where the audio from a separate file will be mixed in a source audio for a duration of 10 seconds starting at 2 sec. The external audio is explicitly declared to be mixed in the audio stream #1.
Audio volume effect
samples/media/batch_xtl_samples/audio_volume_effect.xtl
<timelines version="3"> <timeline> <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" timeFormat="time10ms" /> </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" timeFormat="time10ms" /> <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)
Convert image to video
samples/media/batch_xtl_samples/image_to_video.xtl
<timelines version="3"> <timeline> <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.
Dissolve
samples/media/batch_xtl_samples/transition_dissolve.xtl
The sample shows the dissolve transition between 2 videos. The duration of the transition is 3 seconds.
<timelines version="3"> <timeline> <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
samples/media/batch_xtl_samples/transition_fadeout_fadein.xtl
The sample shows the "fade in" and "fade out" effects on 2 combined videos. The duration of each effect is 3 seconds.
<timelines version="3"> <timeline> <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.
Image overlay
samples/media/batch_xtl_samples/image_overlay.xtl
The sample shows how to overlay image on video.
<timelines version="3"> <timeline> <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" timeFormat="time10ms" /> </track> <track video="1"> <clip src="../logo.png" length="00:00:02:00" flags="blank" /> <clip src="../logo.png" length="00:00:05:00" /> <clip src="../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 over the video.
Chroma key
samples/media/batch_xtl_samples/chromakey_video_with_bg_image.xtl
The sample shows how to replace green screen to image
<timelines version="3"> <timeline> <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.
Common transitions
samples/media/batch_xtl_samples/transitions_avc_mp4.xtl
The sample shows how to overlay image on video.
<timelines version="3"> <timeline> <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.