Skip to main content
View as Markdown

Overlay (Picture-in-Picture) - Content Management

Overlay (Picture-in-Picture)​

Compose one video on top of another at a specified position, size, and shape.

KalturaOverlayAttributes​

ParameterTypeDescription
objectTypestringKalturaOverlayAttributes
resourceobjectOverlay source (KalturaEntryResource or KalturaAssetResource)
overlayPlacementintPosition on 9-point grid (see alignment table)
overlayScalePercentagefloatSize relative to main video (0.1–0.9)
marginsPercentagefloatMargin from edges (0.1–0.9)
overlayShapeintShape of overlay window
audioAttributesobjectAudio mixing settings
resourceMediaCompositionAttributesArrayarrayNested composition (max 1 — for background replacement on the overlay source)

Overlay Placement (KalturaMediaCompositionAlignment)​

ValuePosition
1Top-Left
2Top-Center
3Top-Right
4Center
6Bottom-Left
7Bottom-Center
8Bottom-Right

Overlay Shape​

ValueShape
1CIRCLE
2RECTANGLE
3RECTANGLE_ROUNDED_CORNERS
4ELLIPSE

Basic PiP Example​

Place a speaker video (circle, bottom-right, 25% size) over the main presentation:

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]=KalturaOperationResource" \
-d "resource[resource][objectType]=KalturaEntryResource" \
-d "resource[resource][entryId]=$KALTURA_MAIN_VIDEO_ENTRY_ID" \
-d "resource[resource][flavorParamsId]=0" \
-d "resource[operationAttributes][0][objectType]=KalturaClipAttributes" \
-d "resource[operationAttributes][0][offset]=0" \
-d "resource[operationAttributes][0][duration]=60000" \
-d "resource[operationAttributes][0][mediaCompositionAttributesArray][0][objectType]=KalturaOverlayAttributes" \
-d "resource[operationAttributes][0][mediaCompositionAttributesArray][0][resource][objectType]=KalturaEntryResource" \
-d "resource[operationAttributes][0][mediaCompositionAttributesArray][0][resource][entryId]=$KALTURA_OVERLAY_ENTRY_ID" \
-d "resource[operationAttributes][0][mediaCompositionAttributesArray][0][resource][flavorParamsId]=0" \
-d "resource[operationAttributes][0][mediaCompositionAttributesArray][0][overlayPlacement]=8" \
-d "resource[operationAttributes][0][mediaCompositionAttributesArray][0][overlayScalePercentage]=0.25" \
-d "resource[operationAttributes][0][mediaCompositionAttributesArray][0][marginsPercentage]=0.1" \
-d "resource[operationAttributes][0][mediaCompositionAttributesArray][0][overlayShape]=1"