Skip to main content

Media Assets

Media assets refer to the storage records of files sent or processed by the platform. A media asset can contain one or more files.

The records of assets and file uploads are handled by a service (asset) that operates through programming interface commands (APIs).

In addition to storage, the asset service handles publishing, enabling the display of processed content or the download of specific files stored in the asset.

Programming Interface (APIs)

List of Assets

Make an authenticated GET request command in /api/asset

GET https://api.elasticencoder.videolib.live/dev/asset

Headers to GET for /api/asset.

Header                           Value
Ocp-Apim-Subscription-Key microservice authorization key.
Content-Type application/json.

As a result, the list of assets stored in the encoder will be returned

{
"codMensagem": null,
"rows": 1,
"continuationToken": null, -- If the value returns filled in must be sent in the next request to get the next page
"items": [
{
"guid": "asset-2516971159162250822-b3f503f5-241d-4c1b-876b-bcaf006e02e3",
"application": "videolib-ecine-dev",
"name": "mezanino-1",
"type": "M",
"creationTime": "2024-01-13T22:28:03.7749442Z",
"fileName": null,
"base64": null,
"publicUrl": null,
"blobSasUri": null,
"publishSasUri": null,
"files": [], -- Files in the asset
"md5": null,
"cod_erro": null,
"status_ret": null,
"erro": null
}
],
"cod_erro": null,
"status_ret": null,
"erro": null
}

ASSET Creation - Container

Make an authenticated POST request command in /api/asset?option=createasset

POST https://api.elasticencoder.videolib.live/dev/asset?option=createasset

Headers for POST to /api/asset.

Header              Value
Ocp-Apim-Subscription-Key microservice authorization key.
Content-Type application/json.

In the body of the request, send the JSON below:

{
"name":"Asset Name"
}

where:

application - Application Name
name - Asset name (for record control)

As a return of the command, the following JSON will be generated:

{
"guid": "asset-2516971159162250822-b3f503f5-241d-4c1b-876b-bcaf006e02e3", -- ID of the generated asset
"application": "videolib-ecine-dev", -- Application Name
"name": "mezanino-1", -- Asset Name (External Reference)
"type": "M", -- Asset type (M - Mezanino, H - HLS)
"creationTime": "2024-01-13T22:28:03.7749442Z", -- Date Created
"fileName": null,
"base64": null,
"publicUrl": null,
"blobSasUri": null,
"publishSasUri": null,
"files": null,
"md5": null,
"cod_erro": null, -- If an error occurs, this value will be filled in
"status_ret": null,-- If an error occurs, this value will be filled in
"erro": null-- If an error occurs, this value will be filled in
}

Asset Creation with URL - Source File.

Make an authenticated POST request command in /api/asset?option=createassetfromcopyurl

POST https://api.elasticencoder.videolib.live/dev/asset?option=createassetfromcopyurl

Headers for POST to /api/asset

Header                          Value
Ocp-Apim-Subscription-Key microservice authorization key.
Content-Type application/json.

In the body of the request, send the JSON below:

{
"guid":"asset-2517124479364104389-c2d4ed18-b8ba-40fe-ab2c-572499527d0d",
"name":"Asset Name",
"fileName":"teste.mp4",
"publicUrl":"https://portalplayerglobointegra.blob.core.windows.net/containervideosprod/1679138.mp4"
}

Where:

guid - Asset ID
application - Application Name
name - Asset name (for record control)
fileName - File name.
publicUrl - Source file URL.

As a return of the command, the following JSON will be generated:

{   
"guid":"asset-8524eefb-cc13-4e59-b83e-7c3faa640db5", -- Asset ID used
"application":"Application-Environment",
"name":"Asset Name",
"creationTime":"2023-12-20T14:30:31.727487Z", - Asset Creation Date
"cod_erro":null, - If there is an error in the processing, this value will be filled in
"status_ret":null, - if there is an error in the value it will be filled with "NOK"
"erro":null - If there is an error in this field, the error message issued by the service will be displayed.
}

Add File to an Asset - Content Mapping

With the encoder it is possible to map a file to an existing asset. Make an authenticated POST request command in /api/asset?option=createaddfileasset

POST https://api.elasticencoder.videolib.live/dev/asset?option=createaddfileasset

Headers for POST to /api/asset

Header                          Value
Ocp-Apim-Subscription-Key microservice authorization key.
Content-Type application/json.

In the body of the request, send the JSON below:

{
"guid":"asset-2517128638480719439-0d31b3c3-d56e-4003-94c8-e1eefc20104c",
"name":"Asset Name",
"fileName":"File name"
}

Where:

guid - Asset ID
application - Application Name
name - Asset name (for record control)
fileName - Name of the mapped file in the storage - if empty, the service maps the files stored in the mapped asset.

As a return of the command, the following JSON will be generated:

{   
"guid":"asset-8524eefb-cc13-4e59-b83e-7c3faa640db5", -- Asset ID used
"application":"Application-Environment",
"name":"Asset Name",
"creationTime":"2023-12-20T14:30:31.727487Z", - Asset Creation Date
"cod_erro":null, - If there is an error in the processing, this value will be filled in
"status_ret":null, - if it gives error value will be filled with "NOK"
"erro":null - If there is an error in this field, the error message issued by the service will be displayed.
}

Publish an Asset - For viewing or downloading the files.

Make an authenticated POST request command in /api/asset?option=createassetfromcopyurl

POST https://api.elasticencoder.videolib.live/dev/asset?option=publish

Headers for POST to /api/asset

Header                          Value
Ocp-Apim-Subscription-Key microservice authorization key.
Content-Type application/json.

In the body of the request, send the JSON below:

{
"guid":"Asset ID",
"fileName": ""
}

As a return of the command, the following JSON will be generated:

{
"guid": "asset-2516971159162250822-b3f503f5-241d-4c1b-876b-bcaf006e02e3",
"application": "videolib-ecine-dev",
"name": null,
"type": null,
"creationTime": null,
"fileName": "",
"base64": null,
"publicUrl": null,
"blobSasUri": null,
"publishSasUri": "https://videolibencoderecinedevm.blob.core.windows.net/asset-2516971159162250822-b3f503f5-241d-4c1b-876b-bcaf006e02e3/video1.mp4?sv=2020-08-04&se=2024-01-14T03%3A57%3A27Z&sr=b&sp=r&sig=3xaDvuXDcR0w8OiZrklQy9Kumv%2FYdRU9YejZ3wK6u%2BE%3D",
"files": null,
"md5": null,
"cod_erro": null,
"status_ret": null,
"erro": null
}

Above is an example of a download from a mezzanine.

To download one or more files from the asset.

When a processed material is published, the json is generated as in the example below:

{
"guid": "asset-2516970188307328515-1e709c6a-1549-492a-91f6-a4f33ce70935",
"application": "videolib-ecine-dev",
"name": null,
"type": null,
"creationTime": null,
"fileName": "",
"base64": null,
"publicUrl": null,
"blobSasUri": null,
"publishSasUri": "https://videolibencoderecinedevh.blob.core.windows.net/asset-2516970188307328515-1e709c6a-1549-492a-91f6-a4f33ce70935/index.m3u8",
"files": [
{
"guidAsset": "asset-2516970188307328515-1e709c6a-1549-492a-91f6-a4f33ce70935",
"name": "358d5235-9f9e-4bd6-8252-78666709605a",
"originalName": "1080p.mp4",
"creationTime": "2024-01-15T01:27:55.6232745Z",
"md5": null
},
{
"guidAsset": "asset-2516970188307328515-1e709c6a-1549-492a-91f6-a4f33ce70935",
"name": "358d5235-9f9e-4bd6-8252-78666709605a",
"originalName": "img000.jpg",
"creationTime": "2024-01-15T01:26:20.1710052Z",
"md5": null
},
{
"guidAsset": "asset-2516970188307328515-1e709c6a-1549-492a-91f6-a4f33ce70935",
"name": "358d5235-9f9e-4bd6-8252-78666709605a",
"originalName": "img001.jpg",
"creationTime": "2024-01-15T01:26:14.0749233Z",
"md5": null
},
{
"guidAsset": "asset-2516970188307328515-1e709c6a-1549-492a-91f6-a4f33ce70935",
"name": "358d5235-9f9e-4bd6-8252-78666709605a",
"originalName": "img002.jpg",
"creationTime": "2024-01-15T01:26:24.2888588Z",
"md5": null
},
{
"guidAsset": "asset-2516970188307328515-1e709c6a-1549-492a-91f6-a4f33ce70935",
"name": "358d5235-9f9e-4bd6-8252-78666709605a",
"originalName": "img003.jpg",
"creationTime": "2024-01-15T01:26:36.9591318Z",
"md5": null
},
{
"guidAsset": "asset-2516970188307328515-1e709c6a-1549-492a-91f6-a4f33ce70935",
"name": "358d5235-9f9e-4bd6-8252-78666709605a",
"originalName": "img004.jpg",
"creationTime": "2024-01-15T01:26:53.6732041Z",
"md5": null
},
{
"guidAsset": "asset-2516970188307328515-1e709c6a-1549-492a-91f6-a4f33ce70935",
"name": "358d5235-9f9e-4bd6-8252-78666709605a",
"originalName": "img005.jpg",
"creationTime": "2024-01-15T01:27:10.6876609Z",
"md5": null
},
{
"guidAsset": "asset-2516970188307328515-1e709c6a-1549-492a-91f6-a4f33ce70935",
"name": "358d5235-9f9e-4bd6-8252-78666709605a",
"originalName": "img006.jpg",
"creationTime": "2024-01-15T01:27:27.3949527Z",
"md5": null
},
{
"guidAsset": "asset-2516970188307328515-1e709c6a-1549-492a-91f6-a4f33ce70935",
"name": "358d5235-9f9e-4bd6-8252-78666709605a",
"originalName": "img007.jpg",
"creationTime": "2024-01-15T01:27:47.9939908Z",
"md5": null
}
],
"md5": null,
"cod_erro": null,
"status_ret": null,
"erro": null
}

The asset files can be downloaded while the asset is published.

To download, simply use the address in the "publishSasUri" field, remove the "index.m3u8" name, and replace it with the name of the file for the download to occur.

For example:

https://videolibencoderecinedevh.blob.core.windows.net/asset-2516970188307328515-1e709c6a-1549-492a-91f6-a4f33ce70935/1080p.mp4

By default, the encoder generates up to 10 images from the video.