|
5 | 5 | "metadata": {},
|
6 | 6 | "source": [
|
7 | 7 | "## Overview\n",
|
| 8 | + "---\n", |
8 | 9 | "\n",
|
9 | 10 | "<a href=\"https://colab.research.google.com/github/video-db/videodb-cookbook/blob/main/examples/aws_rekognition/content_moderation.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>\n",
|
10 | 11 | "\n",
|
|
22 | 23 | "cell_type": "markdown",
|
23 | 24 | "metadata": {},
|
24 | 25 | "source": [
|
25 |
| - "## Setup" |
| 26 | + "## Setup\n", |
| 27 | + "---" |
26 | 28 | ]
|
27 | 29 | },
|
28 | 30 | {
|
|
83 | 85 | "cell_type": "markdown",
|
84 | 86 | "metadata": {},
|
85 | 87 | "source": [
|
86 |
| - "## Configuartion\n", |
| 88 | + "## ⚙️ Configuartion\n", |
87 | 89 | "We must set up AWS and the VideoDB api keys."
|
88 | 90 | ]
|
89 | 91 | },
|
90 | 92 | {
|
91 | 93 | "cell_type": "markdown",
|
92 | 94 | "metadata": {},
|
93 | 95 | "source": [
|
94 |
| - "### VideoDB Configuration\n", |
| 96 | + "### 🔗 Setting Up a connection to db\n", |
95 | 97 | "\n",
|
96 |
| - "We need to setup VideoDB connection, so that we can store our video in VideoDB and then later on clip (*clipping is as simple as a db query with videodb* 😉🤌)\n", |
| 98 | + "To connect to `VideoDB`, simply create a `Connection` object.\n", |
97 | 99 | "\n",
|
98 |
| - "we need `api_key` to setup a connection (if you haven't already, grab yours from [console.videodb.io](https://console.videodb.io))\n", |
| 100 | + "This can be done by either providing your VideoDB API key directly to the constructor or by setting the `VIDEO_DB_API_KEY` environment variable with your API key.\n", |
99 | 101 | "\n",
|
100 |
| - "\n" |
| 102 | + "> 💡 Your API key is available in the [VideoDB dashboard](https://console.videodb.io)" |
101 | 103 | ]
|
102 | 104 | },
|
103 | 105 | {
|
104 | 106 | "cell_type": "code",
|
105 |
| - "execution_count": 19, |
| 107 | + "execution_count": 1, |
106 | 108 | "metadata": {},
|
107 | 109 | "outputs": [],
|
108 | 110 | "source": [
|
109 |
| - "import videodb \n", |
110 |
| - "\n", |
111 |
| - "VIDEO_DB_API_KEY = os.environ.get(\"VIDEODB_API_KEY\", \"\")\n", |
112 |
| - "base_url = \"https://api.videodb.io\"\n", |
113 |
| - "\n", |
114 |
| - "#Setup up a connection to database\n", |
115 |
| - "videodb_conn = videodb.connect(base_url=base_url, api_key=VIDEO_DB_API_KEY)" |
| 111 | + "from videodb import connect, play_stream\n", |
| 112 | + "conn = connect(api_key=\"\")" |
116 | 113 | ]
|
117 | 114 | },
|
118 | 115 | {
|
|
135 | 132 | "source": [
|
136 | 133 | "import boto3\n",
|
137 | 134 | "\n",
|
138 |
| - "aws_access_key_id= os.environ.get('AWS_KEY_ID', \"\")\n", |
139 |
| - "aws_secret_access_key = os.environ.get(\"AWS_KEY_SECRET\", \"\")\n", |
140 |
| - "region_name = os.environ.get(\"AWS_REIGON\", \"\")\n", |
| 135 | + "aws_access_key_id= \"YOUR_AWS_KEY_ID\"\n", |
| 136 | + "aws_secret_access_key = \"YOUR_AWS_SECRET_KEY\" \n", |
| 137 | + "region_name = \"YOUR_AWS_REIGON\"\n", |
141 | 138 | "\n",
|
142 | 139 | "bucket_name = \"videorekog\"\n",
|
143 | 140 | "\n",
|
|
352 | 349 | }
|
353 | 350 | ],
|
354 | 351 | "source": [
|
355 |
| - "vid = videodb_conn.upload(url=video_url_yt)\n", |
356 |
| - "vid.generate_stream(timeline=shots)\n", |
357 |
| - "player_url = vid.play()\n", |
358 |
| - "print(player_url)" |
359 |
| - ] |
360 |
| - }, |
361 |
| - { |
362 |
| - "cell_type": "markdown", |
363 |
| - "metadata": {}, |
364 |
| - "source": [ |
365 |
| - "### Embedding the player in IFrame\n", |
366 |
| - "You have the option to incorporate the player within an IFrame by utilizing the following code:" |
367 |
| - ] |
368 |
| - }, |
369 |
| - { |
370 |
| - "cell_type": "code", |
371 |
| - "execution_count": 23, |
372 |
| - "metadata": {}, |
373 |
| - "outputs": [ |
374 |
| - { |
375 |
| - "data": { |
376 |
| - "text/html": [ |
377 |
| - "\n", |
378 |
| - " <iframe\n", |
379 |
| - " width=\"800\"\n", |
380 |
| - " height=\"400\"\n", |
381 |
| - " src=\"https://console.dev.videodb.io/player?url=https://dseetlpshk2tb.cloudfront.net/v3/published/manifests/9ec3d1e9-499f-488a-b8b2-f2880f35d1a6.m3u8\"\n", |
382 |
| - " frameborder=\"0\"\n", |
383 |
| - " allowfullscreen\n", |
384 |
| - " \n", |
385 |
| - " ></iframe>\n", |
386 |
| - " " |
387 |
| - ], |
388 |
| - "text/plain": [ |
389 |
| - "<IPython.lib.display.IFrame at 0x7fb99891b820>" |
390 |
| - ] |
391 |
| - }, |
392 |
| - "execution_count": 23, |
393 |
| - "metadata": {}, |
394 |
| - "output_type": "execute_result" |
395 |
| - } |
396 |
| - ], |
397 |
| - "source": [ |
398 |
| - "from IPython.display import IFrame \n", |
399 |
| - "\n", |
400 |
| - "player_width = 800\n", |
401 |
| - "player_height = 400\n", |
402 |
| - "\n", |
403 |
| - "IFrame(player_url, player_width, player_height)" |
| 352 | + "video = conn.upload(url=video_url_yt)\n", |
| 353 | + "stream_link = video.generate_stream(timeline=shots)\n", |
| 354 | + "play_stream(stream_link)" |
404 | 355 | ]
|
405 | 356 | }
|
406 | 357 | ],
|
|
0 commit comments