クライアント ライブラリを使用して動画にアノテーションを付ける
このクイックスタートでは、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.
-
Verify that billing is enabled for your Google Cloud project.
-
Enable the Cloud Video Intelligence API.
-
Install the Google Cloud CLI.
-
外部 ID プロバイダ(IdP)を使用している場合は、まずフェデレーション ID を使用して gcloud CLI にログインする必要があります。
-
gcloud CLI を初期化するには、次のコマンドを実行します。
gcloud init
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
-
Verify that billing is enabled for your Google Cloud project.
-
Enable the Cloud Video Intelligence API.
-
Install the Google Cloud CLI.
-
外部 ID プロバイダ(IdP)を使用している場合は、まずフェデレーション ID を使用して gcloud CLI にログインする必要があります。
-
gcloud CLI を初期化するには、次のコマンドを実行します。
gcloud init
-
Google Cloud CLI をインストールします。 インストール後、次のコマンドを実行して Google Cloud CLI を初期化します。
gcloud init
外部 ID プロバイダ(IdP)を使用している場合は、まずフェデレーション ID を使用して gcloud CLI にログインする必要があります。
-
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 で使用されるローカル認証情報ファイルに認証情報が保存されます。
- 不要になったプロジェクトを Google Cloud console で削除します。
クライアント ライブラリをインストールする
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 のリファレンス ドキュメントをご覧ください。
認証を設定する
ラベル検出
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 アカウントに課金されないようにするには、次の手順を実施します。