This tutorial implements the following Workflow: * Two contents are added into MMS in parallel * On success an email is sent * On success of the adding of the two contents, the contents are concatenated * On success, the concatenated content is cut * On success, the cut content is encoded

Reference manual for * Add Content (Pull) * Notification through email * Concat * Cut * Encode

Input creation (json)

Create a file (demo_6.json) having the following content

{
    "Type": "Workflow",
    "Label": "1",
    "Variables": {
        "TitleOfVideo_1": "My Title of the video_1 content",
        "TitleOfVideo_2": "My Title of the video_2 content",
        "TitleOfConcatVideo": "My Title of the concat video content",
        "TitleOfCutVideo": "My Title of the concat video 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": "${TitleOfVideo_2}",
                "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_2}",
                        "Retention": "0s"
                    }   
                }
            ]   
        },
        "OnSuccess": {
            "Task": {   
                "Type": "Concat-Demuxer",
                "Parameters": { 
                    "UserData": { "MyData": "this is my frame data" },
                    "Title": "${TitleOfConcatVideo}",
                    "Retention": "0s"
                },              
                "OnSuccess": {
                    "Task": {
                        "Type": "Cut",
                        "Parameters": {
                            "StartTimeInSeconds": 5.0,
                            "EndTimeInSeconds": 10.0,
                            "UserData": { "MyData": "this is my frame data" },
                            "Title": "${TitleOfCutVideo}"
                        },
                        "OnSuccess": {
                            "Task": {
                                "Label": "my label",
                                "Type": "Encode",
                                "Parameters": {
                                    "EncodingPriority": "Low",
                                    "EncodingProfilesSetLabel": "Sport"
                                }
                            }
                        }
                    }
                }
            }
        },
        "OnComplete": {
            "Task": {
                "Type": "Email-Notification",
                "Parameters": {
                    "EmailAddress": "giulianoc@catrasoftware.it",
                    "Subject": "Task finished",
                    "Message": "Task __INGESTIONJOBKEY__ has finished"
                }
            }
        }
    }
}

Command

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_6.json -H "Content-Type: application/json" https://mms-api.catrasoft.cloud/catramms/v1/ingestion

The return will be: * { "workflow": { "ingestionRootKey": 256, "label": "1" }, "tasks": [ { "ingestionJobKey": 858, "label": "My Title of the video_1 content" }, { "ingestionJobKey": 859, "label": "My Title of the video_2 content" }, { "ingestionJobKey": 860, "label": "" }, { "ingestionJobKey": 861, "label": "" }, { "ingestionJobKey": 862, "label": "my label - EncodingProfileKey 4" }, { "ingestionJobKey": 863, "label": "my label - EncodingProfileKey 5" }, { "ingestionJobKey": 864, "label": "" } ] }

Get the status of the entire Workflow

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/256

The return will be:

{
    "workflow" : 
    {
        "ingestionRootKey" : 256,
        "label" : "1",
        "tasks" : 
        [
            {
                "downloadingProgress" : 100,
                "endIngestion" : "2018-05-15T13:20:00Z",
                "errorMessage" : null,
                "ingestionJobKey" : 858,
                "ingestionType" : "Add-Content",
                "label" : "My Title of the video_1 content",
                "mediaItemKey" : 8,
                "physicalPathKey" : null,
                "startIngestion" : "2018-05-15T13:19:57Z",
                "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" : 100,
                "endIngestion" : "2018-05-15T13:20:00Z",
                "errorMessage" : null,
                "ingestionJobKey" : 859,
                "ingestionType" : "Add-Content",
                "label" : "My Title of the video_2 content",
                "mediaItemKey" : 9,
                "physicalPathKey" : null,
                "startIngestion" : "2018-05-15T13:19:57Z",
                "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
                }
            },
            {
                "endIngestion" : "2018-05-15T13:20:02Z",
                "errorMessage" : null,
                "ingestionJobKey" : 860,
                "ingestionType" : "Concat-Demuxer",
                "label" : "",
                "mediaItemKey" : 10,
                "physicalPathKey" : null,
                "startIngestion" : "2018-05-15T13:19:57Z",
                "status" : "End_TaskSuccess",
                "videoDetails" : 
                {
                    "audioBitRate" : 83050,
                    "audioChannels" : 1,
                    "audioCodecName" : "aac",
                    "audioSampleRate" : 48000,
                    "bitRate" : 553688,
                    "durationInMilliSeconds" : 11000,
                    "videoAvgFrameRate" : "124500/4163",
                    "videoBitRate" : 464245,
                    "videoCodecName" : "h264",
                    "videoHeight" : 320,
                    "videoProfile" : "Constrained Baseline",
                    "videoWidth" : 560
                }
            },
            {
                "endIngestion" : "2018-05-15T13:20:02Z",
                "errorMessage" : null,
                "ingestionJobKey" : 864,
                "ingestionType" : "Email-Notification",
                "label" : "",
                "mediaItemKey" : null,
                "physicalPathKey" : null,
                "startIngestion" : "2018-05-15T13:19:57Z",
                "status" : "End_TaskSuccess"
            },
            {
                "endIngestion" : "2018-05-15T13:20:04Z",
                "errorMessage" : null,
                "ingestionJobKey" : 861,
                "ingestionType" : "Cut",
                "label" : "",
                "mediaItemKey" : 11,
                "physicalPathKey" : null,
                "startIngestion" : "2018-05-15T13:19:57Z",
                "status" : "End_TaskSuccess",
                "videoDetails" : 
                {
                    "audioBitRate" : 82253,
                    "audioChannels" : 1,
                    "audioCodecName" : "aac",
                    "audioSampleRate" : 48000,
                    "bitRate" : 527365,
                    "durationInMilliSeconds" : 4000,
                    "videoAvgFrameRate" : "30/1",
                    "videoBitRate" : 491635,
                    "videoCodecName" : "h264",
                    "videoHeight" : 320,
                    "videoProfile" : "Constrained Baseline",
                    "videoWidth" : 560
                }
            },
            {
                "encoding" : 
                {
                    "encodingFailuresNumber" : 0,
                    "encodingJobEnd" : "2018-05-15T13:20:15Z",
                    "encodingJobStart" : "2018-05-15T13:20:10Z",
                    "encodingProgress" : 100,
                    "encodingStatus" : "End_ProcessedSuccessful",
                    "parameters" : 
                    {
                        "encodingProfileKey" : 5,
                        "sourcePhysicalPathKey" : 11
                    },
                    "type" : "EncodeVideoAudio"
                },
                "endIngestion" : "2018-05-15T13:20:15Z",
                "errorMessage" : null,
                "ingestionJobKey" : 863,
                "ingestionType" : "Encode",
                "label" : "my label - EncodingProfileKey 5",
                "mediaItemKey" : 11,
                "physicalPathKey" : 12,
                "startIngestion" : "2018-05-15T13:19:57Z",
                "status" : "End_TaskSuccess",
                "videoDetails" : 
                {
                    "audioBitRate" : 64072,
                    "audioChannels" : 1,
                    "audioCodecName" : "aac",
                    "audioSampleRate" : 48000,
                    "bitRate" : 208019,
                    "durationInMilliSeconds" : 5000,
                    "videoAvgFrameRate" : "30/1",
                    "videoBitRate" : 133364,
                    "videoCodecName" : "h264",
                    "videoHeight" : 480,
                    "videoProfile" : "High",
                    "videoWidth" : 720
                }
            },
            {
                "encoding" : 
                {
                    "encodingFailuresNumber" : 0,
                    "encodingJobEnd" : "2018-05-15T13:20:25Z",
                    "encodingJobStart" : "2018-05-15T13:20:20Z",
                    "encodingProgress" : 100,
                    "encodingStatus" : "End_ProcessedSuccessful",
                    "parameters" : 
                    {
                        "encodingProfileKey" : 4,
                        "sourcePhysicalPathKey" : 11
                    },
                    "type" : "EncodeVideoAudio"
                },
                "endIngestion" : "2018-05-15T13:20:25Z",
                "errorMessage" : null,
                "ingestionJobKey" : 862,
                "ingestionType" : "Encode",
                "label" : "my label - EncodingProfileKey 4",
                "mediaItemKey" : 11,
                "physicalPathKey" : 13,
                "startIngestion" : "2018-05-15T13:19:57Z",
                "status" : "End_TaskSuccess",
                "videoDetails" : 
                {
                    "audioBitRate" : 64072,
                    "audioChannels" : 1,
                    "audioCodecName" : "aac",
                    "audioSampleRate" : 48000,
                    "bitRate" : 343116,
                    "durationInMilliSeconds" : 5000,
                    "videoAvgFrameRate" : "30/1",
                    "videoBitRate" : 268840,
                    "videoCodecName" : "h264",
                    "videoHeight" : 480,
                    "videoProfile" : "High",
                    "videoWidth" : 720
                }
            }
        ]
    }
}