Searching through video data by asking the right questions
Project description
VideoQL
Searching through video data by asking the right questions.
Install it from PyPI
pip install video_ql
Usage
video_ql provides both a Python API and a CLI interface for video analysis and querying.
Python API
from video_ql import VideoQL
from video_ql.models import Query, QueryCondition, OrCondition, QueryConfig
# Define your queries
queries = [
Query(
query="Is the driver present in the forklift?",
options=["yes", "no"]
),
Query(
query="Where is the forklift currently at?",
options=["Truck", "Warehouse", "Charging"]
),
Query(
query="Is the forklift currently carrying cargo?",
options=["yes", "no"]
)
]
# Initialize VideoQL
video_ql = VideoQL(
video_path="path/to/your/video.mp4",
queries=queries,
context="You are viewing the POV from inside a forklift"
)
# Analyze entire video
results = video_ql.analyze_video(display=True)
# Query specific conditions using our Pydantic models
query_config = QueryConfig(
queries=[
QueryCondition(
query="Is the driver present in the forklift?",
options=["yes"]
)
]
)
# Query the video
matching_frames = video_ql.query_video(query_config)
Command Line Interface
- Create a config file (
config.yaml):
queries:
- query: "Is the driver present in the forklift?"
options: ["yes", "no"]
- query: "Where is the forklift currently at?"
options: ["Truck", "Warehouse", "Charging"]
- query: "Is the forklift currently carrying cargo?"
options: ["yes", "no"]
context: "You are viewing the POV from inside a forklift"
fps: 1.0
tile_frames: [3, 3]
frame_stride: 9
max_resolution: [640, 360]
- Create a query file (
query.yaml):
queries:
- OR:
- query: "Is the driver present in the forklift?"
options: ["yes"]
- Run the CLI:
video_ql --video path/to/video.mp4 \
--config config.yaml \
--query query.yaml \
--output results/query_results \
--display
You may also process a single frame using the following
python3 -m video_ql.single_frame \
--image path/to/image.png \
--config config.yaml \
--output results/query_results.json \
--display
Development
Read the CONTRIBUTING.md file.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
video_ql-1.2.0.tar.gz
(4.6 MB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
video_ql-1.2.0-py3-none-any.whl
(28.3 kB
view details)
File details
Details for the file video_ql-1.2.0.tar.gz.
File metadata
- Download URL: video_ql-1.2.0.tar.gz
- Upload date:
- Size: 4.6 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d670540800d5e9b1320d1d5cefaa6f3f97daf52a9a9f6e2c12c49b36766a76ec
|
|
| MD5 |
5d08a55bc83bde3cba053c30ccbd2a57
|
|
| BLAKE2b-256 |
05b16cb85bff0276ca3f6c5a7a417b46d3c1060fe8440acbb75a14a09850f523
|
File details
Details for the file video_ql-1.2.0-py3-none-any.whl.
File metadata
- Download URL: video_ql-1.2.0-py3-none-any.whl
- Upload date:
- Size: 28.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0fb275b30a0f645962bf56edd737c0c4b5d8de6207fdd4b29e242c8c4089c4f7
|
|
| MD5 |
ce40daa5186dfb9c590c8e1e454691d3
|
|
| BLAKE2b-256 |
a2a8e34ef7c1f1ccd29cf21130380687ed24f73bddcb027c3f6e14b87400d792
|