Skip to main content

Awesome video_ql created by AdityaNG

Project description

VideoQL

codecov CI GitHub License PyPI - Version PyPI - Downloads

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

  1. 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]
  1. Create a query file (query.yaml):
queries:
  - OR:
    - query: "Is the driver present in the forklift?"
      options: ["yes"]
  1. Run the CLI:
video_ql --video path/to/video.mp4 \
         --config config.yaml \
         --query query.yaml \
         --output results/query_results \
         --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.0.0.tar.gz (4.6 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

video_ql-1.0.0-py3-none-any.whl (24.9 kB view details)

Uploaded Python 3

File details

Details for the file video_ql-1.0.0.tar.gz.

File metadata

  • Download URL: video_ql-1.0.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

Hashes for video_ql-1.0.0.tar.gz
Algorithm Hash digest
SHA256 f4a0ce58ca3d96f12484f7581ce963b5917d3a5627b9c47470e3d2da72cdb235
MD5 3d4002edd16a26ac3364d91b13d0e51a
BLAKE2b-256 6e314473ae13eaf64f89be186104573fa83cfa8f43968d4991de7a7248653c9c

See more details on using hashes here.

File details

Details for the file video_ql-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: video_ql-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 24.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for video_ql-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 914be0428f6e1099a4936946d4f5facb38ce41d5b81967baf23004ccc44dfaac
MD5 b94275fe50040a78f8a6ea9d5c1c6a8d
BLAKE2b-256 cb3ff0919c66f4ca0a597440b0e56dad8eb668482aaccdbf88f8f87e0f2e98dc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page