This guide provides step-by-step instructions on how to add an overlay image (such as a watermark) to a video during the encoding process in Ravnur Media System.
Step 1: Create input assets
Upload your video asset: Upload the video you want to process as the first input asset.
Upload your overlay image: Upload the image you wish to use as an overlay (e.g., watermark) as the second input asset.
Step 2: Create output asset
Create an output asset where the processed video will be saved.
Step 3: Create a transform with an overlay filter
Create a transform: Define a transform that includes the overlay filter.
-
Configure the overlay:
Set the
inputLabel(e.g., "watermark") to match the label used for the overlay image in the job input.Apply the video Overlay filter in the transform, specifying details like the duration, opacity, and positioning of the overlay.
Example of transform with Overlay filter:
{
"properties": {
"outputs": [
{
"onError": "StopProcessingJob",
"relativePriority": "Normal",
"preset": {
"@odata.type": "#Microsoft.Media.StandardEncoderPreset",
"filters": {
"rotation": "Auto",
"overlays": [
{
"@odata.type": "#Microsoft.Media.VideoOverlay",
"inputLabel": "watermark",
"start": "PT5S",
"end": "PT60S",
"fadeInDuration": "PT5S",
"fadeOutDuration": "PT5S",
"audioGainLevel": 1.0,
"position": {
"left": "60%",
"top": "60%"
},
"opacity": 1.0,
"cropRectangle": {
"left": "0",
"top": "0",
"width": "40%",
"height": "40%"
}
}
]
},
"codecs": [
{
"@odata.type": "#Microsoft.Media.AacAudio",
"channels": 2,
"samplingRate": 48000,
"bitrate": 128000,
"profile": "AacLc"
},
{
"@odata.type": "#Microsoft.Media.H264Video",
"keyFrameInterval": "PT2S",
"stretchMode": "AutoSize",
"syncMode": "Auto",
"sceneChangeDetection": false,
"rateControlMode": "ABR",
"complexity": "Balanced",
"layers": [
{
"width": "1920",
"height": "1280",
"label": "1920x1280",
"bitrate": 4500000,
"maxBitrate": 4500000,
"bFrames": 0,
"frameRate": "0",
"slices": 0,
"adaptiveBFrame": false,
"profile": "High",
"level": "auto",
"bufferWindow": "PT5S",
"referenceFrames": 3,
"crf": 23,
"entropyMode": "Cabac"
},
{
"width": "1280",
"height": "720",
"label": "1280x720",
"bitrate": 2800000,
"maxBitrate": 2800000,
"bFrames": 0,
"frameRate": "0",
"slices": 0,
"adaptiveBFrame": false,
"profile": "High",
"level": "auto",
"bufferWindow": "PT5S",
"referenceFrames": 3,
"crf": 23,
"entropyMode": "Cabac"
},
{
"width": "854",
"height": "480",
"label": "854x480",
"bitrate": 1200000,
"maxBitrate": 1200000,
"bFrames": 0,
"frameRate": "0",
"slices": 0,
"adaptiveBFrame": false,
"profile": "Baseline",
"level": "3.1",
"bufferWindow": "PT5S",
"referenceFrames": 3,
"crf": 23,
"entropyMode": "Cavlc"
},
{
"width": "640",
"height": "360",
"label": "640x360",
"bitrate": 750000,
"maxBitrate": 750000,
"bFrames": 0,
"frameRate": "0",
"slices": 0,
"adaptiveBFrame": false,
"profile": "Baseline",
"level": "3.1",
"bufferWindow": "PT5S",
"referenceFrames": 3,
"crf": 23,
"entropyMode": "Cavlc"
},
{
"width": "426",
"height": "240",
"label": "426x240",
"bitrate": 400000,
"maxBitrate": 400000,
"bFrames": 0,
"frameRate": "0",
"slices": 0,
"adaptiveBFrame": false,
"profile": "Baseline",
"level": "3.1",
"bufferWindow": "PT5S",
"referenceFrames": 3,
"crf": 23,
"entropyMode": "Cavlc"
}
]
},
{
"@odata.type": "#Microsoft.Media.JpgImage",
"stretchMode": "AutoSize",
"syncMode": "Auto",
"start": "25%",
"step": "33%",
"range": "90%",
"layers": [
{
"width": "640",
"height": "360",
"label": "thumb",
"quality": 70
}
],
"spriteColumn": 0
}
],
"formats": [
{
"@odata.type": "#Microsoft.Media.Mp4Format",
"filenamePattern": "{Basename}_{Label}_{Bitrate}{Extension}",
"outputFiles": []
},
{
"@odata.type": "#Microsoft.Media.JpgFormat",
"filenamePattern": "{Label}_{Index}{Extension}"
}
]
}
}
]
}
}Step 4: Create a job with input assets
-
Specify job inputs: When creating the job, make sure to label the input assets correctly:
The video input (first asset) is the primary video.
The overlay image (second asset) should have the label matching the
inputLabeldefined in the transform (e.g., "watermark").
Job Input JSON Example: example of job with 2 inputs.
{
"properties": {
"input": {
"@odata.type": "#Microsoft.Media.JobInputs",
"inputs": [
{
"@odata.type": "#Microsoft.Media.JobInputAsset",
"assetName": "input-asset-1"
},
{
"@odata.type": "#Microsoft.Media.JobInputAsset",
"assetName": "input-asset-2",
"label":"watermark"
}
]
},
"outputs": [
{
"@odata.type": "#Microsoft.Media.JobOutputAsset",
"assetName": "output-asset"
}
],
"priority": "Normal"
}
}Step 5: Monitor the job and retrieve output
Job Completion: Once the job is finished, you can proceed to create a streaming locator or download the generated video with different quality options from the output asset.
Watermark Effect: The overlay image (watermark) will be applied to the video as defined in the transform. The image will appear on the video between the specified start (
starttime) and (endtime) durations.
Notes:
Ensure that the overlay image is properly sized and positioned to avoid obstructing critical content in the video.
For detailed information on all supported properties for video overlays, refer to the Ravnur Transform API Reference.