Processing Control (Jobs)
Broadcast asset generation is carried out through processing jobs.
The job processes can be checked to see the newly generated asset, whether the processing was completed successfully or not, and the processing time.
The processing can generate files in specific formats, such as MP4 files (H.264 or H.265) or HLS (streaming files).
Programming Interface (APIs)
List of Jobs
You can execute an API command to list the jobs.
The jobs will always be listed from the most recently executed to the oldest.
The listing provides various pieces of information about the job, such as the processing status and the ID of the generated asset.
Make an authenticated GET request command in /api/job
GET https://api.elasticencoder.videolib.live/dev/job
Headers for GET for /api/job
Header Value
Ocp-Apim-Subscription-Key microservice authorization key.
Content-Type application/json.
As a result, the list of jobs will be returned.
{
"codMensagem": null,
"rows": 1,
"continuationToken": null,
"items": [
{
"guid": "job-2516970584269866335-f92daed3-a6ad-483e-9d11-e67aed51be73",
"application": "videolib-ecine-dev",
"assetIdMezanine": "asset-2516971159162250822-b3f503f5-241d-4c1b-876b-bcaf006e02e3",
"assetIdEncoded": null,
"presetId": "71",
"jobName": "job-001",
"startTime": null,
"finishTime": null,
"jobStatus": 0, -- Indicates the status of processing.
"percent": null,
"duration": null,
"message": null,
"errorMessage": null,
"errorCode": null,
"listaMarcacoes": null,
"timestamp": null,
"cod_erro": null,
"status_ret": null,
"erro": null
}
],
"cod_erro": null,
"status_ret": null,
"erro": null
}
Where:
jobStatus - Job status
0 - Waiting
1 - Added to the Processing Queue
2 - Processing
3 - Successfully completed
4 - finalized with error
startTime - Start of processing
finishTime - End of processing
percent - Processing Percentage
duration - Video Length
message - Encoder Log
errorMessage - in case there is an error in the processing.
assetIdEncoded - ID of the newly generated asset
Example of a Job in Process:
{
"codMensagem": null,
"rows": 1,
"continuationToken": null,
"items": [
{
"guid": "job-2516970584269866335-f92daed3-a6ad-483e-9d11-e67aed51be73",
"application": "videolib-ecine-dev",
"assetIdMezanine": "asset-2516971159162250822-b3f503f5-241d-4c1b-876b-bcaf006e02e3",
"assetIdEncoded": "asset-2516970582014134791-a98c1ba0-1936-4cc4-abe6-53a07054e5a2",
"presetId": "71",
"jobName": "job-001",
"startTime": "2024-01-14T14:29:58.1623643Z",
"finishTime": null,
"jobStatus": 2,
"percent": 66,
"duration": 30,
"message": "E: frame= 362 fps= 10 q=38.0 q=1.6 q=56.0 q=44.0 q=38.0 size= 3584kB time=00:00:20.00 bitrate=1468.0kbits/s dup=0 drop=357 speed=0.573x ",
"errorMessage": null,
"errorCode": null,
"listaMarcacoes": null,
"timestamp": null,
"cod_erro": null,
"status_ret": null,
"erro": null
}
],
"cod_erro": null,
"status_ret": null,
"erro": null
}
Job Creation
Make an authenticated POST request command in /api/job
POST https://api.elasticencoder.videolib.live/dev/job
Headers for POST to /api/job.
Header Value
Ocp-Apim-Subscription-Key microservice authorization key.
Content-Type application/json.
In the body of the request, send the JSON below:
{
"assetIdMezanine":"Asset ID",
"jobName":"Job Name (External Control)",
"presetId":"preset code (*)"
}
Where:
assetIdMezanine - Asset id of the original file
jobName - Job name (free description)
presetId - Preset code
The Preset Code (presetId) determines which formats will be transcoded. An original file can be transcoded into mp4 files or HLS format for transmission, in the following resolutions.
HLS
360 (428k), 720 (1498k) ou 1080 (2675k)
MP4
360 (428k), 720 (1498k) ou 1080 (2675k)
The encoding follows a complementary binary model of selection, so that in a format it is necessary to pass the following codes.
Format Code
HLS 360 1
HLS 720 2
HLS 1080 4
HLS 4K 8
MP4 360 16
MP4 720 32
MP4 1080 64
For example, to generate an adaptive bitrate file, with the formats 360, 720 and 1080 with a downloadable mp4 file of 1080, the job must be passed the presetId equal to 71. (64+1+2+4). If it is necessary to generate a 4k HLS file, it is necessary to pass the value 79.
When a POST command is executed, the following JSON will be generated in return of the command:
{
"guid": "job-2516970584269866335-f92daed3-a6ad-483e-9d11-e67aed51be73", -- Job ID
"application": "videolib-ecine-dev",
"assetIdMezanine": "asset-2516971159162250822-b3f503f5-241d-4c1b-876b-bcaf006e02e3",
"assetIdEncoded": null,
"presetId": "71",
"jobName": "job-001",
"startTime": null,
"finishTime": null,
"jobStatus": 0,
"percent": null,
"duration": null,
"message": null,
"errorMessage": null,
"errorCode": null,
"listaMarcacoes": null,
"timestamp": null,
"cod_erro": null,
"status_ret": null,
"erro": null
}