Multi-Clip Concatenation - Content Management
Multi-Clip Concatenation
Splice segments from multiple source entries into a single output.
Basic Concatenation (Two Sources)
curl -X POST "$KALTURA_SERVICE_URL/service/media/action/addContent" \
-d "ks=$KALTURA_KS" \
-d "format=1" \
-d "entryId=$KALTURA_ENTRY_ID" \
-d "resource[objectType]=KalturaOperationResources" \
-d "resource[resources][0][objectType]=KalturaOperationResource" \
-d "resource[resources][0][resource][objectType]=KalturaEntryResource" \
-d "resource[resources][0][resource][entryId]=$KALTURA_SOURCE_ENTRY_1" \
-d "resource[resources][0][resource][flavorParamsId]=0" \
-d "resource[resources][0][operationAttributes][0][objectType]=KalturaClipAttributes" \
-d "resource[resources][0][operationAttributes][0][offset]=0" \
-d "resource[resources][0][operationAttributes][0][duration]=10000" \
-d "resource[resources][1][objectType]=KalturaOperationResource" \
-d "resource[resources][1][resource][objectType]=KalturaEntryResource" \
-d "resource[resources][1][resource][entryId]=$KALTURA_SOURCE_ENTRY_2" \
-d "resource[resources][1][resource][flavorParamsId]=0" \
-d "resource[resources][1][operationAttributes][0][objectType]=KalturaClipAttributes" \
-d "resource[resources][1][operationAttributes][0][offset]=0" \
-d "resource[resources][1][operationAttributes][0][duration]=15000"
Output: a new entry with first 10s of source 1 followed by first 15s of source 2.
Chapter Name Policy
When concatenating clips, Kaltura can auto-generate chapter cue points. Control naming with chapterNamePolicy:
| Value | Policy | Chapter Names |
|---|---|---|
| 1 | BY_ENTRY_ID | Source entry IDs as chapter titles |
| 2 | BY_ENTRY_NAME | Source entry names as chapter titles |
| 3 | NUMERICAL | Sequential numbers (1, 2, 3...) |
Add to the request:
-d "resource[chapterNamePolicy]=2"
Global Offset in Destination
Use globalOffsetInDestination (milliseconds) on each clip to control placement timing in the output timeline. Gaps between clips result in black frames.
-d "resource[resources][0][operationAttributes][0][globalOffsetInDestination]=0" \
-d "resource[resources][1][operationAttributes][0][globalOffsetInDestination]=15000"
Dimension Normalization
When concatenating sources with different resolutions, use dimensionsAttributes on the KalturaOperationResources container to normalize output dimensions.
Crop to aspect ratio:
-d "resource[dimensionsAttributes][objectType]=KalturaAspectRatioCropAttributes" \
-d "resource[dimensionsAttributes][aspectRatioX]=16" \
-d "resource[dimensionsAttributes][aspectRatioY]=9"
Scale with letterbox/pillarbox:
-d "resource[dimensionsAttributes][objectType]=KalturaAspectRatioScaleAttributes" \
-d "resource[dimensionsAttributes][aspectRatioX]=16" \
-d "resource[dimensionsAttributes][aspectRatioY]=9"
Exact resolution crop:
-d "resource[dimensionsAttributes][objectType]=KalturaResolutionCropAttributes" \
-d "resource[dimensionsAttributes][width]=1920" \
-d "resource[dimensionsAttributes][height]=1080"