VideoHash Operator

Description

The VideoHash operator generates perceptual hashes from video files using the TMK (Temporal Media Key) algorithm. It extracts the pure average feature from videos and returns it as a Base64-encoded string. This operator is useful for video similarity detection, duplicate detection, and content fingerprinting.

Model Information

  • Algorithm: TMK (Temporal Media Key) + PDQF (Perceptual Diff Quality Function)

  • Source: Facebook AI Research

  • Hash Type: Pure average feature vector

  • Output Format: Base64-encoded string

  • Usage: The operator processes video files to generate perceptual hashes that can be used for video similarity comparison, duplicate detection, and content fingerprinting.

Dependencies

  • FFmpeg

    • On Windows, you have two methods:

      1. Download from ffmpeg.org and add to PATH

      2. Use winget install ffmpeg from an elevated PowerShell (Make sure you have winget installed first)

    • On Linux/macOS, install via your package manager (e.g., sudo apt install ffmpeg)

How to Run the Tests

  1. Ensure that you are in the root directory of the feluda project.

  2. Install dependencies (in your virtual environment):

    uv pip install "./operators/video_hash"
    uv pip install "feluda[dev]"
    
  3. Ensure FFmpeg is installed and available in your PATH.

  4. Run the tests:

    pytest operators/video_hash/test.py
    

Usage