使用 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.
-
如果您使用的是外部身份提供方 (IdP),则必须先 使用联合身份登录 gcloud CLI。
-
如需初始化 gcloud CLI,请运行以下命令:
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
If an authentication error is returned, and you are using an external identity provider (IdP), confirm that you have signed in to the gcloud CLI with your federated identity.
-
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
-
Install the Google Cloud CLI.
-
如果您使用的是外部身份提供方 (IdP),则必须先 使用联合身份登录 gcloud CLI。
-
如需初始化 gcloud CLI,请运行以下命令:
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
If an authentication error is returned, and you are using an external identity provider (IdP), confirm that you have signed in to the gcloud CLI with your federated identity.
-
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
-
Create a Cloud Storage bucket and configure it as follows:
-
Set the storage class to
S
(标准)。 -
将存储位置设置为以下项:
US
(美国)。 -
将
BUCKET_NAME
替换为 唯一的存储桶名称。请勿在存储桶名称中添加敏感信息,因为存储桶命名空间是全局性的,公开可见。 - 点击创建文件夹并输入名称,以创建一个用于保存已编码的视频输出的文件夹。
gcloud storage buckets create gs://BUCKET_NAME --default-storage-class STANDARD --location US
-
Set the storage class to
- 在 Google Cloud 控制台中,前往 Cloud Storage 浏览器页面。
转到“Cloud Storage 浏览器”页面 - 点击存储分区的名称将其打开。
- 点击上传文件。
- 选择要从本地机器上传的视频文件。
PROJECT_ID
:IAM 设置中列出的 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
me-west1
me-central1
me-central2
STORAGE_BUCKET_NAME
:您创建的 Cloud Storage 存储分区的名称。STORAGE_INPUT_VIDEO
:您要对其进行转码的 Cloud Storage 存储分区中的视频的名称,例如my-vid.mp4
。此字段应考虑您在存储分区中创建的任何文件夹(例如input/my-vid.mp4
)。STORAGE_OUTPUT_FOLDER
:您要在其中保存已编码视频输出的 Cloud Storage 文件夹名称。- 对
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
me-west1
me-central1
me-central2
- 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 }
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
me-west1
me-central1
me-central2
- 对
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
me-west1
me-central1
me-central2
- 运行以下命令:
您应该会看到如下所示的响应: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 }
- 请将 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 控制台中,前往 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
me-west1
me-central1
me-central2
- 对
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
me-west1
me-central1
me-central2
- 运行以下命令:
您应该会看到如下所示的响应:gcloud transcoder jobs delete JOB_ID --location=LOCATION
Deleted job [projects/PROJECT_ID/locations/LOCATION/jobs/JOB_ID].
-
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
创建 Cloud Storage 存储桶
使用 Transcoder API 对视频进行转码
执行以下步骤时,本地机器上必须至少有时长为 5 秒的视频(示例视频)。请参阅支持的输入和输出格式列表。
将视频上传到 Cloud Storage 存储分区
您的视频现已保存到 Cloud Storage 存储分区。
创建转码作业
默认情况下,Transcoder API 使用 H.264 编码以及 MP4、HLS 和 MPEG-DASH 包装对视频进行转码。对于每个输入视频,它以高清(1280x720 像素)和标清(640x360 像素)提供输出呈现方式。
要创建作业,请使用 projects.locations.jobs.create
方法。 以下代码示例使用预设创建基本转码作业。
REST
在使用任何请求数据之前,请先进行以下替换:
如需发送您的请求,请展开以下选项之一:
此特定 REST 示例使用可选的 fields
查询参数来仅在显示响应中的已创建的资源名称。
{ "name": "projects/PROJECT_NUMBER/locations/LOCATION/jobs/JOB_ID" }
gcloud
C#
在试用此示例之前,请按照《Transcoder API 快速入门:使用客户端库》中的 C# 设置说明进行操作。 如需了解详情,请参阅 Transcoder API C# API 参考文档。
如需向 Transcoder API 进行身份验证,请设置应用默认凭据。如需了解详情,请参阅为本地开发环境设置身份验证。
Go
在试用此示例之前,请按照《Transcoder API 快速入门:使用客户端库》中的 Go 设置说明进行操作。 如需了解详情,请参阅 Transcoder API Go API 参考文档。
如需向 Transcoder API 进行身份验证,请设置应用默认凭据。如需了解详情,请参阅为本地开发环境设置身份验证。
Java
在试用此示例之前,请按照《Transcoder API 快速入门:使用客户端库》中的 Java 设置说明进行操作。 如需了解详情,请参阅 Transcoder API Java API 参考文档。
如需向 Transcoder API 进行身份验证,请设置应用默认凭据。如需了解详情,请参阅为本地开发环境设置身份验证。
Node.js
在试用此示例之前,请按照《Transcoder API 快速入门:使用客户端库》中的 Node.js 设置说明进行操作。 如需了解详情,请参阅 Transcoder API Node.js API 参考文档。
如需向 Transcoder API 进行身份验证,请设置应用默认凭据。如需了解详情,请参阅为本地开发环境设置身份验证。
PHP
在试用此示例之前,请按照《Transcoder API 快速入门:使用客户端库》中的 PHP 设置说明进行操作。 如需了解详情,请参阅 Transcoder API PHP API 参考文档。
如需向 Transcoder API 进行身份验证,请设置应用默认凭据。如需了解详情,请参阅为本地开发环境设置身份验证。
Python
在试用此示例之前,请按照《Transcoder API 快速入门:使用客户端库》中的 Python 设置说明进行操作。 如需了解详情,请参阅 Transcoder API Python API 参考文档。
如需向 Transcoder API 进行身份验证,请设置应用默认凭据。如需了解详情,请参阅为本地开发环境设置身份验证。
Ruby
在试用此示例之前,请按照《Transcoder API 快速入门:使用客户端库》中的 Ruby 设置说明进行操作。 如需了解详情,请参阅 Transcoder API Ruby API 参考文档。
如需向 Transcoder API 进行身份验证,请设置应用默认凭据。如需了解详情,请参阅为本地开发环境设置身份验证。
复制返回的 JOB_ID。您需要该 ID 才能获得作业的状态。
检查转码作业的状态
如需检查作业的状态,请使用 projects.locations.jobs.get
方法。 以下代码显示获取作业详细信息的示例并显示作业状态。
REST
在使用任何请求数据之前,请先进行以下替换:
如需发送您的请求,请展开以下选项之一:
您应该收到类似以下内容的 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
C#
在试用此示例之前,请按照《Transcoder API 快速入门:使用客户端库》中的 C# 设置说明进行操作。 如需了解详情,请参阅 Transcoder API C# API 参考文档。
如需向 Transcoder API 进行身份验证,请设置应用默认凭据。如需了解详情,请参阅为本地开发环境设置身份验证。
Go
在试用此示例之前,请按照《Transcoder API 快速入门:使用客户端库》中的 Go 设置说明进行操作。 如需了解详情,请参阅 Transcoder API Go API 参考文档。
如需向 Transcoder API 进行身份验证,请设置应用默认凭据。如需了解详情,请参阅为本地开发环境设置身份验证。
Java
在试用此示例之前,请按照《Transcoder API 快速入门:使用客户端库》中的 Java 设置说明进行操作。 如需了解详情,请参阅 Transcoder API Java API 参考文档。
如需向 Transcoder API 进行身份验证,请设置应用默认凭据。如需了解详情,请参阅为本地开发环境设置身份验证。
Node.js
在试用此示例之前,请按照《Transcoder API 快速入门:使用客户端库》中的 Node.js 设置说明进行操作。 如需了解详情,请参阅 Transcoder API Node.js API 参考文档。
如需向 Transcoder API 进行身份验证,请设置应用默认凭据。如需了解详情,请参阅为本地开发环境设置身份验证。
PHP
在试用此示例之前,请按照《Transcoder API 快速入门:使用客户端库》中的 PHP 设置说明进行操作。 如需了解详情,请参阅 Transcoder API PHP API 参考文档。
如需向 Transcoder API 进行身份验证,请设置应用默认凭据。如需了解详情,请参阅为本地开发环境设置身份验证。
Python
在试用此示例之前,请按照《Transcoder API 快速入门:使用客户端库》中的 Python 设置说明进行操作。 如需了解详情,请参阅 Transcoder API Python API 参考文档。
如需向 Transcoder API 进行身份验证,请设置应用默认凭据。如需了解详情,请参阅为本地开发环境设置身份验证。
Ruby
在试用此示例之前,请按照《Transcoder API 快速入门:使用客户端库》中的 Ruby 设置说明进行操作。 如需了解详情,请参阅 Transcoder API Ruby API 参考文档。
如需向 Transcoder API 进行身份验证,请设置应用默认凭据。如需了解详情,请参阅为本地开发环境设置身份验证。
如果 state
为 SUCCEEDED
,则表示作业已完成,并且您的视频输出现在可在 Cloud Storage 存储分区的已编码文件列表中找到。
播放视频
如需在 Shaka Player 中播放生成的媒体文件,请完成以下步骤:
清理
为避免因本页面中使用的资源导致您的 Google Cloud 账号产生费用,请删除包含这些资源的 Google Cloud 项目。
删除存储桶
删除作业
REST
在使用任何请求数据之前,请先进行以下替换:
如需发送您的请求,请展开以下选项之一:
您应该收到类似以下内容的 JSON 响应:
{}
gcloud
C#
在试用此示例之前,请按照《Transcoder API 快速入门:使用客户端库》中的 C# 设置说明进行操作。 如需了解详情,请参阅 Transcoder API C# API 参考文档。
如需向 Transcoder API 进行身份验证,请设置应用默认凭据。如需了解详情,请参阅为本地开发环境设置身份验证。
Go
在试用此示例之前,请按照《Transcoder API 快速入门:使用客户端库》中的 Go 设置说明进行操作。 如需了解详情,请参阅 Transcoder API Go API 参考文档。
如需向 Transcoder API 进行身份验证,请设置应用默认凭据。如需了解详情,请参阅为本地开发环境设置身份验证。
Java
在试用此示例之前,请按照《Transcoder API 快速入门:使用客户端库》中的 Java 设置说明进行操作。 如需了解详情,请参阅 Transcoder API Java API 参考文档。
如需向 Transcoder API 进行身份验证,请设置应用默认凭据。如需了解详情,请参阅为本地开发环境设置身份验证。
Node.js
在试用此示例之前,请按照《Transcoder API 快速入门:使用客户端库》中的 Node.js 设置说明进行操作。 如需了解详情,请参阅 Transcoder API Node.js API 参考文档。
如需向 Transcoder API 进行身份验证,请设置应用默认凭据。如需了解详情,请参阅为本地开发环境设置身份验证。
PHP
在试用此示例之前,请按照《Transcoder API 快速入门:使用客户端库》中的 PHP 设置说明进行操作。 如需了解详情,请参阅 Transcoder API PHP API 参考文档。
如需向 Transcoder API 进行身份验证,请设置应用默认凭据。如需了解详情,请参阅为本地开发环境设置身份验证。
Python
在试用此示例之前,请按照《Transcoder API 快速入门:使用客户端库》中的 Python 设置说明进行操作。 如需了解详情,请参阅 Transcoder API Python API 参考文档。
如需向 Transcoder API 进行身份验证,请设置应用默认凭据。如需了解详情,请参阅为本地开发环境设置身份验证。
Ruby
在试用此示例之前,请按照《Transcoder API 快速入门:使用客户端库》中的 Ruby 设置说明进行操作。 如需了解详情,请参阅 Transcoder API Ruby API 参考文档。
如需向 Transcoder API 进行身份验证,请设置应用默认凭据。如需了解详情,请参阅为本地开发环境设置身份验证。