Skip to main content

videohash is a video fingerprinting / video hashing tool written in Python

Project description

VideoHash

A simple Video Hashing Library

Build Status Build Status Build Status codecov pypi Downloads GitHub lastest commit PyPI - Python Version


Installation

You must have ffmpeg installed to use this library.

➤ Install FFmpeg

Linux
  • APT
sudo apt-get update
sudo apt install ffmpeg
  • Snap
sudo snap install ffmpeg
Windows

Steps are based on video.stackexchange.com/a/20496, please note that the download site is outdated as of January 2021.

  • Download the release full variant from https://www.gyan.dev/ffmpeg/builds/. You can download any variant you want, but I prefer the full release.
  • Decompress the archive.
  • Copy the bin directory from the decompressed folder, and paste inside C:\Program Files\ffmpeg\.
  • Right click on "This PC" and navigate to Properties > Advanced System Settings > Advanced tab > Environment Variables.
  • In the Environment Variables window, click the "Path" row under the "Variable" column, then click Edit.
  • Click New and add C:\Program Files\ffmpeg\bin\to the list.
  • Click Ok on all the windows we just opened up. (Answer postive)

If you still have doubts read the answer https://video.stackexchange.com/a/20496, it has images to guide you.

Prefer video? https://www.youtube.com/watch?v=qjtmgCb8NcE.

macOS
brew install ffmpeg

Install videohash

pip install videohash
  • Install directly from GitHub:
pip install git+https://github.com/akamhy/videohash.git

Usage

>>> import videohash
>>> hash1 = videohash.from_url("https://raw.githubusercontent.com/akamhy/videohash/main/assets/rocket.mkv")
>>> str(hash1)
'fe3fffff8ff80000'
>>> hash2 = videohash.from_url("https://www.youtube.com/watch?v=PapBjpzRhnA")
>>> str(hash2)
'fe3fffff9ff80000'
>>>
>>> diff = hash1 - hash2
>>> diff
1
>>>
>>> hash3 = videohash.from_url("https://www.youtube.com/watch?v=_T8cn2J13-4")
>>> diff = hash1 - hash3
>>> diff
29
>>> str(hash3)
'3cffff00000081f0'
>>>
>>> #hash4 file is hash1 file downloaded locally. NOTE :  Use absolute path
>>> hash4 = videohash.from_path("/home/akamhy/Downloads/rocket.mkv")
>>> diff = hash4 - hash1
>>> diff
0
>>>

Run the above code @ https://repl.it/@akamhy/video-hash-example#main.py


You can change the algorithm used to generate the hash of the collage via the image_hash argument. The default algorithm is average_hash.

>>> hash = videohash.from_url("https://www.youtube.com/watch?v=PapBjpzRhnA", image_hash="crop_resistant_hash")
>>> hash = videohash.from_path("/home/akamhy/Downloads/rocket.mkv", image_hash="phash")
➤ Algorithms supported

  • average_hash
  • phash
  • dhash
  • whash
  • colorhash
  • crop_resistant_hash

videohash is using https://github.com/JohannesBuchner/imagehash to use these image-hashing algorithms.

License

License: MIT

NASA videos are in the public domain. NASA copyright policy states that "NASA material is not protected by copyright unless noted".

Released under the MIT License. See license for details.


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

videohash-1.0.7.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

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

videohash-1.0.7-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file videohash-1.0.7.tar.gz.

File metadata

  • Download URL: videohash-1.0.7.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6

File hashes

Hashes for videohash-1.0.7.tar.gz
Algorithm Hash digest
SHA256 3ec82cc6472ece8fa2a6a5930069235f0dec30114a009ccfaf4b93d8798c30a4
MD5 a8882065acd8df756ab3233069966a08
BLAKE2b-256 3ec8e85af4f61b3636c1dbff9ceec29e03be782f827d17a1b8bfed1c9bfb9f83

See more details on using hashes here.

File details

Details for the file videohash-1.0.7-py3-none-any.whl.

File metadata

  • Download URL: videohash-1.0.7-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6

File hashes

Hashes for videohash-1.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 9c8e3af14ed98cc77d1dd06e700d2b9b62ce90ea4644630950e9cb58e3b3b9a2
MD5 15a5cf83c21a7910ca04707c4bb34412
BLAKE2b-256 0b09a9cc3c52426a497524fa95abc340e4dff3f43af786f9a410adb81ccc2712

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