1
0

More than 1 year has passed since last update.

[備忘録] Azure Video IndexerのインデックスをPythonで取得

Last updated at Posted at 2023-09-03

概要

PythonでAzure Video Indexer動画ファイルをアップロードする方法と、動画の「インデックス」を取得する方法を紹介しています。私の備忘録用なため,少し読みづらいかと思いますが、最後までご覧いただけますと嬉しいです。

GitHub

ソースコードを公開しています。このレポジトリの内容に沿って解説しています。

解説

Azure Video Indexerは従量課金制です。詳しくはこちら

1. Azure PortalでAzure Video Indexerをセットアップします。

2. 以下の画像の赤枠部分に表示されているAccount IDとAccess Tokenを取得します。
image_1.png
image_2.png
3. このリンクにアクセスし、サインイン後、「Try it ▶︎」ボタンをクリックします。クリックにより出現したパネル下部の Ocp-Apim-Subscription-Key を取得します。
image_3.png
4. azure-info-sample.yamlを複製し、azure-info.yamlに名前変更します。

5. azure-info.yamlのaccountId、accessTokenそれぞれに2.で取得したAccount ID、Access Tokenを設定します。また、3.で取得したOcp-Apim-Subscription-KeyをsubscriptionKeyに記述します。

6. 動画ファイルを onedrive にアップロードし、ウェブブラウザで onedrive にアクセスします。画面上部の「・・・」をクリックし、「埋め込み」を選択します。

embedding.png

Azure Video Indexerはmp4, mov, …の動画形式に対応してます。
詳しくはこちら

7. 画面右に埋め込み用コードが出現するので、赤枠で囲まれている部分の埋め込み用リンクを取得します。このリンクの"embed.aspx"という文字列を"download.aspx"に置き換えます。

image_4.png

8. azure-info.yamlのvideoUrlに取得したonedriveのリンクを、videoNameにお好みの動画ファイル名(拡張子は不要)を記述します。

9. upload-video.pyを実行します。Azure への動画アップロードとインデックス作成完了後、get-index.pyを実行して動画のインデックスを取得します。動画のインデックス完了の有無は、Azure AI Video Indexer Portalで確認できます。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0