Skip to main content

A module to easily read frames from from a vide and display useful video information.

Project description

Description

frame_generator is a simple python package based on opencv to easily grab frames from a video files. #Features

  • Creates a generator which iteratively yields the frames from a video file.
  • Can skip pre-defined number of frames
  • Can choose color mode of the yielded frame
  • Allow you to display useful information about a video file. #Install
pip install frame_generator

#Usage

Reading frames from a video file

Note: the following script will show every 10th frame from the video.

from frame_generator import FrameGenerator

video_file = "PATH/TO/A/VIDEO/FILE"

fg = FrameGenerator(video_source=video_file, 
                    show_video_info=True, 
                    color_mode="BGR", 
                    every_nth_frame=10)
for frame in fg:
    do_something_with_frame(frame)

Parameters:

video_source: str
    path to the frame_generator file you want to read.

show_video_info: bool
    if true then frame_generator info is printed to the console

every_nth_frame: int
    every nth frame will be yielded by the generator. 
    1 means that every single frame will be yielded.

color_mode: str, Optional
    can be 'RGB', 'BGR' or 'Grayscale'
Getting and displaying video info
from frame_generator.video_info import get_video_info, prettify_video_info

video_file = "PATH/TO/A/VIDEO/FILE"
video_file, frame_count, fps, length, height, width = get_video_info(
    video_file
)
print(prettify_video_info(video_file, 
                          frame_count, 
                          fps, 
                          length, 
                          height, 
                          width))

Project details


Release history Release notifications | RSS feed

This version

1.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

frame_generator-1.0.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

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

frame_generator-1.0-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file frame_generator-1.0.tar.gz.

File metadata

  • Download URL: frame_generator-1.0.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/50.1.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.2

File hashes

Hashes for frame_generator-1.0.tar.gz
Algorithm Hash digest
SHA256 cc4a39d303e99943be3a719ef928ce8a637707e19e467c6c06c28a9fd976621c
MD5 caec22f63931c666fa49b52020a0d1d4
BLAKE2b-256 0bcd6975db62a0477aa59ddc7e4b5fff6be39e8e60a6043dcaa948707fb2d9af

See more details on using hashes here.

File details

Details for the file frame_generator-1.0-py3-none-any.whl.

File metadata

  • Download URL: frame_generator-1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/50.1.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.2

File hashes

Hashes for frame_generator-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1231900c5e44317259c4686cb54c3e3e742151b23975cd53913fb89fb78c44fc
MD5 b5e3d63c363b0b4396a0dda83ba3c2ce
BLAKE2b-256 ea11bd511a55517aae0a756548724afa98424d7f31c05cb7eb2090678284455c

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