Skip to content

Commit e624404

Browse files
committed
language update & cell outputs
1 parent bc1a6b2 commit e624404

File tree

3 files changed

+107
-92
lines changed

3 files changed

+107
-92
lines changed

examples/content_moderation_part1.ipynb

+25-28
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"cell_type": "markdown",
4040
"metadata": {},
4141
"source": [
42-
"##### 🔧 Installing VideoDB in your environment\n",
42+
"#### 🔧 Installing VideoDB in your environment\n",
4343
"\n",
4444
"VideoDB is available as [python package 📦](https://pypi.org/project/videodb) "
4545
]
@@ -57,7 +57,7 @@
5757
"cell_type": "markdown",
5858
"metadata": {},
5959
"source": [
60-
"##### 🔗 Setting Up a connection to db\n",
60+
"#### 🔗 Setting Up a connection to db\n",
6161
"To connect to VideoDB, simply create a `Connection` object. \n",
6262
"\n",
6363
"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",
@@ -68,12 +68,12 @@
6868
},
6969
{
7070
"cell_type": "code",
71-
"execution_count": 4,
71+
"execution_count": 3,
7272
"metadata": {},
7373
"outputs": [],
7474
"source": [
75-
"from videodb import connect, play_stream\n",
76-
"conn = connect(api_key=\"\")"
75+
"import videodb\n",
76+
"conn = videodb.connect(api_key=\"YOUR_API_KEY\")"
7777
]
7878
},
7979
{
@@ -82,14 +82,14 @@
8282
"source": [
8383
"<div style=\"height:40px;\"></div>\n",
8484
"\n",
85-
"### Video analysis data\n",
85+
"### Idenfied Sections\n",
8686
"---\n",
87-
"We have analyzed the content of video and extracted out timestamps which appears to be safe."
87+
"Here’s the list of safe timestamps of the 10-minute video from the TV show \"The Breaking Bad\". check out our 👉 [blog](https://docs.videodb.io/ensure-a-safe-and-family-friendly-viewing-experience-with-videod-6) where we walk through the entire process of using AWS Rekognition API, you can also look for other solutions. "
8888
]
8989
},
9090
{
9191
"cell_type": "code",
92-
"execution_count": 5,
92+
"execution_count": 4,
9393
"metadata": {},
9494
"outputs": [],
9595
"source": [
@@ -100,30 +100,23 @@
100100
"cell_type": "markdown",
101101
"metadata": {},
102102
"source": [
103-
"### Removing unsafe visual sections using VideoDB\n",
103+
"<div style=\"height:40px;\"></div>\n",
104104
"\n",
105-
"For this step, we will upload our video to VideoDB first and then create clips of each safe shots and then merge them to get a final video which has all unsafe content removed \n",
105+
"### Removing unsafe visual sections using VideoDB\n",
106+
"---\n",
106107
"\n",
107-
"if you pass timeline of your clip in `Video.get_stream()` , you will get a streaming link of a your clip as a response ( in less than 3s 😉)"
108+
"* First, We will upload our video to VideoDB \n",
109+
"* Then create a clip which contains only Safe Shots from the video by passing timeline in `Video.generate_stream()` \n",
110+
"* you can use `play_stream()` to play the video"
108111
]
109112
},
110113
{
111114
"cell_type": "code",
112-
"execution_count": 7,
115+
"execution_count": 5,
113116
"metadata": {},
114-
"outputs": [
115-
{
116-
"data": {
117-
"text/plain": [
118-
"'https://d27qzqw9ehjjni.cloudfront.net/v3/published/manifests/ad598505-3b80-40fb-a87f-815436a6606c.m3u8'"
119-
]
120-
},
121-
"execution_count": 7,
122-
"metadata": {},
123-
"output_type": "execute_result"
124-
}
125-
],
117+
"outputs": [],
126118
"source": [
119+
"\n",
127120
"video_url_yt = \"https://www.youtube.com/watch?v=Xa7UaHgOGfM\"\n",
128121
"video = conn.upload(url=video_url_yt)\n",
129122
"stream_link = video.generate_stream(timeline=safe_shots) "
@@ -133,28 +126,32 @@
133126
"cell_type": "markdown",
134127
"metadata": {},
135128
"source": [
129+
"<div style=\"height:40px;\"></div>\n",
130+
"\n",
136131
"### View the Results in VideoDB Player\n",
132+
"---\n",
137133
"\n",
138-
"`Video.generate_stream()` returns a stream link that is viewable by `play_stream()`. "
134+
"`stream_link` is viewable by `play_stream()`. "
139135
]
140136
},
141137
{
142138
"cell_type": "code",
143-
"execution_count": 8,
139+
"execution_count": 6,
144140
"metadata": {},
145141
"outputs": [
146142
{
147143
"data": {
148144
"text/plain": [
149-
"'https://console.videodb.io/player?url=https://d27qzqw9ehjjni.cloudfront.net/v3/published/manifests/475ee948-f596-40da-84dd-ab3a900b2b8c.m3u8'"
145+
"'https://console.videodb.io/player?url=https://d27qzqw9ehjjni.cloudfront.net/v3/published/manifests/03bd5758-d31f-45ec-9065-1c512484897a.m3u8'"
150146
]
151147
},
152-
"execution_count": 8,
148+
"execution_count": 6,
153149
"metadata": {},
154150
"output_type": "execute_result"
155151
}
156152
],
157153
"source": [
154+
"from videodb import play_stream\n",
158155
"play_stream(stream_link)"
159156
]
160157
}

examples/creating_clips_part1.ipynb

+33-26
Original file line numberDiff line numberDiff line change
@@ -4,40 +4,45 @@
44
"cell_type": "markdown",
55
"metadata": {},
66
"source": [
7-
"## Overview\n",
7+
"### Overview\n",
88
"\n",
99
"<a href=\"https://colab.research.google.com/github/video-db/videodb-cookbook/blob/main/examples/creating_clips_part1.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>\n",
1010
"\n",
11-
"In this tutorial, we are going to use VideoDB to create clips of a your favorite character. No need for fancy editing software or waiting around – you get to see your video right away. ⚡️\n",
11+
"We all have our favorite characters in TV shows the we love. What if you can create the clips of the scenes when they appear. You can use it in your content creation, analysis workflow or just watch how they talk, dress or act in an episode. \n",
1212
"\n",
13-
"Want to know more about VideoDB? Read on [here](https://videodb.io)."
13+
"[VideoDB](https://videodb.io) is the database for your AI applicaitons and enables it with ease. No need for fancy editing software or waiting around – you get to see your video right away. ⚡️\n",
14+
"\n",
15+
"In this tutorial, we are going to use VideoDB to create clips of a your favorite character. ️"
1416
]
1517
},
1618
{
1719
"cell_type": "markdown",
1820
"metadata": {},
1921
"source": [
20-
"## Workflow\n",
22+
"<div style=\"height:40px;\"></div>\n",
23+
"\n",
24+
"### Workflow\n",
2125
"--- \n",
2226
"\n",
27+
"Here’s a 15-minute video from HBO's Silicon Valley show. We've done the pre work of finding, instances when Gilfoyle, Jian Yang, Erlich, Jared, Dinesh and Richard make appearances. (This was achieved using AWS Rekognition API. If you're curious about the full process, including how to index faces and pinpoint timestamps in videos, check out our blog where we walk through the entire process.)\n",
28+
"\n",
2329
"For our demonstration, \n",
2430
"\n",
25-
"1. We've selected a 15-minute clip from HBO's \"Silicon Valley\" show. You can view the clip here: [Silicon Valley Clip on YouTube](https://www.youtube.com/watch?v=NNAgJ5p4CIY)\n",
26-
"2. We've done some analysis on this video and identified specific times when certain characters appear. This was achieved using AWS Rekognition API. If you're curious about the full process, including how to index faces and pinpoint timestamps in videos, check out our [blog](https://docs.videodb.io/unlock-the-power-of-video-analysis-with-videodb-discover-signifi-4) where we walk through the entire process.\n",
31+
"1. Here's a [15-minute video](https://www.youtube.com/watch?v=NNAgJ5p4CIY) from HBO's \"Silicon Valley\" show\n",
32+
"2. We've done the pre work of finding, instances when `Gilfoyle`, `Jian Yang`, `Erlich`, `Jared`, `Dinesh` and `Richard` make appearances (*This was achieved using AWS Rekognition API. If you're curious about the full process, including how to index faces and pinpoint timestamps in videos, check out our blog where we walk through the entire process*).\n",
2733
"3. In this blog post, however, we're going to skip the details of video analysis and jump straight to the timestamps.\n",
28-
"4. We've analyzed the appearances of characters from clip and mapped out where they appear in `persons_data` \n",
29-
"\n",
30-
"Next, we'll upload the video to VideoDb and use these timestamps to clip the video. It's as easy as querying a database⚡️!"
34+
"4. Next, we'll upload the video to VideoDb and use these timestamps to clip the video. It's as easy as querying a database⚡️!"
3135
]
3236
},
3337
{
3438
"cell_type": "markdown",
3539
"metadata": {},
3640
"source": [
41+
"<div style=\"height:40px;\"></div>\n",
3742
"\n",
38-
"## Setup\n",
43+
"### Setup\n",
3944
"---\n",
40-
"### 🔧 Installing VideoDB in your environment\n",
45+
"#### 🔧 Installing VideoDB in your environment\n",
4146
"\n",
4247
"VideoDB is available as [python package 📦](https://pypi.org/project/videodb/)"
4348
]
@@ -55,13 +60,14 @@
5560
"cell_type": "markdown",
5661
"metadata": {},
5762
"source": [
58-
"### 🔗 Setting Up a connection to db\n",
63+
"#### 🔗 Setting Up a connection to db\n",
5964
"\n",
6065
"To connect to `VideoDB`, simply create a `Connection` object.\n",
6166
"\n",
6267
"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",
6368
"\n",
64-
"> 💡 Your API key is available in the [VideoDB dashboard](https://console.videodb.io)"
69+
">💡\n",
70+
">Get your API key from [VideoDB Console](https://console.videodb.io). ( Free for first 50 uploads, No credit card required ) 🎉."
6571
]
6672
},
6773
{
@@ -70,15 +76,17 @@
7076
"metadata": {},
7177
"outputs": [],
7278
"source": [
73-
"from videodb import connect, play_stream\n",
74-
"conn = connect(api_key=\"\")"
79+
"import videodb\n",
80+
"conn = videodb.connect(api_key=\"YOUR_API_KEY\")"
7581
]
7682
},
7783
{
7884
"cell_type": "markdown",
7985
"metadata": {},
8086
"source": [
81-
"## 🔍 Video Analysis data\n",
87+
"<div style=\"height:40px;\"></div>\n",
88+
"\n",
89+
"### 🔍 Video Analysis data\n",
8290
"---\n",
8391
"\n",
8492
"The `persons_data` contains timeline for each character, representing the timestamps of shots when they were present in the video."
@@ -122,22 +130,19 @@
122130
"cell_type": "markdown",
123131
"metadata": {},
124132
"source": [
125-
"## 🎬️ Clips \n",
126-
"---\n",
127133
"\n",
134+
"<div style=\"height:40px;\"></div>\n",
128135
"\n",
129-
"### Generate Clip for each character using VideoDB\n",
136+
"### 🎬️ Clips \n",
137+
"---\n",
130138
"\n",
131-
">The idea behind videodb is straightforward: it functions as a database specifically for videos. \n",
132-
">Similar to how you upload tables or JSON data to a standard database, you can upload your videos to videodb. \n",
133-
">You can also retrieve your videos through queries, swiftly create clips, much like accessing regular data from a database. \n",
134139
"\n",
135-
"For this step,\n",
140+
"#### Generate Clip for each character using VideoDB\n",
136141
"\n",
137-
"* We will upload our video to VideoDB using `Connection.upload()`\n",
138-
"* Create clips of each character from our analyzed data by passing `timeline` in `Video.generate_stream()`\n",
142+
"For this step,\n",
139143
"\n",
140-
"if you pass timeline of your clip in `Video.generate_stream()` , you will get a streaming link of a your clip as a response ( in less than 3s)"
144+
"* We will upload our video to VideoDB using `conn.upload()`\n",
145+
"* Create clips of each character from our analyzed data by passing `timeline` in `video.generate_stream()`"
141146
]
142147
},
143148
{
@@ -212,6 +217,8 @@
212217
}
213218
],
214219
"source": [
220+
"from videodb import play_stream\n",
221+
"\n",
215222
"person_2_video = persons_data[2][\"stream_link\"]\n",
216223
"play_stream(person_2_video)"
217224
]

0 commit comments

Comments
 (0)