-
Notifications
You must be signed in to change notification settings - Fork 12
Tutorial.8 Overlay an image on a video
Giuliano Catrambone edited this page May 22, 2018
·
4 revisions
This tutorial implements the following Workflow:
- a video and an image is added into MMS in parallel
- as soon as the image is in MMS, it is encoded according the 'Profile Logo' profile
- once all the above activities are finished, the encoded images (Profile Logo) is overlayed on the video
Reference manual for
Create a file (demo_8.json) having the following content
{
"Type": "Workflow",
"Label": "1",
"Variables": {
"TitleOfVideo_1": "My Title of the video_1 content",
"TitleOfImage_1": "My Title of the logo content",
"TitleOfOverlayVideo_1": "My Title of the overlay content"
},
"Task": {
"Type": "GroupOfTasks",
"Parameters": {
"ExecutionType": "parallel",
"Tasks": [
{
"Label": "${TitleOfVideo_1}",
"Type": "Add-Content",
"Parameters": {
"SourceURL": "http://techslides.com/demos/sample-videos/small.mp4",
"FileFormat": "mp4",
"ContentType": "video",
"UserData": { "MyData": "this is my video data" },
"Title": "${TitleOfVideo_1}",
"Retention": "0s"
}
},
{
"Label": "${TitleOfImage_1}",
"Type": "Add-Content",
"Parameters": {
"SourceURL": "copy:///home/mms/catramms/CatraMMS/samples/free-logo.jpg",
"FileFormat": "jpg",
"ContentType": "image",
"UserData": { "MyData": "this is my image data" },
"Title": "${TitleOfImage_1}",
"Retention": "0s"
},
"OnSuccess": {
"Task": {
"Label": "my image encode",
"Type": "Encode",
"Parameters": {
"EncodingPriority": "Low",
"EncodingProfileLabel": "Profile Logo"
}
}
}
}
]
},
"OnSuccess": {
"Task": {
"Label": "my overlay",
"Type": "Overlay-Image-On-Video",
"Parameters": {
"ImagePosition_X_InPixel": "video_width-image_width-10",
"ImagePosition_Y_InPixel": "video_height-image_height-10",
"EncodingPriority": "High",
"References": [
{ "ReferenceLabel": "my image encode", "EncodingProfileLabel": "Profile Logo" },
{ "ReferenceLabel": "${TitleOfVideo_1}" }
],
"UserData": { "MyData": "this is my overlay data" },
"Title": "${TitleOfOverlayVideo_1}",
"Retention": "1d"
}
}
}
}
}
Run the following HTTP POST having as input userKey, APIKey and demo_6.json:
- curl -k -v -X POST -u 654:SU1.8AO1O2z0gdezR99BIPvAz2y4LNUsCKcKJrSrQ_S4lS33iZ4zGJ8kfWxQqmOhKL -d @demo_8.json -H "Content-Type: application/json" https://mms-api.catrasoft.cloud/catramms/v1/ingestion
The return will be:
- { "workflow": { "ingestionRootKey": 258, "label": "1" }, "tasks": [ { "ingestionJobKey": 872, "label": "My Title of the video_1 content" }, { "ingestionJobKey": 873, "label": "My Title of the logo content" }, { "ingestionJobKey": 874, "label": "my image encode" }, { "ingestionJobKey": 875, "label": "my overlay" } ] }
To get the status of the above ingestion, run the HTTP GET having as input the ingestionRootKey:
- curl -k -v -u 654:SU1.8AO1O2z0gdezR99BIPvAz2y4LNUsCKcKJrSrQ_S4lS33iZ4zGJ8kfWxQqmOhKL https://mms-api.catrasoft.cloud/catramms/v1/ingestion/258
The return will be:
{
"workflow" :
{
"ingestionRootKey" : 258,
"label" : "1",
"tasks" :
[
{
"downloadingProgress" : 100,
"endIngestion" : "2018-05-15T14:28:56Z",
"errorMessage" : null,
"ingestionJobKey" : 872,
"ingestionType" : "Add-Content",
"label" : "My Title of the video_1 content",
"mediaItemKey" : 16,
"physicalPathKey" : null,
"startIngestion" : "2018-05-15T14:28:52Z",
"status" : "End_TaskSuccess",
"uploadingProgress" : null,
"videoDetails" :
{
"audioBitRate" : 83050,
"audioChannels" : 1,
"audioCodecName" : "aac",
"audioSampleRate" : 48000,
"bitRate" : 551193,
"durationInMilliSeconds" : 5000,
"videoAvgFrameRate" : "30/1",
"videoBitRate" : 465641,
"videoCodecName" : "h264",
"videoHeight" : 320,
"videoProfile" : "Constrained Baseline",
"videoWidth" : 560
}
},
{
"downloadingProgress" : null,
"endIngestion" : "2018-05-15T14:28:56Z",
"errorMessage" : null,
"imageDetails" :
{
"format" : "JPEG",
"height" : 756,
"quality" : 92,
"width" : 650
},
"ingestionJobKey" : 873,
"ingestionType" : "Add-Content",
"label" : "My Title of the logo content",
"mediaItemKey" : 17,
"physicalPathKey" : null,
"startIngestion" : "2018-05-15T14:28:52Z",
"status" : "End_TaskSuccess",
"uploadingProgress" : null
},
{
"encoding" :
{
"encodingFailuresNumber" : 0,
"encodingJobEnd" : "2018-05-15T14:29:04Z",
"encodingJobStart" : "2018-05-15T14:29:04Z",
"encodingProgress" : 100,
"encodingStatus" : "End_ProcessedSuccessful",
"parameters" :
{
"encodingProfileKey" : 6,
"sourcePhysicalPathKey" : 21
},
"type" : "EncodeImage"
},
"endIngestion" : "2018-05-15T14:29:04Z",
"errorMessage" : null,
"imageDetails" :
{
"format" : "JPEG",
"height" : 47,
"quality" : 92,
"width" : 40
},
"ingestionJobKey" : 874,
"ingestionType" : "Encode",
"label" : "my image encode",
"mediaItemKey" : 17,
"physicalPathKey" : 22,
"startIngestion" : "2018-05-15T14:28:52Z",
"status" : "End_TaskSuccess"
},
{
"encoding" :
{
"encodingFailuresNumber" : 0,
"encodingJobEnd" : "2018-05-15T14:29:19Z",
"encodingJobStart" : "2018-05-15T14:29:14Z",
"encodingProgress" : 100,
"encodingStatus" : "End_ProcessedSuccessful",
"parameters" :
{
"imagePosition_X_InPixel" : "video_width-image_width-10",
"imagePosition_Y_InPixel" : "video_height-image_height-10",
"sourceImagePhysicalPathKey" : 22,
"sourceVideoPhysicalPathKey" : 20
},
"type" : "OverlayImageOnVideo"
},
"endIngestion" : "2018-05-15T14:29:19Z",
"errorMessage" : null,
"ingestionJobKey" : 875,
"ingestionType" : "Overlay-Image-On-Video",
"label" : "my overlay",
"mediaItemKey" : 18,
"physicalPathKey" : 23,
"startIngestion" : "2018-05-15T14:28:52Z",
"status" : "End_TaskSuccess",
"videoDetails" :
{
"audioBitRate" : 69275,
"audioChannels" : 1,
"audioCodecName" : "aac",
"audioSampleRate" : 48000,
"bitRate" : 286110,
"durationInMilliSeconds" : 5000,
"videoAvgFrameRate" : "30/1",
"videoBitRate" : 207495,
"videoCodecName" : "h264",
"videoHeight" : 320,
"videoProfile" : "High",
"videoWidth" : 560
}
}
]
}
}
- tutorial videos: https://www.youtube.com/@CatraMMS/videos
- support email: [email protected]
- info email: [email protected]
- MMS GUI: https://mms-gui.catramms-cloud.com/catramms
- REST MMS API: https://app.swaggerhub.com/apis-docs/giulianoc/MediaManagementService
- API base URL: https://mms-api.catramms-cloud.com/catramms/1.0.1/...
- Delivery URL (authorization by parameter): https://delivery.catramms-cloud.com/catramms/1.0.1/...
- Delivery URL (authorization by path): https://delivery-path.catramms-cloud.com/catramms/1.0.1/...
- Push binary URL: https://binary.catramms-cloud.com/catramms/1.0.1/...
-
Tutorial
- User registration
- Add content - Pull
- Add content, on success send an email
- Two Tasks (Add content) to be executed in parallel
- Add a set of video encoding profiles
- Add two contents, send an email, concat, cut and encode
- Add a single image profile (Logo)
- Add a video, an image, encode the image, overlay the encoded image on the video
-
Workflow Ingestion
Workflow As Library
Add-Remove Content
Delivery
Social Network Delivery
Encoding (video-audio-image)
Media activities
Overlay
Frame Processing
Recorder
Communication
Utilities
Computer Vision