Skip to main content

Python bindings for Facebook VPDQ hash

Project description

vpdq Python Binding

This is a Python binding library to the vPDQ (video PDQ) hashing algorithm by Meta.

It is written in Cython.

Development is hosted on GitHub.

Windows is currently not supported by the Cython bindings.

Installation

Install from PyPI

python -m pip install vpdq --upgrade

OR

Install locally (run from root vpdq folder):

python -m pip install -e .

You should now be able to run python -c "import vpdq" without error.

Usage

import vpdq

# A vpdq hash is a list of vpdqFeatures.
#
# Each vpdqFeature has five attributes:
# quality: int
# frame_number: int
# hash: Hash256 (Video frame hashed by PDQ) 
# hex: str (64 digit hex string representation of hash)
# timestamp: double

vpdqFeatures = vpdq.computeHash("my_video.mp4")

for feature in vpdqFeatures:
    print(f"{feature.frame_number},{feature.hex},{feature.quality},{feature.timestamp}")

Sample Output:

0,e271017837246aaccddea259648fb7d62f435c89d9e99b2497763e216c8d055c,100,0
1,c0f11178372c6aaccddea259648fbfd62f434c89c9e99b249772be216c8d055c,98,1
2,c0f10b78372c6aacc5dea25b748fb7d22f434c89c9a9db249772b6216c8d855c,80,2
3,c0f00b7837247aaccddea25b128fb7d22f434c894da9cb349776b621668dc55c,100,3
...

Development

See CONTRIBUTING.md for development instructions.

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

vpdq-0.2.2.tar.gz (239.3 kB view details)

Uploaded Source

File details

Details for the file vpdq-0.2.2.tar.gz.

File metadata

  • Download URL: vpdq-0.2.2.tar.gz
  • Upload date:
  • Size: 239.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for vpdq-0.2.2.tar.gz
Algorithm Hash digest
SHA256 23ae4b6287aedab31f3db674989cbecb7884f9fe3a54636e2d5ffb2f7f53c8d2
MD5 17e929104ce5ec4c5ea4681fff63ec1d
BLAKE2b-256 ed9d096d23ff39120be80c35b5cae5efebd6483f1037189d4a50b995b1b7d8eb

See more details on using hashes here.

Supported by

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