使用 Transcoder API 对视频进行转码
本页面介绍如何使用 Transcoder API 和 curl
、Windows PowerShell 或客户端库的默认设置创建基本视频转码作业。
您还可以使用以下任一编程语言直接在 Google Cloud 控制台中执行本快速入门:
准备工作
- Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
- Install the Google Cloud CLI.
-
To initialize the gcloud CLI, run the following command:
gcloud init
-
Create or select a Google Cloud project.
-
Create a Google Cloud project:
gcloud projects create
PROJECT_ID Replace
PROJECT_ID
with a name for the Google Cloud project you are creating. -
Select the Google Cloud project that you created:
gcloud config set project
PROJECT_ID Replace
PROJECT_ID
with your Google Cloud project name.
-
-
Make sure that billing is enabled for your Google Cloud project.
-
Enable the Transcoder API:
gcloud services enable transcoder.googleapis.com
-
Create local authentication credentials for your user account:
gcloud auth application-default login
-
Grant roles to your user account. Run the following command once for each of the following IAM roles:
roles/transcoder.admin, roles/storage.admin
gcloud projects add-iam-policy-binding
PROJECT_ID --member="user:USER_IDENTIFIER " --role=ROLE - Replace
PROJECT_ID
with your project ID. -
Replace
USER_IDENTIFIER
with the identifier for your user account. For example,user:myemail@example.com
. - Replace
ROLE
with each individual role.
- Replace
创建 Cloud Storage 存储桶
- In the Google Cloud console, go to the Cloud Storage Buckets page.
- Click Create bucket.
- On the Create a bucket page, enter your bucket information. To go to the next
step, click Continue.
- For Name your bucket, enter a unique bucket name. Don't include sensitive information in the bucket name, because the bucket namespace is global and publicly visible.
-
For Choose where to store your data, do the following:
- Select a Location type option.
- Select a Location option.
- For Choose a default storage class for your data, select the following: Standard.
- For Choose how to control access to objects, select an Access control option.
- For Advanced settings (optional), specify an encryption method, a retention policy, or bucket labels.
- Click Create.
- 点击创建文件夹并输入名称,以创建一个用于保存已编码的视频输出的文件夹。
使用 Transcoder API 对视频进行转码
执行以下步骤时,本地机器上必须至少有时长为 5 秒的视频(示例视频)。请参阅支持的输入和输出格式列表。
将视频上传到 Cloud Storage 存储分区
- 在 Google Cloud 控制台中,前往 Cloud Storage 浏览器页面。
转到“Cloud Storage 浏览器”页面 - 点击存储分区的名称将其打开。
- 点击上传文件。
- 选择要从本地机器上传的视频文件。
您的视频现已保存到 Cloud Storage 存储分区。
创建转码作业
默认情况下,Transcoder API 使用 H.264 编码以及 MP4、HLS 和 MPEG-DASH 包装对视频进行转码。对于每个输入视频,它以高清(1280x720 像素)和标清(640x360 像素)提供输出呈现方式。
要创建作业,请使用 projects.locations.jobs.create
方法。 以下代码示例使用预设创建基本转码作业。
在使用任何请求数据之前,请先进行以下替换:
:IAM 设置中列出的 Google Cloud 项目 ID。PROJECT_ID
:运行作业的位置。请使用其中一个受支持的区域。LOCATION 显示位置us-central1
us-west1
us-west2
us-east1
us-east4
southamerica-east1
northamerica-northeast1
asia-east1
asia-northeast1
asia-northeast3
asia-south1
asia-southeast1
australia-southeast1
europe-west1
europe-west2
europe-west4
:您创建的 Cloud Storage 存储分区的名称。STORAGE_BUCKET_NAME
:您要对其进行转码的 Cloud Storage 存储分区中的视频的名称,例如STORAGE_INPUT_VIDEO my-vid.mp4
。此字段应考虑您在存储分区中创建的任何文件夹(例如input/my-vid.mp4
)。
:您要在其中保存已编码视频输出的 Cloud Storage 文件夹名称。STORAGE_OUTPUT_FOLDER
如需发送您的请求,请展开以下选项之一:
curl(Linux、macOS 或 Cloud Shell)
将请求正文保存在名为 request.json
的文件中。在终端中运行以下命令,在当前目录中创建或覆盖此文件:
cat > request.json << 'EOF' { "inputUri": "gs://STORAGE_BUCKET_NAME /STORAGE_INPUT_VIDEO ", "outputUri": "gs://STORAGE_BUCKET_NAME /STORAGE_OUTPUT_FOLDER /", "templateId": "preset/web-hd" } EOF
然后,执行以下命令以发送 REST 请求:
curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://transcoder.googleapis.com/v1/projects/PROJECT_ID /locations/LOCATION /jobs?fields=name"
PowerShell (Windows)
将请求正文保存在名为 request.json
的文件中。在终端中运行以下命令,在当前目录中创建或覆盖此文件:
@' { "inputUri": "gs://STORAGE_BUCKET_NAME /STORAGE_INPUT_VIDEO ", "outputUri": "gs://STORAGE_BUCKET_NAME /STORAGE_OUTPUT_FOLDER /", "templateId": "preset/web-hd" } '@ | Out-File -FilePath request.json -Encoding utf8
然后,执行以下命令以发送 REST 请求:
$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://transcoder.googleapis.com/v1/projects/PROJECT_ID /locations/LOCATION /jobs?fields=name" | Select-Object -Expand Content
此特定 REST 示例使用可选的 fields
查询参数来仅在显示响应中的已创建的资源名称。
{ "name": "projects/PROJECT_NUMBER /locations/LOCATION /jobs/JOB_ID " }
- 对
gcloud
命令进行以下替换: STORAGE_BUCKET_NAME :您创建的 Cloud Storage 存储分区的名称。STORAGE_INPUT_VIDEO :您要对其进行转码的 Cloud Storage 存储分区中的视频的名称,例如my-vid.mp4
。此字段应考虑您在存储分区中创建的任何文件夹(例如input/my-vid.mp4
)。LOCATION :运行作业的位置。请使用其中一个受支持的区域。显示位置us-central1
us-west1
us-west2
us-east1
us-east4
southamerica-east1
northamerica-northeast1
asia-east1
asia-northeast1
asia-northeast3
asia-south1
asia-southeast1
australia-southeast1
europe-west1
europe-west2
europe-west4
STORAGE_OUTPUT_FOLDER :您要在其中保存已编码视频输出的 Cloud Storage 文件夹名称。- 运行以下命令:
您应该会看到如下所示的响应:gcloud transcoder jobs create \ --input-uri="gs://
STORAGE_BUCKET_NAME /STORAGE_INPUT_VIDEO " \ --location=LOCATION \ --output-uri="gs://STORAGE_BUCKET_NAME /STORAGE_OUTPUT_FOLDER /"{ "config": { ... }, "createTime":
CREATE_TIME , "name": "projects/PROJECT_NUMBER /locations/LOCATION /jobs/JOB_ID ", "state": "PENDING", "ttlAfterCompletionDays": 30 }
在试用此示例之前,请按照 Transcoder API 快速入门:使用客户端库中的 C# 设置说明进行操作。 如需了解详情,请参阅 Transcoder API C# API 参考文档。
如需向 Transcoder API 进行身份验证,请设置应用默认凭据。 如需了解详情,请参阅为本地开发环境设置身份验证。
在试用此示例之前,请按照 Transcoder API 快速入门:使用客户端库中的 Go 设置说明进行操作。 如需了解详情,请参阅 Transcoder API Go API 参考文档。
如需向 Transcoder API 进行身份验证,请设置应用默认凭据。 如需了解详情,请参阅为本地开发环境设置身份验证。
在试用此示例之前,请按照 Transcoder API 快速入门:使用客户端库中的 Java 设置说明进行操作。 如需了解详情,请参阅 Transcoder API Java API 参考文档。
如需向 Transcoder API 进行身份验证,请设置应用默认凭据。 如需了解详情,请参阅为本地开发环境设置身份验证。
在试用此示例之前,请按照 Transcoder API 快速入门:使用客户端库中的 Node.js 设置说明进行操作。 如需了解详情,请参阅 Transcoder API Node.js API 参考文档。
如需向 Transcoder API 进行身份验证,请设置应用默认凭据。 如需了解详情,请参阅为本地开发环境设置身份验证。
在试用此示例之前,请按照 Transcoder API 快速入门:使用客户端库中的 PHP 设置说明进行操作。 如需了解详情,请参阅 Transcoder API PHP API 参考文档。
如需向 Transcoder API 进行身份验证,请设置应用默认凭据。 如需了解详情,请参阅为本地开发环境设置身份验证。
在试用此示例之前,请按照 Transcoder API 快速入门:使用客户端库中的 Python 设置说明进行操作。 如需了解详情,请参阅 Transcoder API Python API 参考文档。
如需向 Transcoder API 进行身份验证,请设置应用默认凭据。 如需了解详情,请参阅为本地开发环境设置身份验证。
在试用此示例之前,请按照 Transcoder API 快速入门:使用客户端库中的 Ruby 设置说明进行操作。 如需了解详情,请参阅 Transcoder API Ruby API 参考文档。
如需向 Transcoder API 进行身份验证,请设置应用默认凭据。 如需了解详情,请参阅为本地开发环境设置身份验证。
复制返回的 JOB_ID。您需要该 ID 才能获得作业的状态。
检查转码作业的状态
如需检查作业的状态,请使用 projects.locations.jobs.get
方法。 以下代码显示获取作业详细信息的示例并显示作业状态。
在使用任何请求数据之前,请先进行以下替换:
JOB_ID
:您创建的作业的 ID。PROJECT_ID
:您的 Google Cloud 项目 ID。LOCATION
:您的作业的位置。请使用其中一个受支持的区域。us-central1
us-west1
us-west2
us-east1
us-east4
southamerica-east1
northamerica-northeast1
asia-east1
asia-northeast1
asia-northeast3
asia-south1
asia-southeast1
australia-southeast1
europe-west1
europe-west2
europe-west4
如需发送您的请求,请展开以下选项之一:
curl(Linux、macOS 或 Cloud Shell)
执行以下命令:
curl -X GET \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://transcoder.googleapis.com/v1/projects/PROJECT_ID /locations/LOCATION /jobs/JOB_ID "
PowerShell (Windows)
执行以下命令:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://transcoder.googleapis.com/v1/projects/PROJECT_ID /locations/LOCATION /jobs/JOB_ID " | Select-Object -Expand Content
您应该收到类似以下内容的 JSON 响应:
{ "name": "projects/PROJECT_NUMBER /locations/LOCATION /jobs/JOB_ID ", "config": { "inputs": [ { "key": "input0", "uri": "gs://STORAGE_BUCKET_NAME /STORAGE_INPUT_VIDEO " } ], "editList": [ { "key": "atom0", "inputs": [ "input0" ], "startTimeOffset": "0s" } ], "elementaryStreams": [ { "videoStream": { "h264": { "widthPixels": 640, "heightPixels": 360, "frameRate": 30, "bitrateBps": 550000, "pixelFormat": "yuv420p", "rateControlMode": "vbr", "crfLevel": 21, "gopDuration": "3s", "vbvSizeBits": 550000, "vbvFullnessBits": 495000, "entropyCoder": "cabac", "bFrameCount": 3, "aqStrength": 1, "profile": "high", "preset": "veryfast" } }, "key": "video-stream0" }, { "videoStream": { "h264": { "widthPixels": 1280, "heightPixels": 720, "frameRate": 30, "bitrateBps": 2500000, "pixelFormat": "yuv420p", "rateControlMode": "vbr", "crfLevel": 21, "gopDuration": "3s", "vbvSizeBits": 2500000, "vbvFullnessBits": 2250000, "entropyCoder": "cabac", "bFrameCount": 3, "aqStrength": 1, "profile": "high", "preset": "veryfast" } }, "key": "video-stream1" }, { "audioStream": { "codec": "aac", "bitrateBps": 64000, "channelCount": 2, "channelLayout": [ "fl", "fr" ], "sampleRateHertz": 48000 }, "key": "audio-stream0" } ], "muxStreams": [ { "key": "sd", "fileName": "sd.mp4", "container": "mp4", "elementaryStreams": [ "video-stream0", "audio-stream0" ] }, { "key": "hd", "fileName": "hd.mp4", "container": "mp4", "elementaryStreams": [ "video-stream1", "audio-stream0" ] }, { "key": "media-sd", "fileName": "media-sd.ts", "container": "ts", "elementaryStreams": [ "video-stream0", "audio-stream0" ] }, { "key": "media-hd", "fileName": "media-hd.ts", "container": "ts", "elementaryStreams": [ "video-stream1", "audio-stream0" ] }, { "key": "video-only-sd", "fileName": "video-only-sd.m4s", "container": "fmp4", "elementaryStreams": [ "video-stream0" ] }, { "key": "video-only-hd", "fileName": "video-only-hd.m4s", "container": "fmp4", "elementaryStreams": [ "video-stream1" ] }, { "key": "audio-only", "fileName": "audio-only.m4s", "container": "fmp4", "elementaryStreams": [ "audio-stream0" ] } ], "manifests": [ { "fileName": "manifest.m3u8", "type": "HLS", "muxStreams": [ "media-sd", "media-hd" ] }, { "fileName": "manifest.mpd", "type": "DASH", "muxStreams": [ "video-only-sd", "video-only-hd", "audio-only" ] } ], "output": { "uri": "gs://STORAGE_BUCKET_NAME /STORAGE_OUTPUT_FOLDER /" } }, "state": "PENDING", "createTime":CREATE_TIME , "ttlAfterCompletionDays": 30 }
- 对
gcloud
命令进行以下替换: JOB_ID :您创建的作业的 ID。LOCATION :您的作业的位置。请使用其中一个受支持的区域。显示位置us-central1
us-west1
us-west2
us-east1
us-east4
southamerica-east1
northamerica-northeast1
asia-east1
asia-northeast1
asia-northeast3
asia-south1
asia-southeast1
australia-southeast1
europe-west1
europe-west2
europe-west4
- 运行以下命令:
您应该会看到如下所示的响应:gcloud transcoder jobs describe
JOB_ID --location=LOCATION { "name": "projects/
PROJECT_NUMBER /locations/LOCATION /jobs/JOB_ID ", "config": { "inputs": [ { "key": "input0", "uri": "gs://STORAGE_BUCKET_NAME /STORAGE_INPUT_VIDEO " } ], "editList": [ { "key": "atom0", "inputs": [ "input0" ], "startTimeOffset": "0s" } ], "elementaryStreams": [ { "videoStream": { "h264": { "widthPixels": 640, "heightPixels": 360, "frameRate": 30, "bitrateBps": 550000, "pixelFormat": "yuv420p", "rateControlMode": "vbr", "crfLevel": 21, "gopDuration": "3s", "vbvSizeBits": 550000, "vbvFullnessBits": 495000, "entropyCoder": "cabac", "bFrameCount": 3, "aqStrength": 1, "profile": "high", "preset": "veryfast" } }, "key": "video-stream0" }, { "videoStream": { "h264": { "widthPixels": 1280, "heightPixels": 720, "frameRate": 30, "bitrateBps": 2500000, "pixelFormat": "yuv420p", "rateControlMode": "vbr", "crfLevel": 21, "gopDuration": "3s", "vbvSizeBits": 2500000, "vbvFullnessBits": 2250000, "entropyCoder": "cabac", "bFrameCount": 3, "aqStrength": 1, "profile": "high", "preset": "veryfast" } }, "key": "video-stream1" }, { "audioStream": { "codec": "aac", "bitrateBps": 64000, "channelCount": 2, "channelLayout": [ "fl", "fr" ], "sampleRateHertz": 48000 }, "key": "audio-stream0" } ], "muxStreams": [ { "key": "sd", "fileName": "sd.mp4", "container": "mp4", "elementaryStreams": [ "video-stream0", "audio-stream0" ] }, { "key": "hd", "fileName": "hd.mp4", "container": "mp4", "elementaryStreams": [ "video-stream1", "audio-stream0" ] }, { "key": "media-sd", "fileName": "media-sd.ts", "container": "ts", "elementaryStreams": [ "video-stream0", "audio-stream0" ] }, { "key": "media-hd", "fileName": "media-hd.ts", "container": "ts", "elementaryStreams": [ "video-stream1", "audio-stream0" ] }, { "key": "video-only-sd", "fileName": "video-only-sd.m4s", "container": "fmp4", "elementaryStreams": [ "video-stream0" ] }, { "key": "video-only-hd", "fileName": "video-only-hd.m4s", "container": "fmp4", "elementaryStreams": [ "video-stream1" ] }, { "key": "audio-only", "fileName": "audio-only.m4s", "container": "fmp4", "elementaryStreams": [ "audio-stream0" ] } ], "manifests": [ { "fileName": "manifest.m3u8", "type": "HLS", "muxStreams": [ "media-sd", "media-hd" ] }, { "fileName": "manifest.mpd", "type": "DASH", "muxStreams": [ "video-only-sd", "video-only-hd", "audio-only" ] } ], "output": { "uri": "gs://STORAGE_BUCKET_NAME /STORAGE_OUTPUT_FOLDER /" } }, "state": "PENDING", "createTime":CREATE_TIME , "ttlAfterCompletionDays": 30 }
在试用此示例之前,请按照 Transcoder API 快速入门:使用客户端库中的 C# 设置说明进行操作。 如需了解详情,请参阅 Transcoder API C# API 参考文档。
如需向 Transcoder API 进行身份验证,请设置应用默认凭据。 如需了解详情,请参阅为本地开发环境设置身份验证。
在试用此示例之前,请按照 Transcoder API 快速入门:使用客户端库中的 Go 设置说明进行操作。 如需了解详情,请参阅 Transcoder API Go API 参考文档。
如需向 Transcoder API 进行身份验证,请设置应用默认凭据。 如需了解详情,请参阅为本地开发环境设置身份验证。
在试用此示例之前,请按照 Transcoder API 快速入门:使用客户端库中的 Java 设置说明进行操作。 如需了解详情,请参阅 Transcoder API Java API 参考文档。
如需向 Transcoder API 进行身份验证,请设置应用默认凭据。 如需了解详情,请参阅为本地开发环境设置身份验证。
在试用此示例之前,请按照 Transcoder API 快速入门:使用客户端库中的 Node.js 设置说明进行操作。 如需了解详情,请参阅 Transcoder API Node.js API 参考文档。
如需向 Transcoder API 进行身份验证,请设置应用默认凭据。 如需了解详情,请参阅为本地开发环境设置身份验证。
在试用此示例之前,请按照 Transcoder API 快速入门:使用客户端库中的 PHP 设置说明进行操作。 如需了解详情,请参阅 Transcoder API PHP API 参考文档。
如需向 Transcoder API 进行身份验证,请设置应用默认凭据。 如需了解详情,请参阅为本地开发环境设置身份验证。
在试用此示例之前,请按照 Transcoder API 快速入门:使用客户端库中的 Python 设置说明进行操作。 如需了解详情,请参阅 Transcoder API Python API 参考文档。
如需向 Transcoder API 进行身份验证,请设置应用默认凭据。 如需了解详情,请参阅为本地开发环境设置身份验证。
在试用此示例之前,请按照 Transcoder API 快速入门:使用客户端库中的 Ruby 设置说明进行操作。 如需了解详情,请参阅 Transcoder API Ruby API 参考文档。
如需向 Transcoder API 进行身份验证,请设置应用默认凭据。 如需了解详情,请参阅为本地开发环境设置身份验证。
如果 state
为 SUCCEEDED
,则表示作业已完成,并且您的视频输出现在可在 Cloud Storage 存储分区的已编码文件列表中找到。
播放视频
如需在 Shaka Player 中播放生成的媒体文件,请完成以下步骤:
- 请将 Cloud Storage 存储分区设为可公开读取。
- 如需在 Cloud Storage 存储分区上启用跨域资源共享 (CORS),请执行以下操作:
- 创建一个包含以下代码的 JSON 文件:
[ { "origin": ["https://shaka-player-demo.appspot.com/"], "responseHeader": ["Content-Type", "Range"], "method": ["GET", "HEAD"], "maxAgeSeconds": 3600 } ]
-
将 JSON_FILE_NAME 替换为您在上一步中创建的 JSON 文件的名称,然后运行以下命令:
gcloud storage buckets update gs://
STORAGE_BUCKET_NAME --cors-file=JSON_FILE_NAME .json
- 创建一个包含以下代码的 JSON 文件:
- 在 Cloud Storage 存储分区中,选择一个由转码作业生成的 MP4 文件或清单文件。在该文件的公开访问权限列中,点击复制网址。
- 导航到在线直播播放器 Shaka Player。
- 点击顶部导航栏中的自定义内容。
- 点击 + 按钮。
将文件的公开网址粘贴到清单网址框中。
在名称框中输入一个名称。
点击保存。
点击播放。
清理
为避免因本页中使用的资源导致您的 Google Cloud 账号产生费用,请按照以下步骤操作。
删除存储桶
在 Google Cloud 控制台中,前往 Cloud Storage 浏览器页面。
选中所创建存储分区旁边的复选框。
点击删除。
在显示的弹出式窗口中,点击删除以永久删除存储分区及其内容。
删除作业
在使用任何请求数据之前,请先进行以下替换:
JOB_ID
:您创建的作业的 ID。PROJECT_ID
:您的 Google Cloud 项目 ID。LOCATION
:您的作业的位置。请使用其中一个受支持的区域。us-central1
us-west1
us-west2
us-east1
us-east4
southamerica-east1
northamerica-northeast1
asia-east1
asia-northeast1
asia-northeast3
asia-south1
asia-southeast1
australia-southeast1
europe-west1
europe-west2
europe-west4
如需发送您的请求,请展开以下选项之一:
curl(Linux、macOS 或 Cloud Shell)
执行以下命令:
curl -X DELETE \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://transcoder.googleapis.com/v1/projects/PROJECT_ID /locations/LOCATION /jobs/JOB_ID "
PowerShell (Windows)
执行以下命令:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method DELETE `
-Headers $headers `
-Uri "https://transcoder.googleapis.com/v1/projects/PROJECT_ID /locations/LOCATION /jobs/JOB_ID " | Select-Object -Expand Content
您应该收到类似以下内容的 JSON 响应:
{}
- 对
gcloud
命令进行以下替换: JOB_ID :您创建的作业的 ID。LOCATION :您的作业的位置。请使用其中一个受支持的区域。显示位置us-central1
us-west1
us-west2
us-east1
us-east4
southamerica-east1
northamerica-northeast1
asia-east1
asia-northeast1
asia-northeast3
asia-south1
asia-southeast1
australia-southeast1
europe-west1
europe-west2
europe-west4
- 运行以下命令:
您应该会看到如下所示的响应:gcloud transcoder jobs delete
JOB_ID --location=LOCATION Deleted job [projects/
PROJECT_ID /locations/LOCATION /jobs/JOB_ID ].
在试用此示例之前,请按照 Transcoder API 快速入门:使用客户端库中的 C# 设置说明进行操作。 如需了解详情,请参阅 Transcoder API C# API 参考文档。
如需向 Transcoder API 进行身份验证,请设置应用默认凭据。 如需了解详情,请参阅为本地开发环境设置身份验证。
在试用此示例之前,请按照 Transcoder API 快速入门:使用客户端库中的 Go 设置说明进行操作。 如需了解详情,请参阅 Transcoder API Go API 参考文档。
如需向 Transcoder API 进行身份验证,请设置应用默认凭据。 如需了解详情,请参阅为本地开发环境设置身份验证。
在试用此示例之前,请按照 Transcoder API 快速入门:使用客户端库中的 Java 设置说明进行操作。 如需了解详情,请参阅 Transcoder API Java API 参考文档。
如需向 Transcoder API 进行身份验证,请设置应用默认凭据。 如需了解详情,请参阅为本地开发环境设置身份验证。
在试用此示例之前,请按照 Transcoder API 快速入门:使用客户端库中的 Node.js 设置说明进行操作。 如需了解详情,请参阅 Transcoder API Node.js API 参考文档。
如需向 Transcoder API 进行身份验证,请设置应用默认凭据。 如需了解详情,请参阅为本地开发环境设置身份验证。
在试用此示例之前,请按照 Transcoder API 快速入门:使用客户端库中的 PHP 设置说明进行操作。 如需了解详情,请参阅 Transcoder API PHP API 参考文档。
如需向 Transcoder API 进行身份验证,请设置应用默认凭据。 如需了解详情,请参阅为本地开发环境设置身份验证。
在试用此示例之前,请按照 Transcoder API 快速入门:使用客户端库中的 Python 设置说明进行操作。 如需了解详情,请参阅 Transcoder API Python API 参考文档。
如需向 Transcoder API 进行身份验证,请设置应用默认凭据。 如需了解详情,请参阅为本地开发环境设置身份验证。
在试用此示例之前,请按照 Transcoder API 快速入门:使用客户端库中的 Ruby 设置说明进行操作。 如需了解详情,请参阅 Transcoder API Ruby API 参考文档。
如需向 Transcoder API 进行身份验证,请设置应用默认凭据。 如需了解详情,请参阅为本地开发环境设置身份验证。
撤消您的凭据
-
Optional: Revoke the authentication credentials that you created, and delete the local credential file.
gcloud auth application-default revoke
-
Optional: Revoke credentials from the gcloud CLI.
gcloud auth revoke