You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
VideoDB Python SDK allows you to interact with the VideoDB serverless database. Manage videos as intelligent data, not files. It's scalable, cost efficient & optimized for AI applications and LLM integration.
38
+
39
+
VideoDB Python SDK allows you to interact with the VideoDB serverless database. Manage videos as intelligent data, not files. It's scalable, cost-efficient & optimized for AI applications and LLM integration.
39
40
40
41
<!-- Documentation -->
41
42
<!-- ## Documentation
42
43
The documentation for the package can be found [here](https://videodb.io/) -->
43
44
44
45
<!-- Installation -->
46
+
45
47
## Installation
48
+
46
49
To install the package, run the following command in your terminal:
50
+
47
51
```
48
52
pip install videodb
49
53
```
50
54
51
-
52
55
<!-- USAGE EXAMPLES -->
56
+
53
57
## Quick Start
58
+
54
59
### Creating a Connection
55
-
Get API key from [VideoDB console](https://console.videodb.io). Free for first 50 uploads. _(No credit card required)_
60
+
61
+
Get an API key from the [VideoDB console](https://console.videodb.io). Free for first 50 uploads _(No credit card required)_.
56
62
57
63
```python
58
64
import videodb
59
65
conn = videodb.connect(api_key="YOUR_API_KEY")
60
66
```
61
-
## Working with a single Video
67
+
68
+
## Working with a Single Video
62
69
63
70
---
64
71
65
-
⬆️ **Uploading a Video**
72
+
### ⬆️ Uploading a Video
66
73
67
-
Now that you have established a connection to VideoDB, you can upload your videos using `conn.upload()`
68
-
You can directly upload from `youtube`, `any public url`, `S3 bucket` or `local file path`. A default collection is created when you create a new connection.
74
+
Now that you have established a connection to VideoDB, you can upload your videos using `conn.upload()`.
75
+
You can directly upload from `youtube`, `any public url`, `S3 bucket` or a `local file path`. A default collection is created when you create your first connection.
To search bits inside a video, you have to `index` the video first. This can be done by a simple command.
113
+
_P.S. Indexing may take some time for longer videos._
104
114
105
-
To search bits inside a video — you have to index the video first. This can be done by a simple command.
106
-
_Indexing may take some time for longer videos._
107
115
```python
108
116
video.index_spoken_words()
109
117
result = video.search("Morning Sunlight")
110
118
result.play()
111
119
video.get_transcript()
112
120
```
113
-
`Videodb` is launching more indexes in upcoming versions.
114
-
Currently it offers semantic index - Index by spoken words.
115
121
116
-
In future you can also index videos using:
117
-
1.**Scene** - Visual concepts and events.
122
+
`Videodb` is launching more indexing options in upcoming versions. As of now you can try the `semantic` index - Index by spoken words.
123
+
124
+
In the future you'll be able to index videos using:
125
+
126
+
1.**Scene** - Visual concepts and events.
118
127
2.**Faces**.
119
-
3.**Specific domain Index** like Football, Baseball, Drone footage, Cricket etc.
128
+
3.**Specific domain Index** like Football, Baseball, Drone footage, Cricket etc.
120
129
121
-
### Viewing Search Results :
130
+
### Viewing Search Results
122
131
123
-
`video.search()`will return a `SearchResults` object, which contains the sections/shots of videos which semantically match your search query
132
+
`video.search()`returns a `SearchResults` object, which contains the sections or as we call them, `shots` of videos which semantically match your search query.
124
133
125
-
*`result.get_shots()`Returns a list of Shot that matched search query
126
-
*`result.play()`Returns a playable url for video (similar to video.play()you can open this link in browser, or embed it into your website using iframe)
134
+
-`result.get_shots()` Returns a list of Shot(s) that matched the search query.
135
+
-`result.play()` Returns a playable url for the video (similar to video.play(); you can open this link in the browser, or embed it into your website using an iframe).
127
136
128
137
## RAG: Search inside Multiple Videos
129
138
130
139
---
131
140
132
-
`VideoDB` can store and search inside multiple videos with ease. By default, videos are uploaded to your default collection.
141
+
`VideoDB` can store and search inside multiple videos with ease. By default, videos are uploaded to your default collection.
*`conn.get_collection()` : Returns Collection object, the default collection
146
-
*`coll.get_videos()` : Returns list of Video, all videos in collections
147
-
*`coll.get_video(video_id)`: Returns Video, respective video object from given `video_id`
148
-
*`coll.delete_video(video_id)`: Deletes the video from Collection
149
154
150
-
### 📂 Search inside collection
155
+
-`conn.get_collection()` : Returns a Collection object; the default collection.
156
+
-`coll.get_videos()` : Returns a list of Video objects; all videos in the collections.
157
+
-`coll.get_video(video_id)`: Returns a Video object, corresponding video from the provided `video_id`.
158
+
-`coll.delete_video(video_id)`: Deletes the video from the Collection.
159
+
160
+
### 📂 Search Inside Collection
161
+
162
+
You can simply Index all the videos in a collection and use the search method to find relevant results.
163
+
Here we are indexing the spoken content of a collection and performing semantic search.
151
164
152
-
You can simply Index all the videos in a collection and use
153
-
search method on collection to find relevant results.
154
-
Here we are indexing spoken content of a
155
-
collection and performing semantic search.
156
165
```python
157
166
# Index all videos in collection
158
167
for video in coll.get_videos():
@@ -162,49 +171,57 @@ for video in coll.get_videos():
162
171
results = coll.search(query="What is Dopamine?")
163
172
results.play()
164
173
```
165
-
The result here has all the matching bits in a single stream from your collection. You can use these results in your application right away.
174
+
175
+
The result here has all the matching bits in a single stream from your collection. You can use these results in your application right away.
166
176
167
177
### 🌟 Explore the Video object
168
178
169
179
There are multiple methods available on a Video Object, that can be helpful for your use-case.
170
180
171
-
**Access Transcript**
181
+
**Get the Transcript**
182
+
172
183
```python
173
184
# words with timestamps
174
185
text_json = video.get_transcript()
175
186
text = video.get_transcript_text()
176
187
print(text)
177
188
```
178
189
179
-
**Add Subtitle to a video**
190
+
**Add Subtitles to a video**
191
+
192
+
It returns a new stream instantly with subtitles added to the video.
180
193
181
-
It returns a new stream instantly with subtitle added into the video.
182
194
```python
183
195
new_stream = video.add_subtitle()
184
196
play_stream(new_stream)
185
197
```
186
-
**Get Thumbnail of Video:**
198
+
199
+
**Get Thumbnail of a Video:**
187
200
188
201
`video.generate_thumbnail()`: Returns a thumbnail image of video.
189
202
190
203
**Delete a video:**
191
204
192
-
`video.delete()`: Delete a video.
205
+
`video.delete()`: Deletes the video.
193
206
194
-
Checkout more examples and tutorials 👉 [Build with VideoDB](https://docs.videodb.io/build-with-videodb-35) to explore what you can
195
-
build with `VideoDB`
207
+
Checkout more examples and tutorials 👉 [Build with VideoDB](https://docs.videodb.io/build-with-videodb-35) to explore what you can build with `VideoDB`.
196
208
197
209
---
210
+
198
211
<!-- ROADMAP -->
212
+
199
213
## Roadmap
214
+
200
215
- Adding More Indexes : `Face`, `Scene`, `Security`, `Events`, and `Sports`
201
216
- Give prompt support to generate thumbnails using GenAI.
202
217
- Give prompt support to access content.
203
-
- Give prompt support to edit videos.
218
+
- Give prompt support to edit videos.
204
219
- See the [open issues](https://github.com/video-db/videodb-python/issues) for a list of proposed features (and known issues).
205
220
206
221
---
222
+
207
223
<!-- CONTRIBUTING -->
224
+
208
225
## Contributing
209
226
210
227
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are **greatly appreciated**.
@@ -219,9 +236,10 @@ Contributions are what make the open source community such an amazing place to b
0 commit comments