Skip to content
Akash Mahanty edited this page Nov 13, 2021 · 14 revisions

VideoHash class

Only one parameter out of path and url must have an argument, passing both will raise ValueError. And if none of them has an argument the instance will raise videohash.exceptions.DidNotSupplyPathOrUrl.

videohash.VideoHash(path=None, url=None, storage_path=None, download_worst=True)

  • creates a VideoHash object that can be used to calculate the video hash value for a video

  • Parameters:

  • path - Absolute path of the video file.
  • url - URL of the video file. Every URL that is supported by the yt-dlp package can be used.
  • storage_path - If you want to provide a storage path for the files created/downloaded by the instance, pass the absolute path to that directory.
  • download_worst - The default argument is True and the instance downloads the worst quality video possible to save bandwidth. If set to False, download the default quality of youtube-dl/yt-dlp downloader. These two downloaders default to the best quality video.

Exceptions

VideoHashError
  • Base Exception for the videohash package. All the other exceptions inherit from VideoHashError.
StoragePathDoesNotExist
  • The storage path passed by the user does not exist. Make sure that the absolute directory path passed ends with either '/' or '' depending on your system to avoid this exception.
FramesExtractorOutPutDirDoesNotExist
  • The frames output directory passed to the frame extractor does not exist.
DownloadOutPutDirDoesNotExist
  • The output directory passed to downloader for storing the downloaded video does not exist.
DidNotSupplyPathOrUrl
  • Must supply either a path for the video or a valid URL.
CollageOfZeroFramesError
  • Raised if zero frames are passed for collage making.
DownloadFailed
  • Download software failed to download the video from the URL.
FFmpegError
  • Base error for the FFmpeg software.
FFmpegNotFound
  • FFmpeg is either not installed or not in the executable path of the system.
FFmpegFailedToExtractFrames
  • FFmpeg failed to extract any frame at all. Maybe the input video is damaged or corrupt.
Clone this wiki locally