クライアント ライブラリを使用して動画にアノテーションを付ける
このクイックスタートでは、Video Intelligence API について説明します。このクイックスタートでは、 Google Cloud プロジェクトと承認を設定してから、Video Intelligence に動画のアノテーションをリクエストします。
始める前に
- 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.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
-
Make sure that billing is enabled for your Google Cloud project.
-
Enable the Cloud Video Intelligence API.
-
Install the Google Cloud CLI.
-
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
-
To initialize the gcloud CLI, run the following command:
gcloud init
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
-
Make sure that billing is enabled for your Google Cloud project.
-
Enable the Cloud Video Intelligence API.
-
Install the Google Cloud CLI.
-
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
-
To initialize the gcloud CLI, run the following command:
gcloud init
クライアント ライブラリをインストールする
Go
go get cloud.google.com/go/videointelligence/apiv1
Java
Node.js
ライブラリをインストールする前に、Node.js 開発のための環境を用意しておいてください。
npm install @google-cloud/video-intelligence
Python
ライブラリをインストールする前に、Python 開発用の環境を用意しておいてください。
pip install --upgrade google-cloud-videointelligence
その他の言語
C#: クライアント ライブラリ ページの C# の設定手順を実行してから、.NET の Video Intelligence のリファレンス ドキュメントをご覧ください。
PHP: クライアント ライブラリ ページの PHP の設定手順を実行してから、PHP の Video Intelligence のリファレンス ドキュメントをご覧ください。
Ruby: クライアント ライブラリ ページの Ruby の設定手順を実行してから、Ruby の Video Intelligence のリファレンス ドキュメントをご覧ください。
認証の設定
-
After installing the Google Cloud CLI, initialize it by running the following command:
gcloud init
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
-
If you're using a local shell, then create local authentication credentials for your user account:
gcloud auth application-default login
You don't need to do this if you're using Cloud Shell.
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.
ログイン画面が表示されます。ログインすると、ADC で使用されるローカル認証情報ファイルに認証情報が保存されます。
ラベル検出
Video Intelligence API を使用して、動画または動画セグメントの情報(ラベル検出など)をリクエストできるようになりました。次のコードを実行して、動画ラベル検出リクエストを実行してみてください。
Go
Java
Node.js
サンプルを実行する前に、Node.js 開発のための環境を用意しておいてください。
Python
サンプルを実行する前に、Python 開発用の環境を用意しておいてください。
その他の言語
C#: クライアント ライブラリ ページの C# の設定手順を実行してから、.NET の Video Intelligence のリファレンス ドキュメントをご覧ください。
PHP: クライアント ライブラリ ページの PHP の設定手順を実行してから、PHP の Video Intelligence のリファレンス ドキュメントをご覧ください。
Ruby: クライアント ライブラリ ページの Ruby の設定手順を実行してから、Ruby の Video Intelligence のリファレンス ドキュメントをご覧ください。
これで完了です。Video Intelligence に最初のリクエストが送信されました。
いかがでしたか
クリーンアップ
このページで使用したリソースについて、 Google Cloud アカウントに課金されないようにするには、次の手順を実施します。
- 不要になったプロジェクトは、 Google Cloud console を使用して削除します。