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 hashes)

Uploaded Source

Built Distribution

frame_generator-1.0-py3-none-any.whl (5.0 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