This page shows you how to create and manage Live Stream API assets. Assets are video or images that can be used with the Live Stream API. You can use an asset to insert a slate into a live stream.
Supported media formats
The Live Stream API supports the following media codecs and formats for assets.
Input media | Supported formats |
---|---|
Video file formats | MP4, MPEG-TS, FLV |
Video codecs | H.264 |
Audio codecs | AAC, AC3, MP2, MP3 |
Image file formats | JPG |
Maximum size | 250 MB |
Maximum resolutions | 1920x1080 |
Set up your Google Cloud project and authentication
If you have not created a Google Cloud project and credentials, see Before you begin.Create an asset
To create an asset, use the
projects.locations.assets.create
method. The following sample
creates a video asset.
Before using any of the request data, make the following replacements:
: your Google Cloud project number; this is located in the Project number field on the IAM Settings pagePROJECT_NUMBER
: the location in which to create the asset; use one of the supported regionsLOCATION Show locationsus-central1
us-east1
us-east4
us-west1
us-west2
northamerica-northeast1
southamerica-east1
asia-east1
asia-east2
asia-south1
asia-northeast1
asia-southeast1
australia-southeast1
europe-north1
europe-west1
europe-west2
europe-west3
europe-west4
: a user-defined identifier for the new asset to create. This value must be 1-63 characters, begin and end withASSET_ID [a-z0-9]
, and can contain dashes (-) between characters. For example,my-asset
.
: the URI of the video in your Cloud Storage bucket to use, such asASSET_URI gs://my-bucket/my-video.mp4
(see the supported media formats)
To send your request, expand one of these options:
curl (Linux, macOS, or Cloud Shell)
Save the request body in a file named request.json
.
Run the following command in the terminal to create or overwrite
this file in the current directory:
cat > request.json << 'EOF' { "video": { "uri": "ASSET_URI " } } EOF
Then execute the following command to send your REST request:
curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://livestream.googleapis.com/v1/projects/PROJECT_NUMBER /locations/LOCATION /assets?assetId=ASSET_ID "
PowerShell (Windows)
Save the request body in a file named request.json
.
Run the following command in the terminal to create or overwrite
this file in the current directory:
@' { "video": { "uri": "ASSET_URI " } } '@ | Out-File -FilePath request.json -Encoding utf8
Then execute the following command to send your REST request:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://livestream.googleapis.com/v1/projects/PROJECT_NUMBER /locations/LOCATION /assets?assetId=ASSET_ID " | Select-Object -Expand Content
You should receive a JSON response similar to the following:
{ "name": "projects/PROJECT_NUMBER /locations/LOCATION /operations/OPERATION_ID ", "metadata": { "@type": "type.googleapis.com/google.cloud.video.livestream.v1.OperationMetadata", "createTime":CREATE_TIME , "target": "projects/PROJECT_NUMBER /locations/LOCATION /assets/ASSET_ID ", "verb": "create", "requestedCancellation": false, "apiVersion": "v1" }, "done": false }
To learn how to install and use the client library for Live Stream API, see Live Stream API client libraries. For more information, see the Live Stream API C# API reference documentation.
To authenticate to Live Stream API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
To learn how to install and use the client library for Live Stream API, see Live Stream API client libraries. For more information, see the Live Stream API Go API reference documentation.
To authenticate to Live Stream API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
To learn how to install and use the client library for Live Stream API, see Live Stream API client libraries. For more information, see the Live Stream API Java API reference documentation.
To authenticate to Live Stream API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
To learn how to install and use the client library for Live Stream API, see Live Stream API client libraries. For more information, see the Live Stream API Node.js API reference documentation.
To authenticate to Live Stream API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
To learn how to install and use the client library for Live Stream API, see Live Stream API client libraries. For more information, see the Live Stream API PHP API reference documentation.
To authenticate to Live Stream API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
To learn how to install and use the client library for Live Stream API, see Live Stream API client libraries. For more information, see the Live Stream API Python API reference documentation.
To authenticate to Live Stream API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
To learn how to install and use the client library for Live Stream API, see Live Stream API client libraries. For more information, see the Live Stream API Ruby API reference documentation.
To authenticate to Live Stream API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Get asset details
To get the details of the asset, use the
projects.locations.assets.get
method.
Before using any of the request data, make the following replacements:
: your Google Cloud project number; this is located in the Project number field on the IAM Settings pagePROJECT_NUMBER
: the location of your asset; use one of the supported regionsLOCATION Show locationsus-central1
us-east1
us-east4
us-west1
us-west2
northamerica-northeast1
southamerica-east1
asia-east1
asia-east2
asia-south1
asia-northeast1
asia-southeast1
australia-southeast1
europe-north1
europe-west1
europe-west2
europe-west3
europe-west4
: the user-defined identifier for the assetASSET_ID
To send your request, expand one of these options:
curl (Linux, macOS, or Cloud Shell)
Execute the following command:
curl -X GET \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://livestream.googleapis.com/v1/projects/PROJECT_NUMBER /locations/LOCATION /assets/ASSET_ID "
PowerShell (Windows)
Execute the following command:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://livestream.googleapis.com/v1/projects/PROJECT_NUMBER /locations/LOCATION /assets/ASSET_ID " | Select-Object -Expand Content
You should receive a JSON response similar to the following:
{ "name": "projects/PROJECT_NUMBER /locations/LOCATION /assets/ASSET_ID ", "createTime":CREATE_TIME , "updateTime":UPDATE_TIME , "video": { "uri": "ASSET_URI " }, "crc32c": "pKNslg==", "state": "ACTIVE" }
To learn how to install and use the client library for Live Stream API, see Live Stream API client libraries. For more information, see the Live Stream API C# API reference documentation.
To authenticate to Live Stream API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
To learn how to install and use the client library for Live Stream API, see Live Stream API client libraries. For more information, see the Live Stream API Go API reference documentation.
To authenticate to Live Stream API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
To learn how to install and use the client library for Live Stream API, see Live Stream API client libraries. For more information, see the Live Stream API Java API reference documentation.
To authenticate to Live Stream API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
To learn how to install and use the client library for Live Stream API, see Live Stream API client libraries. For more information, see the Live Stream API Node.js API reference documentation.
To authenticate to Live Stream API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
To learn how to install and use the client library for Live Stream API, see Live Stream API client libraries. For more information, see the Live Stream API PHP API reference documentation.
To authenticate to Live Stream API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
To learn how to install and use the client library for Live Stream API, see Live Stream API client libraries. For more information, see the Live Stream API Python API reference documentation.
To authenticate to Live Stream API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
To learn how to install and use the client library for Live Stream API, see Live Stream API client libraries. For more information, see the Live Stream API Ruby API reference documentation.
To authenticate to Live Stream API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
List assets
To list all of the assets you created in a location, use the
projects.locations.assets.list
method.
Before using any of the request data, make the following replacements:
: your Google Cloud project number; this is located in the Project number field on the IAM Settings pagePROJECT_NUMBER
: the location of your assets; use one of the supported regionsLOCATION Show locationsus-central1
us-east1
us-east4
us-west1
us-west2
northamerica-northeast1
southamerica-east1
asia-east1
asia-east2
asia-south1
asia-northeast1
asia-southeast1
australia-southeast1
europe-north1
europe-west1
europe-west2
europe-west3
europe-west4
To send your request, expand one of these options:
curl (Linux, macOS, or Cloud Shell)
Execute the following command:
curl -X GET \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://livestream.googleapis.com/v1/projects/PROJECT_NUMBER /locations/LOCATION /assets"
PowerShell (Windows)
Execute the following command:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://livestream.googleapis.com/v1/projects/PROJECT_NUMBER /locations/LOCATION /assets" | Select-Object -Expand Content
You should receive a JSON response similar to the following:
{ "assets": [ { "name": "projects/PROJECT_NUMBER /locations/LOCATION /assets/ASSET_ID ", "createTime":CREATE_TIME , "updateTime":UPDATE_TIME , "video": { "uri": "ASSET_URI " }, "crc32c": "pKNslg==", "state": "ACTIVE" }, { "name": "projects/PROJECT_NUMBER /locations/LOCATION /assets/my-other-asset ", "createTime":CREATE_TIME , "updateTime":UPDATE_TIME , "video": { "uri": "my-other-asset-uri " }, "crc32c": "pLNslg==", "state": "ACTIVE" } ] }
To learn how to install and use the client library for Live Stream API, see Live Stream API client libraries. For more information, see the Live Stream API C# API reference documentation.
To authenticate to Live Stream API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
To learn how to install and use the client library for Live Stream API, see Live Stream API client libraries. For more information, see the Live Stream API Go API reference documentation.
To authenticate to Live Stream API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
To learn how to install and use the client library for Live Stream API, see Live Stream API client libraries. For more information, see the Live Stream API Java API reference documentation.
To authenticate to Live Stream API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
To learn how to install and use the client library for Live Stream API, see Live Stream API client libraries. For more information, see the Live Stream API Node.js API reference documentation.
To authenticate to Live Stream API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
To learn how to install and use the client library for Live Stream API, see Live Stream API client libraries. For more information, see the Live Stream API PHP API reference documentation.
To authenticate to Live Stream API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
To learn how to install and use the client library for Live Stream API, see Live Stream API client libraries. For more information, see the Live Stream API Python API reference documentation.
To authenticate to Live Stream API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
To learn how to install and use the client library for Live Stream API, see Live Stream API client libraries. For more information, see the Live Stream API Ruby API reference documentation.
To authenticate to Live Stream API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Delete an asset
To delete an asset, use the
projects.locations.assets.delete
method.
Before using any of the request data, make the following replacements:
: your Google Cloud project number; this is located in the Project number field on the IAM Settings pagePROJECT_NUMBER
: the location of your asset; use one of the supported regionsLOCATION Show locationsus-central1
us-east1
us-east4
us-west1
us-west2
northamerica-northeast1
southamerica-east1
asia-east1
asia-east2
asia-south1
asia-northeast1
asia-southeast1
australia-southeast1
europe-north1
europe-west1
europe-west2
europe-west3
europe-west4
: the user-defined identifier for the assetASSET_ID
To send your request, expand one of these options:
curl (Linux, macOS, or Cloud Shell)
Execute the following command:
curl -X DELETE \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://livestream.googleapis.com/v1/projects/PROJECT_NUMBER /locations/LOCATION /assets/ASSET_ID "
PowerShell (Windows)
Execute the following command:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method DELETE `
-Headers $headers `
-Uri "https://livestream.googleapis.com/v1/projects/PROJECT_NUMBER /locations/LOCATION /assets/ASSET_ID " | Select-Object -Expand Content
You should receive a JSON response similar to the following:
{ "name": "projects/PROJECT_NUMBER /locations/LOCATION /operations/OPERATION_ID ", "metadata": { "@type": "type.googleapis.com/google.cloud.video.livestream.v1.OperationMetadata", "createTime":CREATE_TIME , "target": "projects/PROJECT_NUMBER /locations/LOCATION /assets/ASSET_ID ", "verb": "delete", "requestedCancellation": false, "apiVersion": "v1" }, "done": false }
To learn how to install and use the client library for Live Stream API, see Live Stream API client libraries. For more information, see the Live Stream API C# API reference documentation.
To authenticate to Live Stream API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
To learn how to install and use the client library for Live Stream API, see Live Stream API client libraries. For more information, see the Live Stream API Go API reference documentation.
To authenticate to Live Stream API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
To learn how to install and use the client library for Live Stream API, see Live Stream API client libraries. For more information, see the Live Stream API Java API reference documentation.
To authenticate to Live Stream API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
To learn how to install and use the client library for Live Stream API, see Live Stream API client libraries. For more information, see the Live Stream API Node.js API reference documentation.
To authenticate to Live Stream API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
To learn how to install and use the client library for Live Stream API, see Live Stream API client libraries. For more information, see the Live Stream API PHP API reference documentation.
To authenticate to Live Stream API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
To learn how to install and use the client library for Live Stream API, see Live Stream API client libraries. For more information, see the Live Stream API Python API reference documentation.
To authenticate to Live Stream API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
To learn how to install and use the client library for Live Stream API, see Live Stream API client libraries. For more information, see the Live Stream API Ruby API reference documentation.
To authenticate to Live Stream API, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.