Skip to main content

Video Sampler -- sample frames from a video file

Project description

video-sampler

Python Version Dependencies Status

Code style: black Pre-commit

License

Video sampler allows you to efficiently sample video frames. Currently it uses keyframe decoding, frame interval gating and perceptual hashing to reduce duplicated samples.

Use case: for sampling videos for later annotations used in machine learning.

Installation and Usage

pip install -U video-sampler

then you can run

python3 -m video-sampler --help

Basic usage

python3 -m  video-sampler FatCat.mp4 ./dataset-frames/ --hash-size 3 --buffer-size 20

Benchmarks

Configuration for this benchmark:

SamplerConfig(min_frame_interval_sec=1.0, keyframes_only=True, buffer_size=10, hash_size=X, queue_wait=0.1, debug=True)
Video Hash size Decoded Saved
Fat Cat Video 8 297 278
Fat Cat Video 4 297 173
SmolCat 8 118 106
SmolCat 4 118 62
HighLemurs 8 458 441
HighLemurs 4 458 309

Flit commands

Build

flit build

Install

flit install

Publish

flit publish

🛡 License

License

This project is licensed under the terms of the MIT license. See LICENSE for more details.

📃 Citation

@misc{video-sampler,
  author = {video-sampler},
  title = {Video sampler allows you to efficiently sample video frames},
  year = {2023},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {\url{https://github.com/LemurPwned/video-sampler}}
}

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_sampler-0.4.0.tar.gz (11.3 kB view hashes)

Uploaded Source

Built Distribution

video_sampler-0.4.0-py3-none-any.whl (6.9 kB view hashes)

Uploaded Python 3

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